Nondigestible Purple Mayonnaise

    array-tree-filter

    2.1.0 • Public • Published

    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: [...] }
    // ]

    Install

    npm i array-tree-filter

    DownloadsWeekly Downloads

    787,038

    Version

    2.1.0

    License

    MIT

    Unpacked Size

    2.95 kB

    Total Files

    4

    Last publish

    Collaborators

    • afc163