Install
npm install lodash-flatkeystree
Purpose
Need a way to get all the key paths in an object? Look no further.
Also ignores circular references in an object.
_.keysDeep(object, [depth = 1])
Arguments
- object: The object to get keys from
- depth: The number of circular objects to traverse/include. (default 1)
Use
var _ = keysDeep = ; _; var obj = a: tree: 'that' 'goes' deep: '!' b: 1235813 another: key: 1385321; _; 'a.tree.0' 'a.tree.1' 'a.tree.2.deep' 'b.0' 'b.1' 'b.2' 'b.3' 'b.4' 'b.5' 'b.6.another.key.0' 'b.6.another.key.1' 'b.6.another.key.2' 'b.6.another.key.3' 'b.6.another.key.4' 'b.6.another.key.5' ;
Circular with depth > 1
var circularObj = a: tree: 'that' 'goes' deep: '!' b: 1235813 another: key: 1385321; circularObjc = cir: circularObja something: 'else'; _; 'a.tree.0' 'a.tree.1' 'a.tree.2.deep' 'b.0' 'b.1' 'b.2' 'b.3' 'b.4' 'b.5' 'b.6.another.key.0' 'b.6.another.key.1' 'b.6.another.key.2' 'b.6.another.key.3' 'b.6.another.key.4' 'b.6.another.key.5' 'c.cir.tree.0' 'c.cir.tree.1' 'c.cir.tree.2.deep' 'c.something'