tra-analysis/website/functions/node_modules/traverse/examples/json.js

17 lines
390 B
JavaScript
Raw Normal View History

2019-01-06 19:14:45 +00:00
var traverse = require('traverse');
var id = 54;
var callbacks = {};
var obj = { moo : function () {}, foo : [2,3,4, function () {}] };
var scrubbed = traverse(obj).map(function (x) {
if (typeof x === 'function') {
callbacks[id] = { id : id, f : x, path : this.path };
this.update('[Function]');
id++;
}
});
console.dir(scrubbed);
console.dir(callbacks);