objobjwalk

walk the object definitions of an object, modify them with a function.

'

objobjwalk

(c)Bumblehead, 2012,2013 MIT-license

Walk the object definitions of an object, modify them with a function. It may be used in a browser environment or a node.js environment.


INSTALL:

Scroungejs may be downloaded directly or installed through npm.

  • npm

    $ npm install objobjwalk
  • Direct Download

    $ git clone https://github.com/iambumblehead/objobjwalk.git
    $ cd objobjwalk && npm install

Test:

to run tests, use npm test from a shell.

 $ npm test

GET STARTED:

 var newObj = objobjwalk({
     a : {
         b : [{
             c : {
                 d : [{
                     type : 'deep object',
                     value : '1'
                 }],
                 e : [{
                     type : 'deep object',
                     value : '1'
                 }]
             }
         }]
     }
 }, function (obj) {
     if (obj.type === 'deep object') {
         obj.value = '0';
     }
     return obj;
 });     
 console.log(newObj);
 {
     a : {
         b : [{
             c : {
                 d : [{
                     type : 'deep object',
                     value : '0'
                 }],
                 e : [{
                     type : 'deep object',
                     value : '0'
                 }]
             }
         }]
     }
 }
'