objdepth
Analyze any value for how deep an object structure it contains and where there might be recursion. Formerly known as object-depth-finder.
Usage
from test/usage.js:
var objectDepthFinder = report compactJson = aquarium = {} animals = goldfish: home: aquarium swim: true cat: feet: 4 color: 'orange' 'white' scanOpts = hooks: finishedBranch: objectDepthFinderhooktoCleanArrays metaPath: true ;aquariumfish = animalsgoldfish ;report = ;console;
Result:
Options
circular
: (any value) What to put in the value slot for a circular reference. Choose something that, when you see it in your debug dump, reminds you to double-check thedepth
of that object. If thedepth
is zero or positive, your tree really contains this value. If thedepth
is negative, your tree references the objectMath.abs(depth)
levels up. Default:<(circular)>
hooks
: (false or object) Meddle with scanning, see below.metaPath
: (bool) Whether to include thepath
property in meta data.sortKeys
: (bool or func) Secret ninja option.
Hooks
Still beta, but the one shown in the usage example is there to stay.
Search the source for .hook(
to find event names,
and for .hook.
to find some included handlers.
License
ISC