tf

tree-flatten

Flatten a Object Tree Structure to an Array

Showing:

Popularity

Downloads/wk

1.5K

GitHub Stars

17

Maintenance

Last Commit

6yrs ago

Contributors

1

Package

Dependencies

0

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

NPM

Build Status Code Climate Test Coverage Dependencies devDependencies Status

Tree Flatten

Flatten nested tree objects to array

Install

  npm install --save tree-flatten

Usage

  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

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial