1.0.5 • Published 6 years ago

@kingjs/descriptor.nested.array.to-paths v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

@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

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

Analytics