MCPcopy Index your code
hub / github.com/PrairieLearn/PrairieLearn / _filter

Function _filter

public/javascripts/async.js:404–420  ·  view source on GitHub ↗
(eachfn, arr, iterator, callback)

Source from the content-addressed store, hash-verified

402 };
403
404 function _filter(eachfn, arr, iterator, callback) {
405 var results = [];
406 eachfn(arr, function (x, index, callback) {
407 iterator(x, function (v) {
408 if (v) {
409 results.push({index: index, value: x});
410 }
411 callback();
412 });
413 }, function () {
414 callback(_map(results.sort(function (a, b) {
415 return a.index - b.index;
416 }), function (x) {
417 return x.value;
418 }));
419 });
420 }
421
422 async.select =
423 async.filter = doParallel(_filter);

Callers 1

_rejectFunction · 0.85

Calls 3

callbackFunction · 0.85
_mapFunction · 0.85
iteratorFunction · 0.70

Tested by

no test coverage detected