You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1.0 KiB

3 years ago
-- ------------------------------------------------------------------------------ --
-- TradeSkillMaster --
-- https://tradeskillmaster.com --
-- All Rights Reserved - Detailed license information included with addon. --
-- ------------------------------------------------------------------------------ --
local _, TSM = ...
local Util = TSM.Init("Util.DatabaseClasses.Util")
local Math = TSM.Include("Util.Math")
-- ============================================================================
-- Module Functions
-- ============================================================================
function Util.ToIndexValue(value)
if value == nil then
return nil
end
local valueType = type(value)
if valueType == "string" then
return strlower(value)
elseif valueType == "boolean" then
return value and 1 or 0
elseif valueType == "number" and Math.IsNan(value) then
return nil
else
return value
end
end