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

Function filterArray

lib/internal/filter.js:8–23  ·  view source on GitHub ↗
(eachfn, arr, iteratee, callback)

Source from the content-addressed store, hash-verified

6import wrapAsync from './wrapAsync';
7
8function filterArray(eachfn, arr, iteratee, callback) {
9 var truthValues = new Array(arr.length);
10 eachfn(arr, function (x, index, callback) {
11 iteratee(x, function (err, v) {
12 truthValues[index] = !!v;
13 callback(err);
14 });
15 }, function (err) {
16 if (err) return callback(err);
17 var results = [];
18 for (var i = 0; i < arr.length; i++) {
19 if (truthValues[i]) results.push(arr[i]);
20 }
21 callback(null, results);
22 });
23}
24
25function filterGeneric(eachfn, coll, iteratee, callback) {
26 var results = [];

Callers

nothing calls this directly

Calls 1

iterateeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…