Socket
Socket
Sign inDemoInstall

array-tree-filter

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    array-tree-filter

filter in array tree


Version published
Weekly downloads
1.1M
increased by6.39%
Maintainers
1
Install size
3.76 kB
Created
Weekly downloads
 

Readme

Source

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

Keywords

FAQs

Last updated on 07 Feb 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc