reduce

Methods

(inner) deepReduce(reducer, childPathopt) → {InputFunction}

Source:

Once fully applied, this iterates through all nodes in the provided tree, passing them all through a reducer function. Nodes are processed branch by branch in the order that Immutable maps through the child iterables, inward from leaves to the root node. Sibling nodes are processed in the order that Immutable iterates through collections.

Unlike Immutable.js, if the initialReduction is not provided or is null, then the initialReduction will be null.

Parameters:
Name Type Attributes Default Description
reducer Reducer

The function to be called for every node in the tree, the results of which will be used to create the modified tree.

childPath ChildPath <optional>
null

An Array or List of keys indicating where to find each node's children from within each node.

Returns:

A partially applied function which accepts a single tree Iterable, and returns the modified tree Iterable.

Type
InputFunction

(inner) deepReduceLeaves(reducer, childPathopt) → {InputFunction}

Source:

Once fully applied, this iterates through the leaf nodes in the provided tree, passing them all through a reducer function. Leaf nodes are nodes that have no child nodes. Nodes are processed branch by branch, in the order that Immutable maps through the child iterables.

Unlike Immutable.js, if the initialReduction is not provided or is null, then the initialReduction will be null.

Parameters:
Name Type Attributes Default Description
reducer Reducer

The function to be called for every leaf node in the tree, the results of which will be used to create the modified tree.

childPath ChildPath <optional>
null

An Array or List of keys indicating where to find each node's children from within each node.

Returns:

A partially applied function which accepts a single tree Iterable, and returns the modified tree Iterable.

Type
InputFunction

(inner) deepReduceParents(reducer, childPathopt) → {InputFunction}

Source:

Once fully applied, this iterates through the parent nodes in the provided tree, passing them all through a reducer function. Parent nodes are nodes that have child nodes. Nodes are processed branch by branch in the order that Immutable maps through the child iterables, inward from leaves to the root node.

Unlike Immutable.js, if the initialReduction is not provided or is null, then the initialReduction will be null.

Parameters:
Name Type Attributes Default Description
reducer Reducer

The function to be called for every parent node in the tree. the results of which will be used to create the modified iterable.

childPath ChildPath <optional>
null

An Array or List of keys indicating where to find each node's children from within each node.

Returns:

A partially applied function which accepts a single tree Iterable, and returns the modified tree Iterable.

Type
InputFunction

(inner) deepReduceOutwards(reducer, childPathopt) → {InputFunction}

Source:

Once fully applied, this iterates through all nodes in the provided tree, passing them all through a reducer function. Nodes are processed branch by branch in the order that Immutable maps through the child iterables, outwards from the root node to the leaf nodes. Sibling nodes are processed in the order that Immutable iterates through collections.

Unlike Immutable.js, if the initialReduction is not provided or is null, then the initialReduction will be null.

Parameters:
Name Type Attributes Default Description
reducer Reducer

The function to be called for every node in the tree, the results of which will be used to create the modified tree.

childPath ChildPath <optional>
null

An Array or List of keys indicating where to find each node's children from within each node.

Returns:

A partially applied function which accepts a single tree Iterable, and returns the modified tree Iterable.

Type
InputFunction

(inner) deepReduceLeavesOutwards(reducer, childPathopt) → {InputFunction}

Source:

Once fully applied, this iterates through the leaf nodes in the provided tree, passing them all through a reducer function. Nodes are processed branch by branch in the order that Immutable maps through the child iterables, outwards from the root node to the leaf nodes. Sibling nodes are processed in the order that Immutable iterates through collections.

Because this moves from the root node outwards this function behaves quite differently to the other deep map functions.

Unlike Immutable.js, if the initialReduction is not provided or is null, then the initialReduction will be null.

Parameters:
Name Type Attributes Default Description
reducer Reducer

The function to be called for every leaf node in the tree, the results of which will be used to create the modified tree.

childPath ChildPath <optional>
null

An Array or List of keys indicating where to find each node's children from within each node.

Returns:

A partially applied function which accepts a single tree Iterable, and returns the modified tree Iterable.

Type
InputFunction

(inner) deepReduceParentsOutwards(reducer, childPathopt) → {InputFunction}

Source:

Once fully applied, this iterates through the parent nodes in the provided tree, passing them all through a reducer function. Nodes are processed branch by branch in the order that Immutable maps through the child iterables, outwards from the root node to the leaf nodes. Sibling nodes are processed in the order that Immutable iterates through collections.

Because this moves from the root node outwards this function behaves quite differently to the other deep map functions.

Unlike Immutable.js, if the initialReduction is not provided or is null, then the initialReduction will be null.

Parameters:
Name Type Attributes Default Description
reducer Reducer

The function to be called for every parent node in the tree, the results of which will be used to create the modified tree.

childPath ChildPath <optional>
null

An Array or List of keys indicating where to find each node's children from within each node.

Returns:

A partially applied function which accepts a single tree Iterable, and returns the modified tree Iterable.

Type
InputFunction