Socket
Socket
Sign inDemoInstall

array-tree-filter

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

array-tree-filter

filter in array tree


Version published
Weekly downloads
1.3M
increased by6.48%
Maintainers
1
Weekly downloads
 
Created

What is array-tree-filter?

The array-tree-filter npm package is used to filter tree structures in JavaScript arrays. It allows you to traverse and filter nodes in a tree-like array based on a predicate function.

What are array-tree-filter's main functionalities?

Filter Tree Nodes

This feature allows you to filter nodes in a tree structure based on a predicate function. In this example, the tree is filtered to include only nodes whose value contains '1'.

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

const tree = [
  {
    value: '1',
    children: [
      { value: '1.1', children: [{ value: '1.1.1' }] },
      { value: '1.2' }
    ]
  },
  { value: '2', children: [{ value: '2.1' }] }
];

const result = arrayTreeFilter(tree, (item, level) => item.value.indexOf('1') > -1);
console.log(result);

Other packages similar to array-tree-filter

Keywords

FAQs

Package last updated on 30 Jul 2016

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc