map convience functions (refactor)

This commit is contained in:
kepler155c@gmail.com
2019-02-25 09:02:40 -05:00
parent 687fc05445
commit 8f4324f1d8
3 changed files with 38 additions and 18 deletions

View File

@@ -187,20 +187,6 @@ function Util.deepMerge(obj, args)
end
end
-- remove table entries if passed function returns false
function Util.prune(t, fn)
for _,k in pairs(Util.keys(t)) do
local v = t[k]
if type(v) == 'table' then
t[k] = Util.prune(v, fn)
end
if not fn(t[k]) then
t[k] = nil
end
end
return t
end
function Util.transpose(t)
local tt = { }
for k,v in pairs(t) do