Methods
(inner) deepMap(mapper, childPathopt) → {InputFunction}
Once fully applied, this iterates through all nodes in the provided tree, passing them all through a mapper
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.
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 tree. |
||
childPath |
ChildPath |
<optional> |
null
|
An |
Returns:
A partially applied function which accepts a single tree Iterable
, and returns the modified tree Iterable
.
- Type
- InputFunction
(inner) deepMapLeaves(mapper, childPathopt) → {InputFunction}
Once fully applied, this iterates 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 leaf node in the tree, the results of which will be used to create the modified tree. |
||
childPath |
ChildPath |
<optional> |
null
|
An |
Returns:
A partially applied function which accepts a single tree Iterable
, and returns the modified tree Iterable
.
- Type
- InputFunction
(inner) deepMapParents(mapper, childPathopt) → {InputFunction}
Once fully applied, this iterates 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 branch by branch in the order that Immutable maps through the child iterables, inward from leaves to the root node.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
mapper |
Mapper | 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 |
Returns:
A partially applied function which accepts a single tree Iterable
, and returns the modified tree Iterable
.
- Type
- InputFunction
(inner) deepMapOutwards(mapper, childPathopt) → {InputFunction}
Once fully applied, this iterates through all nodes in the provided tree, passing them all through a mapper
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.
- If you modify a node's children, then those children will already be modified by the time they are called by the
mapper
function. - Because of the above, if a node removes or renames its own children iterable then those children will not be passed through the
mapper
function.
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 tree. |
||
childPath |
ChildPath |
<optional> |
null
|
An |
Returns:
A partially applied function which accepts a single tree Iterable
, and returns the modified tree Iterable
.
- Type
- InputFunction
(inner) deepMapLeavesOutwards(mapper, childPathopt) → {InputFunction}
Once fully applied, this iterates through the leaf nodes in the provided tree, passing them all through a mapper
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.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
mapper |
Mapper | 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 |
Returns:
A partially applied function which accepts a single tree Iterable
, and returns the modified tree Iterable
.
- Type
- InputFunction
(inner) deepMapParentsOutwards(mapper, childPathopt) → {InputFunction}
Once fully applied, this iterates through the parent nodes in the provided tree, passing them all through a mapper
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.
- If you modify a node's children, then those children will already be modified by the time they are called by the
mapper
function. - Because of the above, if a node removes or renames its own children iterable then those children will not be passed through the
mapper
function.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
mapper |
Mapper | 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 |
Returns:
A partially applied function which accepts a single tree Iterable
, and returns the modified tree Iterable
.
- Type
- InputFunction