MCPcopy
hub / github.com/caolan/async / eachOfArrayLike

Function eachOfArrayLike

lib/eachOf.js:12–32  ·  view source on GitHub ↗
(coll, iteratee, callback)

Source from the content-addressed store, hash-verified

10
11// eachOf implementation optimized for array-likes
12function eachOfArrayLike(coll, iteratee, callback) {
13 callback = once(callback || noop);
14 var index = 0,
15 completed = 0,
16 length = coll.length;
17 if (length === 0) {
18 callback(null);
19 }
20
21 function iteratorCallback(err, value) {
22 if (err) {
23 callback(err);
24 } else if ((++completed === length) || value === breakLoop) {
25 callback(null);
26 }
27 }
28
29 for (; index < length; index++) {
30 iteratee(coll[index], index, onlyOnce(iteratorCallback));
31 }
32}
33
34// a generic version of eachOf which can handle array, object, and iterator cases.
35var eachOfGeneric = doLimit(eachOfLimit, Infinity);

Callers

nothing calls this directly

Calls 3

onceFunction · 0.85
iterateeFunction · 0.85
onlyOnceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…