Basic functions to recursively work with nested data when you do not care about the context.
The iteratee
or predicate
functions are invoked with three arguments (in order):
value [Any]
The current iteration valuekey [Mixed]
The key for iteration valueparent [Mixed]
The key of data containing iteration value
Mixed
is equal to:
String
for object propertyNumber
for array indexUndefined
for primitive
{
parent: [
childA,
[childB, childC],
childD
]
}
iterations arguments:
- childA, 0, "parent"
- childB, 0, 1
- childC, 1, 1
- childD, 2, "parent"
deepEach(data, iteratee)
data [Any]
The data to iterate overiteratee [Function]
The function invoked per iteration
Returns data
deepMap(data, iteratee)
data [Any]
The data to iterate overiteratee [Function]
The function invoked per iteration
Returns the new mapped data
deepFilter(data, predicate)
data [Any]
The data to iterate overpredicate [Function]
The function invoked per iteration
Returns the new filtered data
.
Important! When data
is primitive and predicate returns false
then function returns Null
.