kingjs/descriptor.nested.array.for-each
@Invokes a callback on each value of a array tree.
Usage
Replace the name of the person followed with the object representing the person being followed like this:
var forEach = require('@kingjs/descriptor.nested.array.for-each');
var tree = [['bob'], 'chris', 'alice'];
var result = { };
forEach(
tree,
x => result[x] = true
)
result:
[
bob: true,
chris: true,
alice: true
]
API
declare function forEach(
tree: NestedDescriptor,
callback: (value) => any,
thisArg?
)
Interfaces
-
NestedArray
: see @kingjs/descriptor/nested/array -
NestedDescriptor
: see @kingjs/descriptor
Parameters
-
tree
: The array tree whose values are going to be updated. -
callback
: Used to update values oftree
:-
value
: The current value.
-
-
thisArg
: Thethis
argument to pass tocallback
.
Install
With npm installed, run
$ npm install @kingjs/descriptor.nested.array.for-each
License
MIT