From 57b88774c5ed515ead36fb84f81550f7ff807001 Mon Sep 17 00:00:00 2001 From: Alexander Early Date: Mon, 27 Mar 2017 12:54:04 -0700 Subject: fix small issues from PR --- lib/autoInject.js | 6 ++++-- lib/internal/applyEach.js | 5 ++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/autoInject.js b/lib/autoInject.js index 9efd295..3ba87fc 100644 --- a/lib/autoInject.js +++ b/lib/autoInject.js @@ -109,14 +109,16 @@ export default function autoInject(tasks, callback) { forOwn(tasks, function (taskFn, key) { var params; var fnIsAsync = isAsync(taskFn); + var hasNoDeps = + (!fnIsAsync && taskFn.length === 1) || + (fnIsAsync && taskFn.length === 0); if (isArray(taskFn)) { params = taskFn.slice(0, -1); taskFn = taskFn[taskFn.length - 1]; newTasks[key] = params.concat(params.length > 0 ? newTask : taskFn); - } else if ((!fnIsAsync && taskFn.length === 1) || - (fnIsAsync && taskFn.length === 0)) { + } else if (hasNoDeps) { // no dependencies, use the function as-is newTasks[key] = taskFn; } else { diff --git a/lib/internal/applyEach.js b/lib/internal/applyEach.js index f611def..285a6a2 100644 --- a/lib/internal/applyEach.js +++ b/lib/internal/applyEach.js @@ -1,4 +1,3 @@ -import arrayMap from 'lodash/_arrayMap' import rest from './rest'; import initialParams from './initialParams'; import wrapAsync from './wrapAsync'; @@ -7,8 +6,8 @@ export default function applyEach(eachfn) { return rest(function(fns, args) { var go = initialParams(function(args, callback) { var that = this; - return eachfn(arrayMap(fns, wrapAsync), function (fn, cb) { - fn.apply(that, args.concat(cb)); + return eachfn(fns, function (fn, cb) { + wrapAsync(fn).apply(that, args.concat(cb)); }, callback); }); if (args.length) { -- cgit v1.2.1