@kingjs/descriptor.nested.array.to-paths
v1.0.5
Published
Returns paths of an array tree.
Downloads
9
Readme
@kingjs/descriptor.nested.array.to-paths
Returns paths constructed of nodes that satisfy a predicate.
Usage
Return an array of pet names like this:
var toPaths = require('@kingjs/descriptor.nested.array.to-paths');
var pets = [
['tiger'],
['snuggles'],
['spike'],
];
var result = toPaths(
pets,
null
);
result:
{
'0': { '0': null },
'1': { '0': null },
'2': { '0': null },
}
API
declare function toPaths(
tree: NestedArray,
value?: any
): NestedDescriptor
Interfaces
NestedArray
: see @kingjs/descriptor/nested/arrayNestedDescriptor
: see @kingjs/descriptor/nested
Parameters
tree
: An array tree whose paths are returned.value
: Optional leaf value.
Returns
Returns paths of the array tree.
Install
With npm installed, run
$ npm install @kingjs/descriptor.nested.array.to-paths
License
MIT