diff options
author | Alex Early <alexander.early@gmail.com> | 2018-06-02 17:23:48 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-02 17:23:48 -0700 |
commit | 0d4f73625b67ee8f670eb3ee727cb85f980cabd5 (patch) | |
tree | cbe45a59529b779d41d1a70b6067fb5d657154dd | |
parent | ca85923d491812bd0ff4f514ee28de8732d0ea90 (diff) | |
parent | ec8d30c9332256907fdfc976576b7927c5fcc61d (diff) | |
download | async-0d4f73625b67ee8f670eb3ee727cb85f980cabd5.tar.gz |
Merge pull request #1528 from bfred-it/drop-lodash
Drop lodash
44 files changed, 103 insertions, 102 deletions
@@ -9,7 +9,6 @@ PACKAGE = asyncjs REQUIRE_NAME = async UGLIFY = uglifyjs XYZ = support/xyz.sh --repo git@github.com:caolan/async.git -COPY_ES = sed -E "s/(import.+)lodash/\1lodash-es/g" BUILDDIR = build BUILD_ES = build-es @@ -95,12 +94,12 @@ build-es: $(ES_MODULES) $(BUILD_ES)/%.js: lib/%.js mkdir -p "$(@D)" - $(COPY_ES) $< > $@ + cat $< > $@ define COPY_ES_ALIAS $A: $(shell node $(SCRIPTS)/get-alias.js $A) mkdir -p "$$(@D)" - $(COPY_ES) $$< > $$@ + cat $$< > $$@ endef $(foreach A,$(ALIAS_ES),$(eval $(COPY_ES_ALIAS))) diff --git a/lib/asyncify.js b/lib/asyncify.js index d5d0bee..e6d63c0 100644 --- a/lib/asyncify.js +++ b/lib/asyncify.js @@ -1,4 +1,3 @@ -import isObject from 'lodash/isObject'; import initialParams from './internal/initialParams'; import setImmediate from './internal/setImmediate'; @@ -67,7 +66,7 @@ export default function asyncify(func) { return callback(e); } // if result is Promise object - if (isObject(result) && typeof result.then === 'function') { + if (result && typeof result.then === 'function') { result.then(function(value) { invokeCallback(callback, null, value); }, function(err) { diff --git a/lib/auto.js b/lib/auto.js index e2c0ab9..a6150aa 100644 --- a/lib/auto.js +++ b/lib/auto.js @@ -1,10 +1,6 @@ -import arrayEach from 'lodash/_arrayEach'; -import forOwn from 'lodash/_baseForOwn'; -import indexOf from 'lodash/_baseIndexOf'; -import isArray from 'lodash/isArray'; -import okeys from 'lodash/keys'; -import noop from 'lodash/noop'; +import noop from './internal/noop'; +import forOwn from './internal/forOwn'; import slice from './internal/slice'; import once from './internal/once'; import onlyOnce from './internal/onlyOnce'; @@ -96,8 +92,7 @@ export default function (tasks, concurrency, callback) { concurrency = null; } callback = once(callback || noop); - var keys = okeys(tasks); - var numTasks = keys.length; + var numTasks = Object.keys(tasks).length; if (!numTasks) { return callback(null); } @@ -119,7 +114,7 @@ export default function (tasks, concurrency, callback) { var uncheckedDependencies = {}; forOwn(tasks, function (task, key) { - if (!isArray(task)) { + if (!Array.isArray(task)) { // no dependencies enqueueTask(key, [task]); readyToCheck.push(key); @@ -135,7 +130,7 @@ export default function (tasks, concurrency, callback) { } uncheckedDependencies[key] = remainingDependencies; - arrayEach(dependencies, function (dependencyName) { + dependencies.forEach(function (dependencyName) { if (!tasks[dependencyName]) { throw new Error('async.auto task `' + key + '` has a non-existent dependency `' + @@ -182,7 +177,7 @@ export default function (tasks, concurrency, callback) { function taskComplete(taskName) { var taskListeners = listeners[taskName] || []; - arrayEach(taskListeners, function (fn) { + taskListeners.forEach(function (fn) { fn(); }); processQueue(); @@ -231,7 +226,7 @@ export default function (tasks, concurrency, callback) { while (readyToCheck.length) { currentTask = readyToCheck.pop(); counter++; - arrayEach(getDependents(currentTask), function (dependent) { + getDependents(currentTask).forEach(function (dependent) { if (--uncheckedDependencies[dependent] === 0) { readyToCheck.push(dependent); } @@ -248,7 +243,7 @@ export default function (tasks, concurrency, callback) { function getDependents(taskName) { var result = []; forOwn(tasks, function (task, key) { - if (isArray(task) && indexOf(task, taskName, 0) >= 0) { + if (Array.isArray(task) && task.indexOf(taskName) >= 0) { result.push(key); } }); diff --git a/lib/autoInject.js b/lib/autoInject.js index bc8ddd6..65b2cfb 100644 --- a/lib/autoInject.js +++ b/lib/autoInject.js @@ -1,8 +1,5 @@ import auto from './auto'; -import forOwn from 'lodash/_baseForOwn'; -import arrayMap from 'lodash/_arrayMap'; -import isArray from 'lodash/isArray'; -import trim from 'lodash/trim'; +import forOwn from './internal/forOwn'; import wrapAsync from './internal/wrapAsync'; import { isAsync } from './internal/wrapAsync'; @@ -16,7 +13,7 @@ function parseParams(func) { func = func.match(FN_ARGS)[2].replace(' ', ''); func = func ? func.split(FN_ARG_SPLIT) : []; func = func.map(function (arg){ - return trim(arg.replace(FN_ARG, '')); + return arg.replace(FN_ARG, '').trim(); }); return func; } @@ -113,7 +110,7 @@ export default function autoInject(tasks, callback) { (!fnIsAsync && taskFn.length === 1) || (fnIsAsync && taskFn.length === 0); - if (isArray(taskFn)) { + if (Array.isArray(taskFn)) { params = taskFn.slice(0, -1); taskFn = taskFn[taskFn.length - 1]; @@ -134,7 +131,7 @@ export default function autoInject(tasks, callback) { } function newTask(results, taskCb) { - var newArgs = arrayMap(params, function (name) { + var newArgs = params.map(function (name) { return results[name]; }); newArgs.push(taskCb); diff --git a/lib/concatLimit.js b/lib/concatLimit.js index 4df03ea..cec4e2b 100644 --- a/lib/concatLimit.js +++ b/lib/concatLimit.js @@ -1,4 +1,4 @@ -import noop from 'lodash/noop'; +import noop from './internal/noop'; import wrapAsync from './internal/wrapAsync'; import slice from './internal/slice'; import mapLimit from './mapLimit'; diff --git a/lib/detect.js b/lib/detect.js index 654a370..c37ff91 100644 --- a/lib/detect.js +++ b/lib/detect.js @@ -1,5 +1,4 @@ -import identity from 'lodash/identity'; - +import identity from './internal/identity'; import createTester from './internal/createTester'; import doParallel from './internal/doParallel'; import findGetResult from './internal/findGetResult'; diff --git a/lib/detectLimit.js b/lib/detectLimit.js index bba10c8..4efdd3a 100644 --- a/lib/detectLimit.js +++ b/lib/detectLimit.js @@ -1,5 +1,4 @@ -import identity from 'lodash/identity'; - +import identity from './internal/identity'; import createTester from './internal/createTester'; import doParallelLimit from './internal/doParallelLimit'; import findGetResult from './internal/findGetResult'; diff --git a/lib/doDuring.js b/lib/doDuring.js index cce61d0..ac2a04c 100644 --- a/lib/doDuring.js +++ b/lib/doDuring.js @@ -1,4 +1,4 @@ -import noop from 'lodash/noop'; +import noop from './internal/noop'; import slice from './internal/slice'; import onlyOnce from './internal/onlyOnce'; import wrapAsync from './internal/wrapAsync'; diff --git a/lib/doWhilst.js b/lib/doWhilst.js index 5e7d259..3c2b865 100644 --- a/lib/doWhilst.js +++ b/lib/doWhilst.js @@ -1,4 +1,4 @@ -import noop from 'lodash/noop'; +import noop from './internal/noop'; import slice from './internal/slice'; import onlyOnce from './internal/onlyOnce'; diff --git a/lib/during.js b/lib/during.js index ae5a4c1..cda9979 100644 --- a/lib/during.js +++ b/lib/during.js @@ -1,4 +1,4 @@ -import noop from 'lodash/noop'; +import noop from './internal/noop'; import onlyOnce from './internal/onlyOnce'; import wrapAsync from './internal/wrapAsync'; diff --git a/lib/eachOf.js b/lib/eachOf.js index 9ab3eb6..bb9edfa 100644 --- a/lib/eachOf.js +++ b/lib/eachOf.js @@ -1,9 +1,8 @@ -import isArrayLike from 'lodash/isArrayLike'; - +import isArrayLike from './internal/isArrayLike'; import breakLoop from './internal/breakLoop'; import eachOfLimit from './eachOfLimit'; import doLimit from './internal/doLimit'; -import noop from 'lodash/noop'; +import noop from './internal/noop'; import once from './internal/once'; import onlyOnce from './internal/onlyOnce'; import wrapAsync from './internal/wrapAsync'; diff --git a/lib/forever.js b/lib/forever.js index f7be0b2..3753251 100644 --- a/lib/forever.js +++ b/lib/forever.js @@ -1,5 +1,4 @@ -import noop from 'lodash/noop'; - +import noop from './internal/noop'; import onlyOnce from './internal/onlyOnce'; import ensureAsync from './ensureAsync'; import wrapAsync from './internal/wrapAsync'; diff --git a/lib/groupByLimit.js b/lib/groupByLimit.js index b0a5ef3..e6bbf8e 100644 --- a/lib/groupByLimit.js +++ b/lib/groupByLimit.js @@ -1,4 +1,4 @@ -import noop from 'lodash/noop'; +import noop from './internal/noop'; import mapLimit from './mapLimit'; import wrapAsync from './internal/wrapAsync'; /** diff --git a/lib/internal/consoleFunc.js b/lib/internal/consoleFunc.js index eb2e886..c977647 100644 --- a/lib/internal/consoleFunc.js +++ b/lib/internal/consoleFunc.js @@ -1,4 +1,3 @@ -import arrayEach from 'lodash/_arrayEach'; import slice from './slice'; import wrapAsync from './wrapAsync'; @@ -13,7 +12,7 @@ export default function consoleFunc(name) { console.error(err); } } else if (console[name]) { - arrayEach(args, function (x) { + args.forEach(function (x) { console[name](x); }); } diff --git a/lib/internal/createTester.js b/lib/internal/createTester.js index 9fc03e1..8786833 100644 --- a/lib/internal/createTester.js +++ b/lib/internal/createTester.js @@ -1,4 +1,4 @@ -import noop from 'lodash/noop'; +import noop from './noop'; import breakLoop from './breakLoop'; export default function _createTester(check, getResult) { diff --git a/lib/internal/eachOfLimit.js b/lib/internal/eachOfLimit.js index 0a1f5bc..6ce0762 100644 --- a/lib/internal/eachOfLimit.js +++ b/lib/internal/eachOfLimit.js @@ -1,4 +1,4 @@ -import noop from 'lodash/noop'; +import noop from './noop'; import once from './once'; import iterator from './iterator'; diff --git a/lib/internal/filter.js b/lib/internal/filter.js index 032bd33..1923264 100644 --- a/lib/internal/filter.js +++ b/lib/internal/filter.js @@ -1,7 +1,6 @@ -import arrayMap from 'lodash/_arrayMap'; -import isArrayLike from 'lodash/isArrayLike'; -import property from 'lodash/_baseProperty'; -import noop from 'lodash/noop'; +import isArrayLike from './isArrayLike'; +import property from './property'; +import noop from './noop'; import wrapAsync from './wrapAsync'; @@ -39,9 +38,9 @@ function filterGeneric(eachfn, coll, iteratee, callback) { if (err) { callback(err); } else { - callback(null, arrayMap(results.sort(function (a, b) { + callback(null, results.sort(function (a, b) { return a.index - b.index; - }), property('value'))); + }).map(property('value'))); } }); } diff --git a/lib/internal/forOwn.js b/lib/internal/forOwn.js new file mode 100644 index 0000000..ea16519 --- /dev/null +++ b/lib/internal/forOwn.js @@ -0,0 +1,8 @@ +export default function forOwn(object, callback) { + if (!object) { + return; + } + Object.keys(object).forEach(function (key) { + callback(object[key], key); + }); +} diff --git a/lib/internal/identity.js b/lib/internal/identity.js new file mode 100644 index 0000000..7e6669d --- /dev/null +++ b/lib/internal/identity.js @@ -0,0 +1,3 @@ +export default function identity(value) { + return value; +} diff --git a/lib/internal/isArrayLike.js b/lib/internal/isArrayLike.js new file mode 100644 index 0000000..f3d0f5e --- /dev/null +++ b/lib/internal/isArrayLike.js @@ -0,0 +1,6 @@ +export default function isArrayLike(value) { + return value && + typeof value.length === 'number' && + value.length >= 0 && + value.length % 1 === 0; +} diff --git a/lib/internal/iterator.js b/lib/internal/iterator.js index 15c6fdd..6555187 100644 --- a/lib/internal/iterator.js +++ b/lib/internal/iterator.js @@ -1,6 +1,5 @@ -import isArrayLike from 'lodash/isArrayLike'; +import isArrayLike from './isArrayLike'; import getIterator from './getIterator'; -import keys from 'lodash/keys'; function createArrayIterator(coll) { var i = -1; @@ -22,7 +21,7 @@ function createES2015Iterator(iterator) { } function createObjectIterator(obj) { - var okeys = keys(obj); + var okeys = obj ? Object.keys(obj) : []; var i = -1; var len = okeys.length; return function next() { diff --git a/lib/internal/map.js b/lib/internal/map.js index 9cd927e..c7f64dd 100644 --- a/lib/internal/map.js +++ b/lib/internal/map.js @@ -1,4 +1,4 @@ -import noop from 'lodash/noop'; +import noop from './noop'; import wrapAsync from './wrapAsync'; export default function _asyncMap(eachfn, arr, iteratee, callback) { diff --git a/lib/internal/noop.js b/lib/internal/noop.js new file mode 100644 index 0000000..ca6a744 --- /dev/null +++ b/lib/internal/noop.js @@ -0,0 +1 @@ +export default function noop() {} diff --git a/lib/internal/parallel.js b/lib/internal/parallel.js index f4e9347..bbfdb42 100644 --- a/lib/internal/parallel.js +++ b/lib/internal/parallel.js @@ -1,5 +1,5 @@ -import noop from 'lodash/noop'; -import isArrayLike from 'lodash/isArrayLike'; +import isArrayLike from './isArrayLike'; +import noop from './noop'; import slice from './slice'; import wrapAsync from './wrapAsync'; diff --git a/lib/internal/property.js b/lib/internal/property.js new file mode 100644 index 0000000..567b3c3 --- /dev/null +++ b/lib/internal/property.js @@ -0,0 +1,5 @@ +export default function property(property) { + return function (object) { + return object[property]; + } +} diff --git a/lib/internal/queue.js b/lib/internal/queue.js index 1a3f4cb..575497b 100644 --- a/lib/internal/queue.js +++ b/lib/internal/queue.js @@ -1,7 +1,4 @@ -import indexOf from 'lodash/_baseIndexOf'; -import isArray from 'lodash/isArray'; -import noop from 'lodash/noop'; - +import noop from './noop'; import onlyOnce from './onlyOnce'; import setImmediate from './setImmediate'; import DLL from './DoublyLinkedList'; @@ -25,7 +22,7 @@ export default function queue(worker, concurrency, payload) { throw new Error('task callback must be a function'); } q.started = true; - if (!isArray(data)) { + if (!Array.isArray(data)) { data = [data]; } if (data.length === 0 && q.idle()) { @@ -64,7 +61,7 @@ export default function queue(worker, concurrency, payload) { for (var i = 0, l = tasks.length; i < l; i++) { var task = tasks[i]; - var index = indexOf(workersList, task, 0); + var index = workersList.indexOf(task); if (index === 0) { workersList.shift(); } else if (index > 0) { diff --git a/lib/internal/range.js b/lib/internal/range.js new file mode 100644 index 0000000..c9033e5 --- /dev/null +++ b/lib/internal/range.js @@ -0,0 +1,7 @@ +export default function range(size) { + var result = Array(size); + while (size--) { + result[size] = size; + } + return result; +} diff --git a/lib/mapValuesLimit.js b/lib/mapValuesLimit.js index c6e020d..47e6072 100644 --- a/lib/mapValuesLimit.js +++ b/lib/mapValuesLimit.js @@ -1,6 +1,6 @@ import eachOfLimit from './eachOfLimit'; -import noop from 'lodash/noop'; +import noop from './internal/noop'; import once from './internal/once'; import wrapAsync from './internal/wrapAsync'; diff --git a/lib/memoize.js b/lib/memoize.js index 27c08bc..07d0837 100644 --- a/lib/memoize.js +++ b/lib/memoize.js @@ -1,6 +1,5 @@ -import identity from 'lodash/identity'; +import identity from './internal/identity'; import slice from './internal/slice'; - import setImmediate from './internal/setImmediate'; import initialParams from './internal/initialParams'; import wrapAsync from './internal/wrapAsync'; diff --git a/lib/priorityQueue.js b/lib/priorityQueue.js index aff7293..b7f7507 100644 --- a/lib/priorityQueue.js +++ b/lib/priorityQueue.js @@ -1,5 +1,4 @@ -import isArray from 'lodash/isArray'; -import noop from 'lodash/noop'; +import noop from './internal/noop'; import setImmediate from './setImmediate'; @@ -39,7 +38,7 @@ export default function(worker, concurrency) { throw new Error('task callback must be a function'); } q.started = true; - if (!isArray(data)) { + if (!Array.isArray(data)) { data = [data]; } if (data.length === 0) { diff --git a/lib/race.js b/lib/race.js index 9b4d6c3..0593a72 100644 --- a/lib/race.js +++ b/lib/race.js @@ -1,5 +1,4 @@ -import isArray from 'lodash/isArray'; -import noop from 'lodash/noop'; +import noop from './internal/noop'; import once from './internal/once'; import wrapAsync from './internal/wrapAsync'; @@ -41,7 +40,7 @@ import wrapAsync from './internal/wrapAsync'; */ export default function race(tasks, callback) { callback = once(callback || noop); - if (!isArray(tasks)) return callback(new TypeError('First argument to race must be an array of functions')); + if (!Array.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++) { wrapAsync(tasks[i])(callback); diff --git a/lib/reduce.js b/lib/reduce.js index 0d58c41..de42c5e 100644 --- a/lib/reduce.js +++ b/lib/reduce.js @@ -1,5 +1,5 @@ import eachOfSeries from './eachOfSeries'; -import noop from 'lodash/noop'; +import noop from './internal/noop'; import once from './internal/once'; import wrapAsync from './internal/wrapAsync'; diff --git a/lib/reflectAll.js b/lib/reflectAll.js index 0774b94..3f078dc 100644 --- a/lib/reflectAll.js +++ b/lib/reflectAll.js @@ -1,7 +1,5 @@ import reflect from './reflect'; -import isArray from 'lodash/isArray'; -import _arrayMap from 'lodash/_arrayMap'; -import forOwn from 'lodash/_baseForOwn'; +import forOwn from './internal/forOwn'; /** * A helper function that wraps an array or an object of functions with `reflect`. @@ -72,8 +70,8 @@ import forOwn from 'lodash/_baseForOwn'; */ export default function reflectAll(tasks) { var results; - if (isArray(tasks)) { - results = _arrayMap(tasks, reflect); + if (Array.isArray(tasks)) { + results = tasks.map(reflect); } else { results = {}; forOwn(tasks, function(task, key) { diff --git a/lib/retry.js b/lib/retry.js index 391a4fa..390fd55 100644 --- a/lib/retry.js +++ b/lib/retry.js @@ -1,7 +1,12 @@ -import noop from 'lodash/noop'; -import constant from 'lodash/constant'; +import noop from './internal/noop'; import wrapAsync from './internal/wrapAsync'; +function constant(value) { + return function () { + return value; + } +} + /** * Attempts to get a successful response from `task` no more than `times` times * before returning an error. If the task is successful, the `callback` will be @@ -1,8 +1,7 @@ -import noop from 'lodash/noop'; +import noop from './internal/noop'; import slice from './internal/slice'; import reduce from './reduce'; import wrapAsync from './internal/wrapAsync'; -import arrayMap from 'lodash/_arrayMap'; /** * Version of the compose function that is more natural to read. Each function @@ -43,7 +42,7 @@ import arrayMap from 'lodash/_arrayMap'; * }); */ export default function seq(/*...functions*/) { - var _functions = arrayMap(arguments, wrapAsync); + var _functions = Array.prototype.map.call(arguments, wrapAsync); return function(/*...args*/) { var args = slice(arguments); var that = this; diff --git a/lib/some.js b/lib/some.js index ce91ce8..d574d02 100644 --- a/lib/some.js +++ b/lib/some.js @@ -1,6 +1,6 @@ import createTester from './internal/createTester'; import doParallel from './internal/doParallel'; -import identity from 'lodash/identity'; +import identity from './internal/identity'; /** * Returns `true` if at least one element in the `coll` satisfies an async test. diff --git a/lib/someLimit.js b/lib/someLimit.js index 161c3cf..f234828 100644 --- a/lib/someLimit.js +++ b/lib/someLimit.js @@ -1,6 +1,6 @@ import createTester from './internal/createTester'; import doParallelLimit from './internal/doParallelLimit'; -import identity from 'lodash/identity'; +import identity from './internal/identity'; /** * The same as [`some`]{@link module:Collections.some} but runs a maximum of `limit` async operations at a time. diff --git a/lib/sortBy.js b/lib/sortBy.js index 399debd..85028b2 100644 --- a/lib/sortBy.js +++ b/lib/sortBy.js @@ -1,8 +1,6 @@ -import arrayMap from 'lodash/_arrayMap'; -import property from 'lodash/_baseProperty'; - import map from './map'; import wrapAsync from './internal/wrapAsync'; +import property from './internal/property'; /** * Sorts a list by the results of running each `coll` value through an async @@ -60,7 +58,7 @@ export default function sortBy (coll, iteratee, callback) { }); }, function (err, results) { if (err) return callback(err); - callback(null, arrayMap(results.sort(comparator), property('value'))); + callback(null, results.sort(comparator).map(property('value'))); }); function comparator(left, right) { diff --git a/lib/timesLimit.js b/lib/timesLimit.js index 22be265..bb4a1fe 100644 --- a/lib/timesLimit.js +++ b/lib/timesLimit.js @@ -1,5 +1,5 @@ import mapLimit from './mapLimit'; -import range from 'lodash/_baseRange'; +import range from './internal/range'; import wrapAsync from './internal/wrapAsync'; /** @@ -20,5 +20,5 @@ import wrapAsync from './internal/wrapAsync'; */ export default function timeLimit(count, limit, iteratee, callback) { var _iteratee = wrapAsync(iteratee); - mapLimit(range(0, count, 1), limit, _iteratee, callback); + mapLimit(range(count), limit, _iteratee, callback); } diff --git a/lib/transform.js b/lib/transform.js index ef254a1..501636c 100644 --- a/lib/transform.js +++ b/lib/transform.js @@ -1,7 +1,5 @@ -import isArray from 'lodash/isArray'; -import noop from 'lodash/noop'; - import eachOf from './eachOf'; +import noop from './internal/noop'; import once from './internal/once'; import wrapAsync from './internal/wrapAsync'; @@ -51,7 +49,7 @@ export default function transform (coll, accumulator, iteratee, callback) { if (arguments.length <= 3) { callback = iteratee; iteratee = accumulator; - accumulator = isArray(coll) ? [] : {}; + accumulator = Array.isArray(coll) ? [] : {}; } callback = once(callback || noop); var _iteratee = wrapAsync(iteratee); diff --git a/lib/tryEach.js b/lib/tryEach.js index df9b68f..87fba12 100644 --- a/lib/tryEach.js +++ b/lib/tryEach.js @@ -1,5 +1,5 @@ -import noop from 'lodash/noop'; import eachSeries from './eachSeries'; +import noop from './internal/noop'; import wrapAsync from './internal/wrapAsync'; import slice from './internal/slice'; diff --git a/lib/waterfall.js b/lib/waterfall.js index 092f3ac..3e71d2c 100644 --- a/lib/waterfall.js +++ b/lib/waterfall.js @@ -1,5 +1,4 @@ -import isArray from 'lodash/isArray'; -import noop from 'lodash/noop'; +import noop from './internal/noop'; import once from './internal/once'; import slice from './internal/slice'; @@ -65,7 +64,7 @@ import wrapAsync from './internal/wrapAsync'; */ export default function(tasks, callback) { callback = once(callback || noop); - if (!isArray(tasks)) return callback(new Error('First argument to waterfall must be an array of functions')); + if (!Array.isArray(tasks)) return callback(new Error('First argument to waterfall must be an array of functions')); if (!tasks.length) return callback(); var taskIndex = 0; diff --git a/lib/whilst.js b/lib/whilst.js index 6c2869e..da748fa 100644 --- a/lib/whilst.js +++ b/lib/whilst.js @@ -1,4 +1,4 @@ -import noop from 'lodash/noop'; +import noop from './internal/noop'; import slice from './internal/slice'; import onlyOnce from './internal/onlyOnce'; diff --git a/package.json b/package.json index 547adc6..b6cfdde 100644 --- a/package.json +++ b/package.json @@ -18,10 +18,7 @@ "module", "utility" ], - "dependencies": { - "lodash": "^4.17.10", - "lodash-es": "^4.17.10" - }, + "dependencies": {}, "devDependencies": { "babel-cli": "^6.24.0", "babel-core": "^6.26.3", |