# array-tree-filter

> filter in array tree

Latest version **3.0.3** (published 2025-05-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install array-tree-filter
pnpm add array-tree-filter
yarn add array-tree-filter
bun add array-tree-filter
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.3 |
| Published | 2025-05-23 |
| First published | 2015-12-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 59 |
| Author | afc163 |
| Maintainers | afc163 |
| Keywords | array, tree, filter |

## Links

- npm: https://www.npmjs.com/package/array-tree-filter
- Repository: https://github.com/afc163/array-tree-filter
- Homepage: https://github.com/afc163/array-tree-filter#readme
- Issues: https://github.com/afc163/array-tree-filter/issues
- npm.io page: https://npm.io/package/array-tree-filter

## Recent versions

- 3.0.3 (latest) — 2025-05-23
- 3.0.2 — 2024-10-22
- 3.0.1 — 2024-10-22
- 3.0.0 — 2024-10-22
- 2.1.0 — 2018-02-07
- 2.0.0 — 2017-12-14
- 1.0.1 — 2016-07-30
- 1.0.0 — 2015-12-23

## README

# array-tree-filter

Filter and traverse nested hierarchical tree structures.

[![NPM version](https://img.shields.io/npm/v/array-tree-filter.svg?style=flat)](https://npmjs.org/package/array-tree-filter)
[![NPM downloads](http://img.shields.io/npm/dm/array-tree-filter.svg?style=flat)](https://npmjs.org/package/array-tree-filter)
[![codecov](https://codecov.io/gh/afc163/array-tree-filter/branch/main/graph/badge.svg?token=YOUR_CODECOV_TOKEN)](https://codecov.io/gh/afc163/array-tree-filter)

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

---
_Source: https://npm.io/package/array-tree-filter · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
