MCPcopy
hub / github.com/stemkoski/stemkoski.github.com / forEach

Function forEach

MathBox/mathbox-bundle.js:38424–38439  ·  view source on GitHub ↗

* Iterates over elements of a collection, executing the callback for each * element. The callback is bound to `thisArg` and invoked with three arguments; * (value, index|key, collection). Callbacks may exit iteration early by * explicitly returning `false`. * * Note: As with

(collection, callback, thisArg)

Source from the content-addressed store, hash-verified

38422 * // => logs each number and returns the object (property order is not guaranteed across environments)
38423 */
38424 function forEach(collection, callback, thisArg) {
38425 var index = -1,
38426 length = collection ? collection.length : 0;
38427
38428 callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3);
38429 if (typeof length == 'number') {
38430 while (++index < length) {
38431 if (callback(collection[index], index, collection) === false) {
38432 break;
38433 }
38434 }
38435 } else {
38436 forOwn(collection, callback);
38437 }
38438 return collection;
38439 }
38440
38441 /**
38442 * This method is like `_.forEach` except that it iterates over elements

Callers 9

invokeFunction · 0.70
maxFunction · 0.70
minFunction · 0.70
shuffleFunction · 0.70
sortByFunction · 0.70
mixinFunction · 0.70
runInContextFunction · 0.70
flowFunction · 0.70
mathbox-bundle.jsFile · 0.70

Calls 4

baseCreateCallbackFunction · 0.85
forOwnFunction · 0.85
callbackFunction · 0.70
fFunction · 0.50

Tested by

no test coverage detected