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

Function doDuring

lib/doDuring.js:26–45  ·  view source on GitHub ↗
(fn, test, callback)

Source from the content-addressed store, hash-verified

24 * will be passed an error if one occurred, otherwise `null`.
25 */
26export default function doDuring(fn, test, callback) {
27 callback = onlyOnce(callback || noop);
28 var _fn = wrapAsync(fn);
29 var _test = wrapAsync(test);
30
31 var next = rest(function(err, args) {
32 if (err) return callback(err);
33 args.push(check);
34 _test.apply(this, args);
35 });
36
37 function check(err, truth) {
38 if (err) return callback(err);
39 if (!truth) return callback(null);
40 _fn(next);
41 }
42
43 check(null, true);
44
45}
46

Callers

nothing calls this directly

Calls 4

onlyOnceFunction · 0.85
wrapAsyncFunction · 0.85
restFunction · 0.85
checkFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…