1.0.4 • Published 6 years ago
@kingjs/descriptor.nested.array.for-each v1.0.4
@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/arrayNestedDescriptor
: 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