mirror of
https://github.com/TangentFoxy/lume.git
synced 2024-11-19 07:04:24 +00:00
Updated README.md and tests for lume.combine()
This commit is contained in:
parent
283f7ee787
commit
fff0d780bb
@ -217,8 +217,9 @@ lume.time(function(x) return x end, "hello") -- Returns 0, "hello"
|
|||||||
|
|
||||||
### lume.combine(...)
|
### lume.combine(...)
|
||||||
Creates a wrapper function which calls each supplied argument in the order they
|
Creates a wrapper function which calls each supplied argument in the order they
|
||||||
were passed to `lume.combine`. The wrapper function passes its own arguments to
|
were passed to `lume.combine()`; nil arguments are ignored. The wrapper
|
||||||
each of its wrapped functions when it is called.
|
function passes its own arguments to each of its wrapped functions when it is
|
||||||
|
called.
|
||||||
```lua
|
```lua
|
||||||
local f = lume.combine(function(a, b) print(a + b) end,
|
local f = lume.combine(function(a, b) print(a + b) end,
|
||||||
function(a, b) print(a * b) end)
|
function(a, b) print(a * b) end)
|
||||||
|
@ -294,6 +294,10 @@ tests["lume.combine"] = function()
|
|||||||
local fn = lume.combine(a, b)
|
local fn = lume.combine(a, b)
|
||||||
fn(10, 20)
|
fn(10, 20)
|
||||||
testeq( acc, 230 )
|
testeq( acc, 230 )
|
||||||
|
acc = 0
|
||||||
|
fn = lume.combine(nil, a, nil, b, nil)
|
||||||
|
fn(10, 20)
|
||||||
|
testeq( acc, 230 )
|
||||||
end
|
end
|
||||||
|
|
||||||
-- lume.lambda
|
-- lume.lambda
|
||||||
|
Loading…
Reference in New Issue
Block a user