array-tree-filter
filter in array tree
Last updated 7 years ago by afc163 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install array-tree-filter 
SYNC missed versions from official npm registry.

array-tree-filter

Filter by keys in array tree.

NPM version Build Status David Status NPM downloads

import arrayTreeFilter from 'array-tree-filter';

const data = [{
  value: 'a',
  children: [{
    value: 'b',
    children: [{
      value: 'c'
    }, {
      value: 'd',
    }]
  }],
}];
const values = ['a', 'b', 'c'];
const result = arrayTreeFilter(
  data, (item, level) => item.value === values[level]
);

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

Current Tags

  • 2.1.0                                ...           latest (7 years ago)

4 Versions

  • 2.1.0                                ...           7 years ago
  • 2.0.0                                ...           7 years ago
  • 1.0.1                                ...           8 years ago
  • 1.0.0                                ...           9 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (3)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |