MCPcopy
hub / github.com/flightjs/flight / traverse

Function traverse

lib/debug.js:14–27  ·  view source on GitHub ↗
(util, searchTerm, options)

Source from the content-addressed store, hash-verified

12 // ==========================================
13
14 function traverse(util, searchTerm, options) {
15 options = options || {};
16 var obj = options.obj || window;
17 var path = options.path || ((obj == window) ? 'window' : '');
18 var props = Object.keys(obj);
19 props.forEach(function(prop) {
20 if ((tests[util] || util)(searchTerm, obj, prop)) {
21 console.log([path, '.', prop].join(''), '->', ['(', typeof obj[prop], ')'].join(''), obj[prop]);
22 }
23 if (Object.prototype.toString.call(obj[prop]) == '[object Object]' && (obj[prop] != obj) && path.split('.').indexOf(prop) == -1) {
24 traverse(util, searchTerm, {obj: obj[prop], path: [path,prop].join('.')});
25 }
26 });
27 }
28
29 function search(util, expected, searchTerm, options) {
30 if (!expected || typeof searchTerm == expected) {

Callers 2

searchFunction · 0.85
customFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected