diff options
Diffstat (limited to 'lib/auto.js')
-rw-r--r-- | lib/auto.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/auto.js b/lib/auto.js index ba0fdc3..d712cc1 100644 --- a/lib/auto.js +++ b/lib/auto.js @@ -4,7 +4,7 @@ import indexOf from 'lodash/_baseIndexOf'; import isArray from 'lodash/isArray'; import okeys from 'lodash/keys'; import noop from 'lodash/noop'; -import rest from './internal/rest'; +import slice from 'lodash/slice'; import once from './internal/once'; import onlyOnce from './internal/onlyOnce'; @@ -192,26 +192,26 @@ export default function (tasks, concurrency, callback) { function runTask(key, task) { if (hasError) return; - var taskCallback = onlyOnce(rest(function(err, args) { + var taskCallback = onlyOnce(function(err, result) { runningTasks--; - if (args.length <= 1) { - args = args[0]; + if (arguments.length > 2) { + result = slice(arguments, 1); } if (err) { var safeResults = {}; forOwn(results, function(val, rkey) { safeResults[rkey] = val; }); - safeResults[key] = args; + safeResults[key] = result; hasError = true; listeners = Object.create(null); callback(err, safeResults); } else { - results[key] = args; + results[key] = result; taskComplete(key); } - })); + }); runningTasks++; var taskFn = wrapAsync(task[task.length - 1]); |