diff options
Diffstat (limited to 'lib/doDuring.js')
-rw-r--r-- | lib/doDuring.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/doDuring.js b/lib/doDuring.js index b198d17..e79574b 100644 --- a/lib/doDuring.js +++ b/lib/doDuring.js @@ -1,6 +1,7 @@ import noop from 'lodash/noop'; import rest from './internal/rest'; import onlyOnce from './internal/onlyOnce'; +import wrapAsync from './internal/wrapAsync'; /** * The post-check version of [`during`]{@link module:ControlFlow.during}. To reflect the difference in @@ -25,17 +26,19 @@ import onlyOnce from './internal/onlyOnce'; */ export default function doDuring(fn, test, callback) { callback = onlyOnce(callback || noop); + var _fn = wrapAsync(fn); + var _test = wrapAsync(test); var next = rest(function(err, args) { if (err) return callback(err); args.push(check); - test.apply(this, args); + _test.apply(this, args); }); function check(err, truth) { if (err) return callback(err); if (!truth) return callback(null); - fn(next); + _fn(next); } check(null, true); |