1
0
Fork 0
management/front/dkha-web-sz-main/node_modules/traverse/examples/json.js

19 lines
378 B
JavaScript
Raw Normal View History

2024-01-16 21:26:16 +08:00
'use strict';
2023-12-18 13:12:25 +08:00
var traverse = require('traverse');
var id = 54;
var callbacks = {};
2024-01-16 21:26:16 +08:00
var obj = { moo: function () {}, foo: [2, 3, 4, function () {}] };
2023-12-18 13:12:25 +08:00
var scrubbed = traverse(obj).map(function (x) {
2024-01-16 21:26:16 +08:00
if (typeof x === 'function') {
callbacks[id] = { id: id, f: x, path: this.path };
this.update('[Function]');
id++;
}
2023-12-18 13:12:25 +08:00
});
console.dir(scrubbed);
console.dir(callbacks);