Commit 2f4a82ef authored by Jaromil's avatar Jaromil
Browse files

small check on F.map() input table

parent 124415f7
...@@ -231,6 +231,11 @@ end ...@@ -231,6 +231,11 @@ end
-- @param[opt] ... Optional args to be passed to `f` -- @param[opt] ... Optional args to be passed to `f`
-- @return a table of results -- @return a table of results
function _.map(t, f, ...) function _.map(t, f, ...)
-- safety
if not (type(t) == "table") then return {} end
if t == nil then return {} end
-- if #t == 0 then return {} end
local _t = {} local _t = {}
for index,value in _.pairs(t) do for index,value in _.pairs(t) do
local k, kv, v = index, f(index,value,...) local k, kv, v = index, f(index,value,...)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment