summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraeme Yeates <yeatesgraeme@gmail.com>2016-11-17 09:53:55 -0500
committerGraeme Yeates <yeatesgraeme@gmail.com>2016-11-17 09:53:55 -0500
commitb6d0528c9c398823c3f6fdf7523b74b916ceb95c (patch)
tree583847619c520b772bacbf2d204b81112055792c
parent665327e07e2437ef7959af6544ed02594cfe76dd (diff)
downloadasync-b6d0528c9c398823c3f6fdf7523b74b916ceb95c.tar.gz
Cleanup some of the dependency importslib-import-cleanups
Saves 800 bytes on min.js
-rw-r--r--lib/apply.js2
-rw-r--r--lib/auto.js2
-rw-r--r--lib/autoInject.js5
-rw-r--r--lib/compose.js2
-rw-r--r--lib/constant.js2
-rw-r--r--lib/doDuring.js2
-rw-r--r--lib/doWhilst.js2
-rw-r--r--lib/internal/applyEach.js2
-rw-r--r--lib/internal/consoleFunc.js2
-rw-r--r--lib/internal/initialParams.js2
-rw-r--r--lib/internal/map.js3
-rw-r--r--lib/internal/parallel.js2
-rw-r--r--lib/internal/queue.js2
-rw-r--r--lib/internal/reject.js6
-rw-r--r--lib/internal/rest.js8
-rw-r--r--lib/internal/setImmediate.js2
-rw-r--r--lib/memoize.js2
-rw-r--r--lib/reflect.js2
-rw-r--r--lib/seq.js2
-rw-r--r--lib/waterfall.js2
-rw-r--r--lib/whilst.js2
21 files changed, 29 insertions, 27 deletions
diff --git a/lib/apply.js b/lib/apply.js
index 9ec7e25..d3fc18b 100644
--- a/lib/apply.js
+++ b/lib/apply.js
@@ -1,4 +1,4 @@
-import rest from 'lodash/_baseRest';
+import rest from './internal/rest';
/**
* Creates a continuation function with some arguments already applied.
diff --git a/lib/auto.js b/lib/auto.js
index 85135a3..6186807 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 'lodash/_baseRest';
+import rest from './internal/rest';
import once from './internal/once';
import onlyOnce from './internal/onlyOnce';
diff --git a/lib/autoInject.js b/lib/autoInject.js
index 3bb40e2..b0f5735 100644
--- a/lib/autoInject.js
+++ b/lib/autoInject.js
@@ -1,7 +1,6 @@
import auto from './auto';
import forOwn from 'lodash/_baseForOwn';
import arrayMap from 'lodash/_arrayMap';
-import clone from 'lodash/_copyArray';
import isArray from 'lodash/isArray';
import trim from 'lodash/trim';
@@ -109,8 +108,8 @@ export default function autoInject(tasks, callback) {
var params;
if (isArray(taskFn)) {
- params = clone(taskFn);
- taskFn = params.pop();
+ params = taskFn.slice(0, -1);
+ taskFn = taskFn[taskFn.length - 1];
newTasks[key] = params.concat(params.length > 0 ? newTask : taskFn);
} else if (taskFn.length === 1) {
diff --git a/lib/compose.js b/lib/compose.js
index abb0f20..5c64593 100644
--- a/lib/compose.js
+++ b/lib/compose.js
@@ -1,5 +1,5 @@
import seq from './seq';
-import rest from 'lodash/_baseRest';
+import rest from './internal/rest';
/**
* Creates a function which is a composition of the passed asynchronous
diff --git a/lib/constant.js b/lib/constant.js
index 9aa2273..c9c0c1e 100644
--- a/lib/constant.js
+++ b/lib/constant.js
@@ -1,4 +1,4 @@
-import rest from 'lodash/_baseRest';
+import rest from './internal/rest';
import initialParams from './internal/initialParams';
/**
diff --git a/lib/doDuring.js b/lib/doDuring.js
index 306f8a7..b198d17 100644
--- a/lib/doDuring.js
+++ b/lib/doDuring.js
@@ -1,5 +1,5 @@
import noop from 'lodash/noop';
-import rest from 'lodash/_baseRest';
+import rest from './internal/rest';
import onlyOnce from './internal/onlyOnce';
/**
diff --git a/lib/doWhilst.js b/lib/doWhilst.js
index 584db09..d9222aa 100644
--- a/lib/doWhilst.js
+++ b/lib/doWhilst.js
@@ -1,5 +1,5 @@
import noop from 'lodash/noop';
-import rest from 'lodash/_baseRest';
+import rest from './internal/rest';
import onlyOnce from './internal/onlyOnce';
diff --git a/lib/internal/applyEach.js b/lib/internal/applyEach.js
index 1d7a0b6..408474e 100644
--- a/lib/internal/applyEach.js
+++ b/lib/internal/applyEach.js
@@ -1,4 +1,4 @@
-import rest from 'lodash/_baseRest';
+import rest from './rest';
import initialParams from './initialParams';
export default function applyEach(eachfn) {
diff --git a/lib/internal/consoleFunc.js b/lib/internal/consoleFunc.js
index e2d6150..d4f8c8e 100644
--- a/lib/internal/consoleFunc.js
+++ b/lib/internal/consoleFunc.js
@@ -1,5 +1,5 @@
import arrayEach from 'lodash/_arrayEach';
-import rest from 'lodash/_baseRest';
+import rest from './rest';
export default function consoleFunc(name) {
return rest(function (fn, args) {
diff --git a/lib/internal/initialParams.js b/lib/internal/initialParams.js
index 304fd23..cf30386 100644
--- a/lib/internal/initialParams.js
+++ b/lib/internal/initialParams.js
@@ -1,4 +1,4 @@
-import rest from 'lodash/_baseRest';
+import rest from './rest';
export default function (fn) {
return rest(function (args/*..., callback*/) {
diff --git a/lib/internal/map.js b/lib/internal/map.js
index 2c2a750..453cd29 100644
--- a/lib/internal/map.js
+++ b/lib/internal/map.js
@@ -1,8 +1,7 @@
import noop from 'lodash/noop';
-import once from './once';
export default function _asyncMap(eachfn, arr, iteratee, callback) {
- callback = once(callback || noop);
+ callback = callback || noop;
arr = arr || [];
var results = [];
var counter = 0;
diff --git a/lib/internal/parallel.js b/lib/internal/parallel.js
index 1b91b60..d7c5cd9 100644
--- a/lib/internal/parallel.js
+++ b/lib/internal/parallel.js
@@ -1,6 +1,6 @@
import noop from 'lodash/noop';
import isArrayLike from 'lodash/isArrayLike';
-import rest from 'lodash/_baseRest';
+import rest from './rest';
export default function _parallel(eachfn, tasks, callback) {
callback = callback || noop;
diff --git a/lib/internal/queue.js b/lib/internal/queue.js
index 067aaf6..c73c322 100644
--- a/lib/internal/queue.js
+++ b/lib/internal/queue.js
@@ -1,7 +1,7 @@
import indexOf from 'lodash/_baseIndexOf';
import isArray from 'lodash/isArray';
import noop from 'lodash/noop';
-import rest from 'lodash/_baseRest';
+import rest from './rest';
import onlyOnce from './onlyOnce';
import setImmediate from './setImmediate';
diff --git a/lib/internal/reject.js b/lib/internal/reject.js
index b6d7343..e082328 100644
--- a/lib/internal/reject.js
+++ b/lib/internal/reject.js
@@ -3,11 +3,7 @@ import filter from './filter';
export default function reject(eachfn, arr, iteratee, callback) {
filter(eachfn, arr, function(value, cb) {
iteratee(value, function(err, v) {
- if (err) {
- cb(err);
- } else {
- cb(null, !v);
- }
+ cb(err, !v);
});
}, callback);
}
diff --git a/lib/internal/rest.js b/lib/internal/rest.js
new file mode 100644
index 0000000..ee70cc6
--- /dev/null
+++ b/lib/internal/rest.js
@@ -0,0 +1,8 @@
+import _overRest from 'lodash/_overRest';
+import identity from 'lodash/identity';
+
+// Lodash rest function without function.toString()
+// remappings
+export default function rest(func, start) {
+ return _overRest(func, start, identity);
+}
diff --git a/lib/internal/setImmediate.js b/lib/internal/setImmediate.js
index 228c45c..c8824c7 100644
--- a/lib/internal/setImmediate.js
+++ b/lib/internal/setImmediate.js
@@ -1,6 +1,6 @@
'use strict';
-import rest from 'lodash/_baseRest';
+import rest from './rest';
export var hasSetImmediate = typeof setImmediate === 'function' && setImmediate;
export var hasNextTick = typeof process === 'object' && typeof process.nextTick === 'function';
diff --git a/lib/memoize.js b/lib/memoize.js
index b273153..06ba6ae 100644
--- a/lib/memoize.js
+++ b/lib/memoize.js
@@ -1,5 +1,5 @@
import identity from 'lodash/identity';
-import rest from 'lodash/_baseRest';
+import rest from './internal/rest';
import setImmediate from './internal/setImmediate';
import initialParams from './internal/initialParams';
diff --git a/lib/reflect.js b/lib/reflect.js
index a5ab9d9..cc8d6b6 100644
--- a/lib/reflect.js
+++ b/lib/reflect.js
@@ -1,5 +1,5 @@
import initialParams from './internal/initialParams';
-import rest from 'lodash/_baseRest';
+import rest from './internal/rest';
/**
* Wraps the function in another function that always returns data even when it
diff --git a/lib/seq.js b/lib/seq.js
index ae4d5c2..a47841e 100644
--- a/lib/seq.js
+++ b/lib/seq.js
@@ -1,5 +1,5 @@
import noop from 'lodash/noop';
-import rest from 'lodash/_baseRest';
+import rest from './internal/rest';
import reduce from './reduce';
/**
diff --git a/lib/waterfall.js b/lib/waterfall.js
index 3d2ba55..7bc60da 100644
--- a/lib/waterfall.js
+++ b/lib/waterfall.js
@@ -1,7 +1,7 @@
import isArray from 'lodash/isArray';
import noop from 'lodash/noop';
import once from './internal/once';
-import rest from 'lodash/_baseRest';
+import rest from './internal/rest';
import onlyOnce from './internal/onlyOnce';
diff --git a/lib/whilst.js b/lib/whilst.js
index f3bd582..ac2a79c 100644
--- a/lib/whilst.js
+++ b/lib/whilst.js
@@ -1,5 +1,5 @@
import noop from 'lodash/noop';
-import rest from 'lodash/_baseRest';
+import rest from './internal/rest';
import onlyOnce from './internal/onlyOnce';