json.js 390 B

1234567891011121314151617
  1. var Traverse = require('traverse');
  2. var id = 54;
  3. var callbacks = {};
  4. var obj = { moo : function () {}, foo : [2,3,4, function () {}] };
  5. var scrubbed = Traverse(obj).map(function (x) {
  6. if (typeof x === 'function') {
  7. callbacks[id] = { id : id, f : x, path : this.path };
  8. this.update('[Function]');
  9. id++;
  10. }
  11. });
  12. console.dir(scrubbed);
  13. console.dir(callbacks);