object-walker
Walk Objects like an Acrobat
A functional object walker node module, with user-settable handlers for each of the following value types:
- Object
- Array
- Number
- Boolean
- Date
- String
- Null
- Undefined
Install like this:
npm install object-walker
Use like this:
var walker = ; var inputObject = a: null b: 123 c: a: 'hello world' b: undefined ; /* Using your own iterator: */ walker; /* Using the built-in iterator, and setting some handlers */ walker; walker; walker; /* Outputs: * a is null * c is an object */ /* To reuse walker, call clearCustomHandlers, to clean up after * your previous walk. */ walker; /* Using the built-in iterator, with custom handlers, and * populating a user context that gets passed along the * entire walk. */ walker; walker; userCtx = walker; /* * userCtx is: [ null, { a: 'hello world', b: undefined } ] */