MCPcopy Create free account
hub / github.com/CloudBoost/cloudboost / walk

Function walk

sdk/src/CloudSocketClientLib.js:7807–7825  ·  view source on GitHub ↗
(source, property, callback)

Source from the content-addressed store, hash-verified

7805 // `callback` function for each value. This is an implementation of the
7806 // `Walk(holder, name)` operation defined in ES 5.1 section 15.12.2.
7807 var walk = function(source, property, callback) {
7808 var value = source[property],
7809 length;
7810 if (typeof value == "object" && value) {
7811 // `forEach` can't be used to traverse an array in Opera <= 8.54
7812 // because its `Object#hasOwnProperty` implementation returns `false`
7813 // for array indices (e.g., `![1, 2, 3].hasOwnProperty("0")`).
7814 if (getClass.call(value) == arrayClass) {
7815 for (length = value.length; length--;) {
7816 update(value, length, callback);
7817 }
7818 } else {
7819 forEach(value, function(property) {
7820 update(value, property, callback);
7821 });
7822 }
7823 }
7824 return callback.call(source, property, value);
7825 };
7826
7827 // Public: `JSON.parse`. See ES 5.1 section 15.12.2.
7828 exports.parse = function(source, callback) {

Callers 2

updateFunction · 0.70
runInContextFunction · 0.70

Calls 1

updateFunction · 0.70

Tested by

no test coverage detected