Class: Recur

Recur

Recursive traversal callback for a given node at a given depth.

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.
Author:
  • Ryan Sandor Richards
Source:
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.
Source:

setReduce(fn)

Sets the reduce function for `.each`.
Parameters:
Name Type Description
fn function Reduce function.
Source:

setReduceInitial(initial)

Sets initial value for `.each` reduce.
Parameters:
Name Type Description
initial Intial value.
Source:

stop()

Stop automatic traversal for names defined with `TreeTraversal.preorder` and `TreeTraversal.postorder`.
Source: