diff options
Diffstat (limited to 'lib/tryEach.js')
-rw-r--r-- | lib/tryEach.js | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/tryEach.js b/lib/tryEach.js index 82649b4..8b45984 100644 --- a/lib/tryEach.js +++ b/lib/tryEach.js @@ -1,7 +1,6 @@ import eachSeries from './eachSeries'; import noop from './internal/noop'; import wrapAsync from './internal/wrapAsync'; -import slice from './internal/slice'; /** * It runs each task in series but stops whenever any of the functions were @@ -45,11 +44,11 @@ export default function tryEach(tasks, callback) { var result; callback = callback || noop; eachSeries(tasks, function(task, callback) { - wrapAsync(task)(function (err, res/*, ...args*/) { - if (arguments.length > 2) { - result = slice(arguments, 1); + wrapAsync(task)(function (err, ...args) { + if (args.length < 2) { + result = args[0]; } else { - result = res; + result = args; } error = err; callback(err ? null : {}); |