Socket
Socket
Sign inDemoInstall

tree-flatten

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    tree-flatten

Flatten nested tree objects to array


Version published
Maintainers
1
Install size
5.33 kB
Created

Readme

Source

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

Keywords

FAQs

Last updated on 25 Mar 2016

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