MCPcopy Create free account
hub / github.com/PrairieLearn/PrairieLearn / walk

Function walk

public/javascripts/socket.io.js:2778–2795  ·  view source on GitHub ↗
(source, property, callback)

Source from the content-addressed store, hash-verified

2776 // `callback` function for each value. This is an implementation of the
2777 // `Walk(holder, name)` operation defined in ES 5.1 section 15.12.2.
2778 var walk = function (source, property, callback) {
2779 var value = source[property], length;
2780 if (typeof value == "object" && value) {
2781 // `forEach` can't be used to traverse an array in Opera <= 8.54
2782 // because its `Object#hasOwnProperty` implementation returns `false`
2783 // for array indices (e.g., `![1, 2, 3].hasOwnProperty("0")`).
2784 if (getClass.call(value) == arrayClass) {
2785 for (length = value.length; length--;) {
2786 update(value, length, callback);
2787 }
2788 } else {
2789 forEach(value, function (property) {
2790 update(value, property, callback);
2791 });
2792 }
2793 }
2794 return callback.call(source, property, value);
2795 };
2796
2797 // Public: `JSON.parse`. See ES 5.1 section 15.12.2.
2798 exports.parse = function (source, callback) {

Callers 2

updateFunction · 0.85
runInContextFunction · 0.85

Calls 2

callMethod · 0.80
updateFunction · 0.70

Tested by

no test coverage detected