JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1035256
  • Score
    100M100P100Q186931F
  • License MIT

filter in array tree

Package Exports

  • array-tree-filter

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (array-tree-filter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

array-tree-filter

NPM version Build Status David Status NPM downloads


var arrayTreeFilter = require('array-tree-filter');

var data = [{
  value: 'a',
  children: [{
    value: 'b',
    children: [{
      value: 'c'
    }, {
      value: 'd'
    }]
  }]
}];

var values = ['a', 'b', 'c'];

var result = arrayTreeFilter(data, function(item, level) {
  return item.value === values[level];
});

console.log(result);
// [
//   { value: 'a', children: [...] },
//   { value: 'b', children: [...] },
//   { value: 'c', children: [...] }
// ]