mirror of
https://github.com/flynx/walk.js.git
synced 2025-10-29 11:00:13 +00:00
fixed a typo...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
1f6b2a0f69
commit
b28589d13c
@ -63,7 +63,7 @@ And for *flat* lists `.reduce(..)` and friends are simpler and more logical. `wa
|
|||||||
// sum the items in a *deep* array (depth-first)...
|
// sum the items in a *deep* array (depth-first)...
|
||||||
var sum = walk(function(r, n, next){
|
var sum = walk(function(r, n, next){
|
||||||
return n instanceof Array ?
|
return n instanceof Array ?
|
||||||
next('queue', r, ...n)
|
next('do', r, ...n)
|
||||||
: r + n }, 0)
|
: r + n }, 0)
|
||||||
|
|
||||||
sum( [1, [2, 3], 4, [[5], 6]] ) // -> 21
|
sum( [1, [2, 3], 4, [[5], 6]] ) // -> 21
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user