mirror of
https://github.com/TangentFoxy/lume.git
synced 2024-11-19 07:04:24 +00:00
Made calling lume table an alias to calling lume.chain()
Updated tests
This commit is contained in:
parent
df26e7939d
commit
5d258d4fd0
6
lume.lua
6
lume.lua
@ -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
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user