--[[*
 * Helpers
 ]]


local function expandRange(args: Array<any>, options)
	if typeof(options.expandRange) == "function" then
		return options.expandRange(table.unpack(args), options)
	end

	Array.sort(args)
	local value = ("[%s]"):format(Array.join(args, "-"))

	local ok = pcall(function()
		--[[ eslint-disable-next-line no-new ]]
		RegExp(value)
	end)
	if not ok then
		return Array.join(
			Array.map(args, function(v)
				return utils.escapeRegex(v)
			end),
			".."
		)
	end

	return value
end
