MCPcopy Index your code
hub / github.com/caolan/async / filterGeneric

Function filterGeneric

lib/internal/filter.js:25–47  ·  view source on GitHub ↗
(eachfn, coll, iteratee, callback)

Source from the content-addressed store, hash-verified

23}
24
25function filterGeneric(eachfn, coll, iteratee, callback) {
26 var results = [];
27 eachfn(coll, function (x, index, callback) {
28 iteratee(x, function (err, v) {
29 if (err) {
30 callback(err);
31 } else {
32 if (v) {
33 results.push({index: index, value: x});
34 }
35 callback();
36 }
37 });
38 }, function (err) {
39 if (err) {
40 callback(err);
41 } else {
42 callback(null, arrayMap(results.sort(function (a, b) {
43 return a.index - b.index;
44 }), property('value')));
45 }
46 });
47}
48
49export default function _filter(eachfn, coll, iteratee, callback) {
50 var filter = isArrayLike(coll) ? filterArray : filterGeneric;

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…