# tree-flatten

> Flatten nested tree objects to array

Latest version **1.0.0** (published 2016-03-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install tree-flatten
pnpm add tree-flatten
yarn add tree-flatten
bun add tree-flatten
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2016-03-25 |
| First published | 2016-03-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 18 |
| Author | Cantidio Fontes |
| Maintainers | cantidio |
| Keywords | tree, object, flatten, recursive, depth, array, for |

## Links

- npm: https://www.npmjs.com/package/tree-flatten
- Repository: https://github.com/cantidio/node-tree-flatten
- Homepage: https://github.com/cantidio/node-tree-flatten#readme
- Issues: https://github.com/cantidio/node-tree-flatten/issues
- npm.io page: https://npm.io/package/tree-flatten

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2016-03-25
- 0.1.0 — 2016-03-25

## README

[![NPM](https://nodei.co/npm/tree-flatten.png)](https://nodei.co/npm/tree-flatten/)

[![Build Status](https://travis-ci.org/cantidio/node-tree-flatten.svg?branch=master)](https://travis-ci.org/cantidio/node-tree-flatten)
[![Code Climate](https://codeclimate.com/github/cantidio/node-tree-flatten/badges/gpa.svg)](https://codeclimate.com/github/cantidio/node-tree-flatten)
[![Test Coverage](https://codeclimate.com/github/cantidio/node-tree-flatten/badges/coverage.svg)](https://codeclimate.com/github/cantidio/node-tree-flatten/coverage)
[![Dependencies](https://david-dm.org/cantidio/node-tree-flatten.svg)](https://david-dm.org/cantidio/node-tree-flatten)
[![devDependencies Status](https://david-dm.org/cantidio/node-tree-flatten/dev-status.svg)](https://david-dm.org/cantidio/node-tree-flatten#info=devDependencies)


# Tree Flatten

> Flatten nested tree objects to array

## Install
```
  npm install --save tree-flatten
```
## Usage
```js
  const flatten = require('tree-flatten');
  const tree = {
    name: 'root-1',
    children: [{
      name: 'root-1-1'
    }, {
      name: 'root-1-2',
      children:[{
        name: 'root-1-2-1'
      }]
    }]
  };

  flatten(tree, 'children')
  /* =>
  [
    { name: 'root-1' },
    { name: 'root-1-1' },
    { name: 'root-1-2' },
    { name: 'root-1-2-1' },
  ]
  */
```

### License
MIT

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