npm stats
  • Search
  • About
  • Repo
  • Sponsor
  • more
    • Search
    • About
    • Repo
    • Sponsor

Made by Antonio Ramirez

keys-tree

0.1.0

@jonschlinkert

npmHomeRepoSnykSocket
Downloads:1
$ npm install keys-tree
DailyWeeklyMonthlyYearly

keys-tree NPM version Build Status

Recursively builds a tree of object keys. Useful for creating lists or debugging.

Install with npm

npm i keys-tree --save

Usage

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.c paths.

Running tests

Install dev dependencies.

npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Author

Jon Schlinkert

  • github/jonschlinkert
  • twitter/jonschlinkert

License

Copyright (c) 2015 Jon Schlinkert
Released under the MIT license


This file was generated by verb-cli on March 22, 2015.