0.1.0 • Published 11 years ago
keys-tree v0.1.0
keys-tree

Recursively builds a tree of object keys. Useful for creating lists or debugging.
Install with npm
npm i keys-tree --saveUsage
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' ] } } }Other object utils
- 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.cpaths.
Running tests
Install dev dependencies.
npm i -d && npm testContributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Author
Jon Schlinkert
License
Copyright (c) 2015 Jon Schlinkert
Released under the MIT license
This file was generated by verb-cli on March 22, 2015.
0.1.0
11 years ago