object-leaves
v1.0.0
Published
Enumerates the leaves of an object.
Downloads
67
Readme
object-leaves
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