Recursively builds a tree of object keys. Useful for creating lists or debugging.
Install with npm
npm i keys-tree --save
var keys = require('keys-tree');
keys({a: 'b', c: 'd'});
//=> { keys: [ 'a', 'c' ] }
keys({a: 'b', c: {d: 'e', f: 'g'}});
//=> { keys: [ 'a', 'c' ], c: { keys: [ 'd', 'f' ] } }
keys({a: 'b', c: {d: 'e', f: 'g', h: {i: 'j', k: 'l', m: 'n'}}});
// results in:
// { keys: [ 'a', 'c' ],
// c: { keys: [ 'd', 'f', 'h' ],
// h: { keys: [ 'i', 'k', 'm' ] } } }
- stringify-keys: Build an array of key paths from an object.
- rename-keys: Modify the names of the own enumerable properties (keys) of an object.
- get-value: Use property paths (
a.b.c
) get a nested value from an object. - set-object: Create nested objects and any intermediaries using
a.b.c
paths.
Install dev dependencies.
npm i -d && npm test
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Jon Schlinkert
Copyright (c) 2015 Jon Schlinkert
Released under the MIT license
This file was generated by verb-cli on March 22, 2015.