MCPcopy Index your code
hub / github.com/deployd/deployd / walkInternal

Function walkInternal

test-app/public/sinon.js:3523–3549  ·  view source on GitHub ↗
(obj, iterator, context, originalObj, seen)

Source from the content-addressed store, hash-verified

3521 var forEach = require("@sinonjs/commons").prototypes.array.forEach;
3522
3523 function walkInternal(obj, iterator, context, originalObj, seen) {
3524 var proto, prop;
3525
3526 if (typeof Object.getOwnPropertyNames !== "function") {
3527 // We explicitly want to enumerate through all of the prototype's properties
3528 // in this case, therefore we deliberately leave out an own property check.
3529 /* eslint-disable-next-line guard-for-in */
3530 for (prop in obj) {
3531 iterator.call(context, obj[prop], prop, obj);
3532 }
3533
3534 return;
3535 }
3536
3537 forEach(Object.getOwnPropertyNames(obj), function(k) {
3538 if (seen[k] !== true) {
3539 seen[k] = true;
3540 var target = typeof Object.getOwnPropertyDescriptor(obj, k).get === "function" ? originalObj : obj;
3541 iterator.call(context, k, target);
3542 }
3543 });
3544
3545 proto = Object.getPrototypeOf(obj);
3546 if (proto) {
3547 walkInternal(proto, iterator, context, originalObj, seen);
3548 }
3549 }
3550
3551 /* Walks the prototype chain of an object and iterates over every own property
3552 * name encountered. The iterator is called in the same fashion that Array.prototype.forEach

Callers 1

sinon.jsFile · 0.85

Calls 1

forEachFunction · 0.85

Tested by

no test coverage detected