map

Methods

(inner) deepMap(mapper, childPathopt) → {inputFunction}

Source:
Maps through all nodes in the provided tree, passing them all through a mapper function. Nodes are processed inward from leaves to the root node, branch by branch, in the order that Immutable maps through the child iterables. Sibling nodes are processed in the order that Immutable.js iterates through collections. TODO: note about care with child collections, note about using as reduce
Parameters:
Name Type Attributes Default Description
mapper mapper The function to be called for every node in the tree, the results of which will be used to create the modified iterable.
childPath Array | List <optional>
null An {Array} or {List} of the key path to each node's children.
Returns:
A partially applied function which accepts a single tree interable, and returns the modified iterable.
Type
inputFunction

(inner) deepMapLeaves(mapper, childPathopt) → {inputFunction}

Source:
Maps through the leaf nodes in the provided tree, passing them all through a mapper 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.
Parameters:
Name Type Attributes Default Description
mapper mapper The function to be called for every node in the tree. the results of which will be used to create the modified iterable.
childPath Array | List <optional>
null An {Array} or {List} of the key path to each node's children.
Returns:
A partially applied function which accepts a single tree interable, and returns the modified iterable.
Type
inputFunction

(inner) deepMapParents(mapper, childPathopt) → {inputFunction}

Source:
Maps through the parent nodes in the provided tree, passing them all through a mapper function. Parent nodes are nodes that have child nodes. Nodes are processed inward from leaves to the root node, branch by branch, in the order that Immutable maps through the child iterables.
Parameters:
Name Type Attributes Default Description
mapper mapper The function to be called for every node in the tree. the results of which will be used to create the modified iterable.
childPath Array | List <optional>
null An {Array} or {List} of the key path to each node's children.
Returns:
A partially applied function which accepts a single tree interable, and returns the modified iterable.
Type
inputFunction

Type Definitions

inputFunction(tree) → {Iterable}

Source:
Parameters:
Name Type Description
tree Iterable The tree Iterable to be processed by one of the deep functions.
Returns:
The modified iterable.
Type
Iterable

mapper(value, keys, children) → {*}

Source:
Parameters:
Name Type Description
value * The value of the current node
keys List A List of all the keys to the current node
children List | null A list of the current node's children
Returns:
The replacement value.
Type
*