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

Function _createTester

lib/internal/createTester.js:4–29  ·  view source on GitHub ↗
(check, getResult)

Source from the content-addressed store, hash-verified

2import breakLoop from './breakLoop';
3
4export default function _createTester(check, getResult) {
5 return function(eachfn, arr, iteratee, cb) {
6 cb = cb || noop;
7 var testPassed = false;
8 var testResult;
9 eachfn(arr, function(value, _, callback) {
10 iteratee(value, function(err, result) {
11 if (err) {
12 callback(err);
13 } else if (check(result) && !testResult) {
14 testPassed = true;
15 testResult = getResult(true, value);
16 callback(null, breakLoop);
17 } else {
18 callback();
19 }
20 });
21 }, function(err) {
22 if (err) {
23 cb(err);
24 } else {
25 cb(null, testPassed ? testResult : getResult(false));
26 }
27 });
28 };
29}

Callers

nothing calls this directly

Calls 2

iterateeFunction · 0.85
checkFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…