Skip to content

Commit

Permalink
Updated gpm.utils.LowerTableKeys( tbl )
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown-gd committed Jul 9, 2023
1 parent 1c5aee8 commit cd037b9
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lua/gpm/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -372,9 +372,16 @@ end

function utils.LowerTableKeys( tbl )
for key, value in pairs( tbl ) do
if type( value ) == "table" then value = utils.LowerTableKeys( value ) end
if type( key ) ~= "string" then continue end
tbl[ key ] = nil; tbl[ string.lower( key ) ] = value
if type( value ) == "table" then
value = utils.LowerTableKeys( value )
end

local keyType = type( key )
if keyType == "string" then
tbl[ key ] = nil; tbl[ string.lower( key ) ] = value
elseif keyType == "table" then
tbl[ key ] = nil; tbl[ utils.LowerTableKeys( key ) ] = value
end
end

return tbl
Expand Down

0 comments on commit cd037b9

Please sign in to comment.