Made calling lume table an alias to calling lume.chain()

Updated tests
This commit is contained in:
rxi 2014-12-12 20:25:54 +00:00
parent df26e7939d
commit 5d258d4fd0
2 changed files with 8 additions and 0 deletions

View File

@ -479,5 +479,11 @@ function lume.chain(value)
return setmetatable({ _value = value }, chain_mt) return setmetatable({ _value = value }, chain_mt)
end end
setmetatable(lume, {
__call = function(t, ...)
return lume.chain(...)
end
})
return lume return lume

View File

@ -435,6 +435,8 @@ tests["lume.chain"] = function()
local t = lume.chain({1, 2}):map(function(x) return x * 2 end):result() local t = lume.chain({1, 2}):map(function(x) return x * 2 end):result()
testeq( t, { 2, 4 } ) testeq( t, { 2, 4 } )
testeq( lume.chain(10):result(), 10 ) testeq( lume.chain(10):result(), 10 )
local t = lume({1, 2}):map(function(x) return x * 2 end):result()
testeq( t, { 2, 4 } )
end end