MCPcopy
hub / github.com/flowjs/flow.js / each

Function each

src/flow.js:1602–1622  ·  view source on GitHub ↗

* Iterate each element of an object * @function * @param {Array|Object} obj object or an array to iterate * @param {Function} callback first argument is a value and second is a key. * @param {Object=} context Object to become context (`this`) for the iterator function.

(obj, callback, context)

Source from the content-addressed store, hash-verified

1600 * @param {Object=} context Object to become context (`this`) for the iterator function.
1601 */
1602 function each(obj, callback, context) {
1603 if (!obj) {
1604 return ;
1605 }
1606 var key;
1607 // Is Array?
1608 // Array.isArray won't work, not only arrays can be iterated by index https://github.com/flowjs/ng-flow/issues/236#
1609 if (typeof(obj.length) !== 'undefined') {
1610 for (key = 0; key < obj.length; key++) {
1611 if (callback.call(context, obj[key], key) === false) {
1612 return ;
1613 }
1614 }
1615 } else {
1616 for (key in obj) {
1617 if (obj.hasOwnProperty(key) && callback.call(context, obj[key], key) === false) {
1618 return ;
1619 }
1620 }
1621 }
1622 }
1623 Flow.each = each;
1624
1625 /**

Callers 3

flow.jsFile · 0.85
readDirectoryFunction · 0.85
extendFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…