summaryrefslogtreecommitdiff
path: root/lib/race.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/race.js')
-rw-r--r--lib/race.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/race.js b/lib/race.js
index 5547c86..ee81b37 100644
--- a/lib/race.js
+++ b/lib/race.js
@@ -1,6 +1,7 @@
import isArray from 'lodash/isArray';
import noop from 'lodash/noop';
import once from './internal/once';
+import wrapAsync from './internal/wrapAsync';
/**
* Runs the `tasks` array of functions in parallel, without waiting until the
@@ -44,6 +45,6 @@ export default function race(tasks, callback) {
if (!isArray(tasks)) return callback(new TypeError('First argument to race must be an array of functions'));
if (!tasks.length) return callback();
for (var i = 0, l = tasks.length; i < l; i++) {
- tasks[i](callback);
+ wrapAsync(tasks[i])(callback);
}
}