1.0.0 • Published 9 years ago

object-leaves v1.0.0

Weekly downloads
7
License
MIT
Repository
github
Last release
9 years ago

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