မေႃႇၵျူး:utilities/scribunto parameter key
Appearance
Documentation for this module may be created at မေႃႇၵျူး:utilities/scribunto parameter key/doc
local match = string.match
local tonumber = tonumber
local trim = require("Module:string/php trim")
local type = type
return function(key)
if type(key) ~= "string" then
return key
end
key = trim(key)
if match(key, "^-?[1-9]%d*$") then
local num = tonumber(key)
return (
num <= 9007199254740991 and num >= -9007199254740991 or
key == "9007199254740992" or
key == "-9007199254740992"
) and num or key
elseif key == "0" then
return 0
end
return key
end