Constructor
new Recur(parent, depth) → {TreeTraversal~recur}
Parameters:
Name | Type | Description |
---|---|---|
parent |
Object | Parent node of the recur. |
depth |
Number | Depth of the parent node. |
Returns:
The recur method for the node and depth.
- Type
- TreeTraversal~recur
Methods
each(list, givenDepthopt)
Recurs further in the traversal for each node in a given array.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
list |
Array | Array of nodes to traverse. | |
givenDepth |
Number |
<optional> |
Traversal depth override. |
setReduce(fn)
Sets the reduce function for `.each`.
Parameters:
Name | Type | Description |
---|---|---|
fn |
function | Reduce function. |
setReduceInitial(initial)
Sets initial value for `.each` reduce.
Parameters:
Name | Type | Description |
---|---|---|
initial |
Intial value. |
stop()
Stop automatic traversal for names defined with `TreeTraversal.preorder`
and `TreeTraversal.postorder`.