object-leaves

1.0.0 • Public • Published

object-leaves NPM version Build Status Dependency Status Coverage Status Code Climate

Enumerates the leaves of an object.

Install

$ npm install --save object-leaves

Usage

'use strict';
 
var objectLeaves = require('object-leaves');
 
console.log(objectLeaves({
  foo: 'bar',
  baz: 'boom',
  one: {
    two: {
      three: {
        four: {
          five: 'six'
        }
      }
    }
  }
}));

output:

[ { key: 'foo', value: 'bar', path: [ 'foo' ] },
  { key: 'baz', value: 'boom', path: [ 'baz' ] },
  { key: 'five',
    value: 'six',
    path: [ 'one', 'two', 'three', 'four', 'five' ] } ]

License

MIT © Andrew Morris

Readme

Keywords

Package Sidebar

Install

npm i object-leaves

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • voltrevo