summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
Diffstat (limited to 'build')
-rw-r--r--build/async-bundle.js5310
-rw-r--r--build/async-cjs.js1230
-rw-r--r--build/modules-es6/apply.js9
-rw-r--r--build/modules-es6/applyEach.js6
-rw-r--r--build/modules-es6/applyEachSeries.js6
-rw-r--r--build/modules-es6/asyncify.js26
-rw-r--r--build/modules-es6/auto.js105
-rw-r--r--build/modules-es6/cargo.js7
-rw-r--r--build/modules-es6/compose.js9
-rw-r--r--build/modules-es6/concat.js6
-rw-r--r--build/modules-es6/concatSeries.js6
-rw-r--r--build/modules-es6/constant.js10
-rw-r--r--build/modules-es6/detect.js9
-rw-r--r--build/modules-es6/detectLimit.js9
-rw-r--r--build/modules-es6/detectSeries.js9
-rw-r--r--build/modules-es6/dir.js5
-rw-r--r--build/modules-es6/doDuring.js12
-rw-r--r--build/modules-es6/doUntil.js9
-rw-r--r--build/modules-es6/doWhilst.js10
-rw-r--r--build/modules-es6/during.js25
-rw-r--r--build/modules-es6/each.js8
-rw-r--r--build/modules-es6/eachLimit.js8
-rw-r--r--build/modules-es6/eachOf.js35
-rw-r--r--build/modules-es6/eachOfLimit.js7
-rw-r--r--build/modules-es6/eachOfSeries.js40
-rw-r--r--build/modules-es6/eachSeries.js8
-rw-r--r--build/modules-es6/ensureAsync.js24
-rw-r--r--build/modules-es6/every.js7
-rw-r--r--build/modules-es6/everyLimit.js7
-rw-r--r--build/modules-es6/filter.js6
-rw-r--r--build/modules-es6/filterLimit.js6
-rw-r--r--build/modules-es6/filterSeries.js6
-rw-r--r--build/modules-es6/forever.js17
-rw-r--r--build/modules-es6/index.js151
-rw-r--r--build/modules-es6/internal/applyEach.js20
-rw-r--r--build/modules-es6/internal/concat.js13
-rw-r--r--build/modules-es6/internal/consoleFunc.js22
-rw-r--r--build/modules-es6/internal/createTester.js26
-rw-r--r--build/modules-es6/internal/doParallel.js9
-rw-r--r--build/modules-es6/internal/doParallelLimit.js9
-rw-r--r--build/modules-es6/internal/doSeries.js9
-rw-r--r--build/modules-es6/internal/eachOfLimit.js48
-rw-r--r--build/modules-es6/internal/filter.js20
-rw-r--r--build/modules-es6/internal/findGetResult.js5
-rw-r--r--build/modules-es6/internal/keyIterator.js23
-rw-r--r--build/modules-es6/internal/map.js19
-rw-r--r--build/modules-es6/internal/notId.js5
-rw-r--r--build/modules-es6/internal/onlyOnce.js9
-rw-r--r--build/modules-es6/internal/parallel.js22
-rw-r--r--build/modules-es6/internal/queue.js139
-rw-r--r--build/modules-es6/internal/reject.js11
-rw-r--r--build/modules-es6/internal/setImmediate.js19
-rw-r--r--build/modules-es6/internal/withoutIndex.js7
-rw-r--r--build/modules-es6/iterator.js17
-rw-r--r--build/modules-es6/log.js5
-rw-r--r--build/modules-es6/map.js6
-rw-r--r--build/modules-es6/mapLimit.js6
-rw-r--r--build/modules-es6/mapSeries.js6
-rw-r--r--build/modules-es6/memoize.js36
-rw-r--r--build/modules-es6/nextTick.js7
-rw-r--r--build/modules-es6/parallel.js8
-rw-r--r--build/modules-es6/parallelLimit.js8
-rw-r--r--build/modules-es6/priorityQueue.js72
-rw-r--r--build/modules-es6/queue.js9
-rw-r--r--build/modules-es6/reduce.js14
-rw-r--r--build/modules-es6/reduceRight.js9
-rw-r--r--build/modules-es6/reject.js6
-rw-r--r--build/modules-es6/rejectLimit.js6
-rw-r--r--build/modules-es6/rejectSeries.js6
-rw-r--r--build/modules-es6/retry.js77
-rw-r--r--build/modules-es6/seq.js27
-rw-r--r--build/modules-es6/series.js8
-rw-r--r--build/modules-es6/setImmediate.js5
-rw-r--r--build/modules-es6/some.js8
-rw-r--r--build/modules-es6/someLimit.js7
-rw-r--r--build/modules-es6/sortBy.js24
-rw-r--r--build/modules-es6/times.js8
-rw-r--r--build/modules-es6/timesLimit.js8
-rw-r--r--build/modules-es6/timesSeries.js8
-rw-r--r--build/modules-es6/transform.js19
-rw-r--r--build/modules-es6/unmemoize.js7
-rw-r--r--build/modules-es6/until.js9
-rw-r--r--build/modules-es6/waterfall.js32
-rw-r--r--build/modules-es6/whilst.js15
-rw-r--r--build/modules/apply.js2
-rw-r--r--build/modules/asyncify.js4
-rw-r--r--build/modules/auto.js18
-rw-r--r--build/modules/constant.js2
-rw-r--r--build/modules/detect.js2
-rw-r--r--build/modules/detectLimit.js2
-rw-r--r--build/modules/detectSeries.js2
-rw-r--r--build/modules/during.js4
-rw-r--r--build/modules/eachOf.js4
-rw-r--r--build/modules/eachOfSeries.js4
-rw-r--r--build/modules/ensureAsync.js2
-rw-r--r--build/modules/forever.js2
-rw-r--r--build/modules/internal/applyEach.js2
-rw-r--r--build/modules/internal/consoleFunc.js4
-rw-r--r--build/modules/internal/eachOfLimit.js4
-rw-r--r--build/modules/internal/filter.js4
-rw-r--r--build/modules/internal/keyIterator.js4
-rw-r--r--build/modules/internal/map.js6
-rw-r--r--build/modules/internal/parallel.js6
-rw-r--r--build/modules/internal/queue.js10
-rw-r--r--build/modules/memoize.js4
-rw-r--r--build/modules/priorityQueue.js6
-rw-r--r--build/modules/reduceRight.js2
-rw-r--r--build/modules/seq.js4
-rw-r--r--build/modules/some.js2
-rw-r--r--build/modules/someLimit.js2
-rw-r--r--build/modules/sortBy.js4
-rw-r--r--build/modules/times.js2
-rw-r--r--build/modules/timesLimit.js2
-rw-r--r--build/modules/timesSeries.js2
-rw-r--r--build/modules/transform.js2
-rw-r--r--build/modules/waterfall.js8
-rw-r--r--build/modules/whilst.js4
117 files changed, 3956 insertions, 4242 deletions
diff --git a/build/async-bundle.js b/build/async-bundle.js
index 22af30e..f73ad6e 100644
--- a/build/async-bundle.js
+++ b/build/async-bundle.js
@@ -1,2827 +1,2837 @@
-'use strict';
-
-/**
- * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
- * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
- * @example
- *
- * _.isObject({});
- * // => true
- *
- * _.isObject([1, 2, 3]);
- * // => true
- *
- * _.isObject(_.noop);
- * // => true
- *
- * _.isObject(null);
- * // => false
- */
-function isObject(value) {
- // Avoid a V8 JIT bug in Chrome 19-20.
- // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
- var type = typeof value;
- return !!value && (type == 'object' || type == 'function');
-}
-
-/**
- * A faster alternative to `Function#apply`, this function invokes `func`
- * with the `this` binding of `thisArg` and the arguments of `args`.
- *
- * @private
- * @param {Function} func The function to invoke.
- * @param {*} thisArg The `this` binding of `func`.
- * @param {...*} [args] The arguments to invoke `func` with.
- * @returns {*} Returns the result of `func`.
- */
-function apply$1(func, thisArg, args) {
- var length = args ? args.length : 0;
- switch (length) {
- case 0: return func.call(thisArg);
- case 1: return func.call(thisArg, args[0]);
- case 2: return func.call(thisArg, args[0], args[1]);
- case 3: return func.call(thisArg, args[0], args[1], args[2]);
- }
- return func.apply(thisArg, args);
-}
-
-/**
- * Checks if `value` is a global object.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {null|Object} Returns `value` if it's a global object, else `null`.
- */
-function checkGlobal(value) {
- return (value && value.Object === Object) ? value : null;
-}
-
-/** Used to determine if values are of the language type `Object`. */
-var objectTypes = {
- 'function': true,
- 'object': true
-};
-
-/** Detect free variable `exports`. */
-var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) ? exports : null;
-
-/** Detect free variable `module`. */
-var freeModule = (objectTypes[typeof module] && module && !module.nodeType) ? module : null;
-
-/** Detect free variable `global` from Node.js. */
-var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global);
-
-/** Detect free variable `self`. */
-var freeSelf = checkGlobal(objectTypes[typeof self] && self);
-
-/** Detect free variable `window`. */
-var freeWindow = checkGlobal(objectTypes[typeof window] && window);
-
-/** Detect `this` as the global object. */
-var thisGlobal = checkGlobal(objectTypes[typeof this] && this);
-
-/**
- * Used as a reference to the global object.
- *
- * The `this` value is used if it's the global object to avoid Greasemonkey's
- * restricted `window` object, otherwise the `window` object is used.
- */
-var root = freeGlobal || ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || freeSelf || thisGlobal || Function('return this')();
-
-/**
- * Used by `trimmedStartIndex` and `trimmedEndIndex` to determine if a
- * character code is whitespace.
- *
- * @private
- * @param {number} charCode The character code to inspect.
- * @returns {boolean} Returns `true` if `charCode` is whitespace, else `false`.
- */
-function isSpace(charCode) {
- return ((charCode <= 160 && (charCode >= 9 && charCode <= 13) || charCode == 32 || charCode == 160) || charCode == 5760 || charCode == 6158 ||
- (charCode >= 8192 && (charCode <= 8202 || charCode == 8232 || charCode == 8233 || charCode == 8239 || charCode == 8287 || charCode == 12288 || charCode == 65279)));
-}
-
-/**
- * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
- * character of `string`.
- *
- * @private
- * @param {string} string The string to inspect.
- * @returns {number} Returns the index of the last non-whitespace character.
- */
-function trimmedEndIndex(string) {
- var index = string.length;
-
- while (index-- && isSpace(string.charCodeAt(index))) {}
- return index;
-}
-
-/**
- * Used by `_.trim` and `_.trimStart` to get the index of the first non-whitespace
- * character of `string`.
- *
- * @private
- * @param {string} string The string to inspect.
- * @returns {number} Returns the index of the first non-whitespace character.
- */
-function trimmedStartIndex(string) {
- var index = -1,
- length = string.length;
-
- while (++index < length && isSpace(string.charCodeAt(index))) {}
- return index;
-}
-
-/**
- * The base implementation of `_.trim` without support trimming non-whitespace
- * characters.
- *
- * @private
- * @param {string} string The string to trim.
- * @returns {string} Returns the trimmed string.
- */
-function baseTrim(string) {
- return string
- ? string.slice(trimmedStartIndex(string), trimmedEndIndex(string) + 1)
- : string;
-}
-
-var funcTag = '[object Function]';
-var genTag = '[object GeneratorFunction]';
-/** Used for built-in method references. */
-var objectProto$5 = Object.prototype;
-
-/**
- * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
- * of values.
- */
-var objToString$3 = objectProto$5.toString;
-
-/**
- * Checks if `value` is classified as a `Function` object.
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
- * @example
- *
- * _.isFunction(_);
- * // => true
- *
- * _.isFunction(/abc/);
- * // => false
- */
-function isFunction(value) {
- // The use of `Object#toString` avoids issues with the `typeof` operator
- // in Safari 8 which returns 'object' for typed array constructors, and
- // PhantomJS 1.9 which returns 'function' for `NodeList` instances.
- var tag = isObject(value) ? objToString$3.call(value) : '';
- return tag == funcTag || tag == genTag;
-}
-
-/**
- * Checks if `value` is classified as an `Array` object.
- *
- * @static
- * @memberOf _
- * @type Function
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
- * @example
- *
- * _.isArray([1, 2, 3]);
- * // => true
- *
- * _.isArray(document.body.children);
- * // => false
- *
- * _.isArray('abc');
- * // => false
- *
- * _.isArray(_.noop);
- * // => false
- */
-var isArray = Array.isArray;
-
-/**
- * Checks if `value` is object-like. A value is object-like if it's not `null`
- * and has a `typeof` result of "object".
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
- * @example
- *
- * _.isObjectLike({});
- * // => true
- *
- * _.isObjectLike([1, 2, 3]);
- * // => true
- *
- * _.isObjectLike(_.noop);
- * // => false
- *
- * _.isObjectLike(null);
- * // => false
- */
-function isObjectLike(value) {
- return !!value && typeof value == 'object';
-}
-
-/** `Object#toString` result references. */
-var stringTag = '[object String]';
-
-/** Used for built-in method references. */
-var objectProto$3 = Object.prototype;
-
-/**
- * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
- * of values.
- */
-var objToString$1 = objectProto$3.toString;
-
-/**
- * Checks if `value` is classified as a `String` primitive or object.
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
- * @example
- *
- * _.isString('abc');
- * // => true
- *
- * _.isString(1);
- * // => false
- */
-function isString(value) {
- return typeof value == 'string' ||
- (!isArray(value) && isObjectLike(value) && objToString$1.call(value) == stringTag);
-}
-
-/** Used as references for various `Number` constants. */
-var NAN = 0 / 0;
-
-/** Used to detect bad signed hexadecimal string values. */
-var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
-
-/** Used to detect binary string values. */
-var reIsBinary = /^0b[01]+$/i;
-
-/** Used to detect octal string values. */
-var reIsOctal = /^0o[0-7]+$/i;
-
-/* Built-in method references for those with the same name as other `lodash` methods. */
-var nativeParseInt = root.parseInt;
-
-/**
- * Converts `value` to a number.
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to process.
- * @returns {number} Returns the number.
- * @example
- *
- * _.toNumber(3);
- * // => 3
- *
- * _.toNumber(Number.MIN_VALUE);
- * // => 5e-324
- *
- * _.toNumber(Infinity);
- * // => Infinity
- *
- * _.toNumber('3');
- * // => 3
- */
-function toNumber(value) {
- if (!value) {
- return value === 0 ? value : +value;
- }
- if (isObject(value)) {
- var other = isFunction(value.valueOf) ? value.valueOf() : value;
- value = isObject(other) ? (other + '') : other;
- }
- if (typeof value == 'number' || !isString(value)) {
- return +value;
- }
- value = baseTrim(value);
- var isBinary = reIsBinary.test(value);
- return (isBinary || reIsOctal.test(value))
- ? nativeParseInt(value.slice(2), isBinary ? 2 : 8)
- : (reIsBadHex.test(value) ? NAN : +value);
-}
-
-var INFINITY = 1 / 0;
-var MAX_INTEGER = 1.7976931348623157e+308;
-/**
- * Converts `value` to an integer.
- *
- * **Note:** This function is loosely based on [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger).
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to convert.
- * @returns {number} Returns the converted integer.
- * @example
- *
- * _.toInteger(3);
- * // => 3
- *
- * _.toInteger(Number.MIN_VALUE);
- * // => 0
- *
- * _.toInteger(Infinity);
- * // => 1.7976931348623157e+308
- *
- * _.toInteger('3');
- * // => 3
- */
-function toInteger(value) {
- if (!value) {
- return value === 0 ? value : 0;
- }
- value = toNumber(value);
- if (value === INFINITY || value === -INFINITY) {
- var sign = (value < 0 ? -1 : 1);
- return sign * MAX_INTEGER;
- }
- var remainder = value % 1;
- return value === value ? (remainder ? value - remainder : value) : 0;
-}
-
-/** Used as the `TypeError` message for "Functions" methods. */
-var FUNC_ERROR_TEXT = 'Expected a function';
-
-/* Built-in method references for those with the same name as other `lodash` methods. */
-var nativeMax = Math.max;
-
-/**
- * Creates a function that invokes `func` with the `this` binding of the
- * created function and arguments from `start` and beyond provided as an array.
- *
- * **Note:** This method is based on the [rest parameter](https://mdn.io/rest_parameters).
- *
- * @static
- * @memberOf _
- * @category Function
- * @param {Function} func The function to apply a rest parameter to.
- * @param {number} [start=func.length-1] The start position of the rest parameter.
- * @returns {Function} Returns the new function.
- * @example
- *
- * var say = _.rest(function(what, names) {
- * return what + ' ' + _.initial(names).join(', ') +
- * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
- * });
- *
- * say('hello', 'fred', 'barney', 'pebbles');
- * // => 'hello fred, barney, & pebbles'
- */
-function rest(func, start) {
- if (typeof func != 'function') {
- throw new TypeError(FUNC_ERROR_TEXT);
- }
- start = nativeMax(start === undefined ? (func.length - 1) : toInteger(start), 0);
- return function() {
- var args = arguments,
- index = -1,
- length = nativeMax(args.length - start, 0),
- array = Array(length);
-
- while (++index < length) {
- array[index] = args[start + index];
- }
- switch (start) {
- case 0: return func.call(this, array);
- case 1: return func.call(this, args[0], array);
- case 2: return func.call(this, args[0], args[1], array);
- }
- var otherArgs = Array(start + 1);
- index = -1;
- while (++index < start) {
- otherArgs[index] = args[index];
- }
- otherArgs[start] = array;
- return apply$1(func, this, otherArgs);
- };
-}
-
-function asyncify(func) {
- return rest(function (args) {
- var callback = args.pop();
- var result;
- try {
- result = func.apply(this, args);
- } catch (e) {
- return callback(e);
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
+ typeof define === 'function' && define.amd ? define(['exports'], factory) :
+ factory((global.async = {}));
+}(this, function (exports) { 'use strict';
+
+ /**
+ * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
+ * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is an object, else `false`.
+ * @example
+ *
+ * _.isObject({});
+ * // => true
+ *
+ * _.isObject([1, 2, 3]);
+ * // => true
+ *
+ * _.isObject(_.noop);
+ * // => true
+ *
+ * _.isObject(null);
+ * // => false
+ */
+ function isObject(value) {
+ // Avoid a V8 JIT bug in Chrome 19-20.
+ // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
+ var type = typeof value;
+ return !!value && (type == 'object' || type == 'function');
+ }
+
+ /**
+ * A faster alternative to `Function#apply`, this function invokes `func`
+ * with the `this` binding of `thisArg` and the arguments of `args`.
+ *
+ * @private
+ * @param {Function} func The function to invoke.
+ * @param {*} thisArg The `this` binding of `func`.
+ * @param {...*} [args] The arguments to invoke `func` with.
+ * @returns {*} Returns the result of `func`.
+ */
+ function apply$1(func, thisArg, args) {
+ var length = args ? args.length : 0;
+ switch (length) {
+ case 0: return func.call(thisArg);
+ case 1: return func.call(thisArg, args[0]);
+ case 2: return func.call(thisArg, args[0], args[1]);
+ case 3: return func.call(thisArg, args[0], args[1], args[2]);
+ }
+ return func.apply(thisArg, args);
+ }
+
+ /**
+ * Checks if `value` is a global object.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {null|Object} Returns `value` if it's a global object, else `null`.
+ */
+ function checkGlobal(value) {
+ return (value && value.Object === Object) ? value : null;
+ }
+
+ /** Used to determine if values are of the language type `Object`. */
+ var objectTypes = {
+ 'function': true,
+ 'object': true
+ };
+
+ /** Detect free variable `exports`. */
+ var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) ? exports : null;
+
+ /** Detect free variable `module`. */
+ var freeModule = (objectTypes[typeof module] && module && !module.nodeType) ? module : null;
+
+ /** Detect free variable `global` from Node.js. */
+ var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global);
+
+ /** Detect free variable `self`. */
+ var freeSelf = checkGlobal(objectTypes[typeof self] && self);
+
+ /** Detect free variable `window`. */
+ var freeWindow = checkGlobal(objectTypes[typeof window] && window);
+
+ /** Detect `this` as the global object. */
+ var thisGlobal = checkGlobal(objectTypes[typeof this] && this);
+
+ /**
+ * Used as a reference to the global object.
+ *
+ * The `this` value is used if it's the global object to avoid Greasemonkey's
+ * restricted `window` object, otherwise the `window` object is used.
+ */
+ var root = freeGlobal || ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || freeSelf || thisGlobal || Function('return this')();
+
+ /**
+ * Used by `trimmedStartIndex` and `trimmedEndIndex` to determine if a
+ * character code is whitespace.
+ *
+ * @private
+ * @param {number} charCode The character code to inspect.
+ * @returns {boolean} Returns `true` if `charCode` is whitespace, else `false`.
+ */
+ function isSpace(charCode) {
+ return ((charCode <= 160 && (charCode >= 9 && charCode <= 13) || charCode == 32 || charCode == 160) || charCode == 5760 || charCode == 6158 ||
+ (charCode >= 8192 && (charCode <= 8202 || charCode == 8232 || charCode == 8233 || charCode == 8239 || charCode == 8287 || charCode == 12288 || charCode == 65279)));
+ }
+
+ /**
+ * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
+ * character of `string`.
+ *
+ * @private
+ * @param {string} string The string to inspect.
+ * @returns {number} Returns the index of the last non-whitespace character.
+ */
+ function trimmedEndIndex(string) {
+ var index = string.length;
+
+ while (index-- && isSpace(string.charCodeAt(index))) {}
+ return index;
+ }
+
+ /**
+ * Used by `_.trim` and `_.trimStart` to get the index of the first non-whitespace
+ * character of `string`.
+ *
+ * @private
+ * @param {string} string The string to inspect.
+ * @returns {number} Returns the index of the first non-whitespace character.
+ */
+ function trimmedStartIndex(string) {
+ var index = -1,
+ length = string.length;
+
+ while (++index < length && isSpace(string.charCodeAt(index))) {}
+ return index;
+ }
+
+ /**
+ * The base implementation of `_.trim` without support trimming non-whitespace
+ * characters.
+ *
+ * @private
+ * @param {string} string The string to trim.
+ * @returns {string} Returns the trimmed string.
+ */
+ function baseTrim(string) {
+ return string
+ ? string.slice(trimmedStartIndex(string), trimmedEndIndex(string) + 1)
+ : string;
+ }
+
+ var funcTag = '[object Function]';
+ var genTag = '[object GeneratorFunction]';
+ /** Used for built-in method references. */
+ var objectProto$5 = Object.prototype;
+
+ /**
+ * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
+ * of values.
+ */
+ var objectToString$3 = objectProto$5.toString;
+
+ /**
+ * Checks if `value` is classified as a `Function` object.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @example
+ *
+ * _.isFunction(_);
+ * // => true
+ *
+ * _.isFunction(/abc/);
+ * // => false
+ */
+ function isFunction(value) {
+ // The use of `Object#toString` avoids issues with the `typeof` operator
+ // in Safari 8 which returns 'object' for typed array constructors, and
+ // PhantomJS 1.9 which returns 'function' for `NodeList` instances.
+ var tag = isObject(value) ? objectToString$3.call(value) : '';
+ return tag == funcTag || tag == genTag;
+ }
+
+ /**
+ * Checks if `value` is classified as an `Array` object.
+ *
+ * @static
+ * @memberOf _
+ * @type Function
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @example
+ *
+ * _.isArray([1, 2, 3]);
+ * // => true
+ *
+ * _.isArray(document.body.children);
+ * // => false
+ *
+ * _.isArray('abc');
+ * // => false
+ *
+ * _.isArray(_.noop);
+ * // => false
+ */
+ var isArray = Array.isArray;
+
+ /**
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
+ * and has a `typeof` result of "object".
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
+ * @example
+ *
+ * _.isObjectLike({});
+ * // => true
+ *
+ * _.isObjectLike([1, 2, 3]);
+ * // => true
+ *
+ * _.isObjectLike(_.noop);
+ * // => false
+ *
+ * _.isObjectLike(null);
+ * // => false
+ */
+ function isObjectLike(value) {
+ return !!value && typeof value == 'object';
+ }
+
+ /** `Object#toString` result references. */
+ var stringTag = '[object String]';
+
+ /** Used for built-in method references. */
+ var objectProto$3 = Object.prototype;
+
+ /**
+ * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
+ * of values.
+ */
+ var objectToString$1 = objectProto$3.toString;
+
+ /**
+ * Checks if `value` is classified as a `String` primitive or object.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @example
+ *
+ * _.isString('abc');
+ * // => true
+ *
+ * _.isString(1);
+ * // => false
+ */
+ function isString(value) {
+ return typeof value == 'string' ||
+ (!isArray(value) && isObjectLike(value) && objectToString$1.call(value) == stringTag);
+ }
+
+ /** Used as references for various `Number` constants. */
+ var NAN = 0 / 0;
+
+ /** Used to detect bad signed hexadecimal string values. */
+ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
+
+ /** Used to detect binary string values. */
+ var reIsBinary = /^0b[01]+$/i;
+
+ /** Used to detect octal string values. */
+ var reIsOctal = /^0o[0-7]+$/i;
+
+ /* Built-in method references for those with the same name as other `lodash` methods. */
+ var nativeParseInt = root.parseInt;
+
+ /**
+ * Converts `value` to a number.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to process.
+ * @returns {number} Returns the number.
+ * @example
+ *
+ * _.toNumber(3);
+ * // => 3
+ *
+ * _.toNumber(Number.MIN_VALUE);
+ * // => 5e-324
+ *
+ * _.toNumber(Infinity);
+ * // => Infinity
+ *
+ * _.toNumber('3');
+ * // => 3
+ */
+ function toNumber(value) {
+ if (!value) {
+ return value === 0 ? value : +value;
+ }
+ if (isObject(value)) {
+ var other = isFunction(value.valueOf) ? value.valueOf() : value;
+ value = isObject(other) ? (other + '') : other;
+ }
+ if (typeof value == 'number' || !isString(value)) {
+ return +value;
+ }
+ value = baseTrim(value);
+ var isBinary = reIsBinary.test(value);
+ return (isBinary || reIsOctal.test(value))
+ ? nativeParseInt(value.slice(2), isBinary ? 2 : 8)
+ : (reIsBadHex.test(value) ? NAN : +value);
+ }
+
+ var INFINITY = 1 / 0;
+ var MAX_INTEGER = 1.7976931348623157e+308;
+ /**
+ * Converts `value` to an integer.
+ *
+ * **Note:** This function is loosely based on [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger).
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to convert.
+ * @returns {number} Returns the converted integer.
+ * @example
+ *
+ * _.toInteger(3);
+ * // => 3
+ *
+ * _.toInteger(Number.MIN_VALUE);
+ * // => 0
+ *
+ * _.toInteger(Infinity);
+ * // => 1.7976931348623157e+308
+ *
+ * _.toInteger('3');
+ * // => 3
+ */
+ function toInteger(value) {
+ if (!value) {
+ return value === 0 ? value : 0;
+ }
+ value = toNumber(value);
+ if (value === INFINITY || value === -INFINITY) {
+ var sign = (value < 0 ? -1 : 1);
+ return sign * MAX_INTEGER;
+ }
+ var remainder = value % 1;
+ return value === value ? (remainder ? value - remainder : value) : 0;
+ }
+
+ /** Used as the `TypeError` message for "Functions" methods. */
+ var FUNC_ERROR_TEXT = 'Expected a function';
+
+ /* Built-in method references for those with the same name as other `lodash` methods. */
+ var nativeMax = Math.max;
+
+ /**
+ * Creates a function that invokes `func` with the `this` binding of the
+ * created function and arguments from `start` and beyond provided as an array.
+ *
+ * **Note:** This method is based on the [rest parameter](https://mdn.io/rest_parameters).
+ *
+ * @static
+ * @memberOf _
+ * @category Function
+ * @param {Function} func The function to apply a rest parameter to.
+ * @param {number} [start=func.length-1] The start position of the rest parameter.
+ * @returns {Function} Returns the new function.
+ * @example
+ *
+ * var say = _.rest(function(what, names) {
+ * return what + ' ' + _.initial(names).join(', ') +
+ * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
+ * });
+ *
+ * say('hello', 'fred', 'barney', 'pebbles');
+ * // => 'hello fred, barney, & pebbles'
+ */
+ function rest(func, start) {
+ if (typeof func != 'function') {
+ throw new TypeError(FUNC_ERROR_TEXT);
+ }
+ start = nativeMax(start === undefined ? (func.length - 1) : toInteger(start), 0);
+ return function() {
+ var args = arguments,
+ index = -1,
+ length = nativeMax(args.length - start, 0),
+ array = Array(length);
+
+ while (++index < length) {
+ array[index] = args[start + index];
}
- // if result is Promise object
- if (isObject(result) && typeof result.then === 'function') {
- result.then(function (value) {
- callback(null, value);
- })['catch'](function (err) {
- callback(err.message ? err : new Error(err));
- });
- } else {
- callback(null, result);
+ switch (start) {
+ case 0: return func.call(this, array);
+ case 1: return func.call(this, args[0], array);
+ case 2: return func.call(this, args[0], args[1], array);
}
- });
-}
-
-/**
- * A specialized version of `_.map` for arrays without support for callback
- * shorthands.
- *
- * @private
- * @param {Array} array The array to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array} Returns the new mapped array.
- */
-function arrayMap(array, iteratee) {
- var index = -1,
- length = array.length,
- result = Array(length);
-
- while (++index < length) {
- result[index] = iteratee(array[index], index, array);
- }
- return result;
-}
-
-/**
- * The base implementation of `_.property` without support for deep paths.
- *
- * @private
- * @param {string} key The key of the property to get.
- * @returns {Function} Returns the new function.
- */
-function baseProperty(key) {
- return function(object) {
- return object == null ? undefined : object[key];
- };
-}
-
-/** Used as references for various `Number` constants. */
-var INFINITY$1 = 1 / 0;
-
-/**
- * Converts `value` to a string if it's not one. An empty string is returned
- * for `null` and `undefined` values. The sign of `-0` is preserved.
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to process.
- * @returns {string} Returns the string.
- * @example
- *
- * _.toString(null);
- * // => ''
- *
- * _.toString(-0);
- * // => '-0'
- *
- * _.toString([1, 2, 3]);
- * // => '1,2,3'
- */
-function toString(value) {
- // Exit early for strings to avoid a performance hit in some environments.
- if (typeof value == 'string') {
- return value;
- }
- var result = value == null ? '' : (value + '');
- return (result == '0' && (1 / value) == -INFINITY$1) ? '-0' : result;
-}
-
-/** Used to match property names within property paths. */
-var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g;
-
-/** Used to match backslashes in property paths. */
-var reEscapeChar = /\\(\\)?/g;
-
-/**
- * Converts `string` to a property path array.
- *
- * @private
- * @param {string} string The string to convert.
- * @returns {Array} Returns the property path array.
- */
-function stringToPath(string) {
- var result = [];
- toString(string).replace(rePropName, function(match, number, quote, string) {
- result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
- });
- return result;
-}
-
-/**
- * The base implementation of `_.toPath` which only converts `value` to a
- * path if it's not one.
- *
- * @private
- * @param {*} value The value to process.
- * @returns {Array} Returns the property path array.
- */
-function baseToPath(value) {
- return isArray(value) ? value : stringToPath(value);
-}
-
-var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
-var reIsPlainProp = /^\w*$/;
-/**
- * Checks if `value` is a property name and not a property path.
- *
- * @private
- * @param {*} value The value to check.
- * @param {Object} [object] The object to query keys on.
- * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
- */
-function isKey(value, object) {
- if (typeof value == 'number') {
- return true;
- }
- return !isArray(value) &&
- (reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
- (object != null && value in Object(object)));
-}
-
-/**
- * The base implementation of `_.get` without support for default values.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {Array|string} path The path of the property to get.
- * @returns {*} Returns the resolved value.
- */
-function baseGet(object, path) {
- path = isKey(path, object) ? [path + ''] : baseToPath(path);
-
- var index = 0,
- length = path.length;
-
- while (object != null && index < length) {
- object = object[path[index++]];
- }
- return (index && index == length) ? object : undefined;
-}
-
-/**
- * A specialized version of `baseProperty` which supports deep paths.
- *
- * @private
- * @param {Array|string} path The path of the property to get.
- * @returns {Function} Returns the new function.
- */
-function basePropertyDeep(path) {
- return function(object) {
- return baseGet(object, path);
- };
-}
-
-/**
- * Creates a function that returns the value at `path` of a given object.
- *
- * @static
- * @memberOf _
- * @category Utility
- * @param {Array|string} path The path of the property to get.
- * @returns {Function} Returns the new function.
- * @example
- *
- * var objects = [
- * { 'a': { 'b': { 'c': 2 } } },
- * { 'a': { 'b': { 'c': 1 } } }
- * ];
- *
- * _.map(objects, _.property('a.b.c'));
- * // => [2, 1]
- *
- * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c');
- * // => [1, 2]
- */
-function property(path) {
- return isKey(path) ? baseProperty(path) : basePropertyDeep(path);
-}
-
-function _filter(eachfn, arr, iterator, callback) {
- var results = [];
- eachfn(arr, function (x, index, callback) {
- iterator(x, function (v) {
- if (v) {
- results.push({ index: index, value: x });
+ var otherArgs = Array(start + 1);
+ index = -1;
+ while (++index < start) {
+ otherArgs[index] = args[index];
+ }
+ otherArgs[start] = array;
+ return apply$1(func, this, otherArgs);
+ };
+ }
+
+ function asyncify(func) {
+ return rest(function (args) {
+ var callback = args.pop();
+ var result;
+ try {
+ result = func.apply(this, args);
+ } catch (e) {
+ return callback(e);
+ }
+ // if result is Promise object
+ if (isObject(result) && typeof result.then === 'function') {
+ result.then(function (value) {
+ callback(null, value);
+ })['catch'](function (err) {
+ callback(err.message ? err : new Error(err));
+ });
+ } else {
+ callback(null, result);
}
- callback();
});
- }, function () {
- callback(arrayMap(results.sort(function (a, b) {
- return a.index - b.index;
- }), property('value')));
- });
-}
-
-/** Used as the `TypeError` message for "Functions" methods. */
-var FUNC_ERROR_TEXT$1 = 'Expected a function';
-
-/**
- * Creates a function that invokes `func`, with the `this` binding and arguments
- * of the created function, while it's called less than `n` times. Subsequent
- * calls to the created function return the result of the last `func` invocation.
- *
- * @static
- * @memberOf _
- * @category Function
- * @param {number} n The number of calls at which `func` is no longer invoked.
- * @param {Function} func The function to restrict.
- * @returns {Function} Returns the new restricted function.
- * @example
- *
- * jQuery('#add').on('click', _.before(5, addContactToList));
- * // => allows adding up to 4 contacts to the list
- */
-function before(n, func) {
- var result;
- if (typeof func != 'function') {
- throw new TypeError(FUNC_ERROR_TEXT$1);
- }
- n = toInteger(n);
- return function() {
- if (--n > 0) {
- result = func.apply(this, arguments);
- }
- if (n <= 1) {
- func = undefined;
- }
- return result;
- };
-}
-
-/**
- * Creates a function that is restricted to invoking `func` once. Repeat calls
- * to the function return the value of the first invocation. The `func` is
- * invoked with the `this` binding and arguments of the created function.
- *
- * @static
- * @memberOf _
- * @category Function
- * @param {Function} func The function to restrict.
- * @returns {Function} Returns the new restricted function.
- * @example
- *
- * var initialize = _.once(createApplication);
- * initialize();
- * initialize();
- * // `initialize` invokes `createApplication` once
- */
-function once(func) {
- return before(2, func);
-}
-
-/**
- * A no-operation function that returns `undefined` regardless of the
- * arguments it receives.
- *
- * @static
- * @memberOf _
- * @category Utility
- * @example
- *
- * var object = { 'user': 'fred' };
- *
- * _.noop(object) === undefined;
- * // => true
- */
-function noop() {
- // No operation performed.
-}
-
-/**
- * Gets the "length" property value of `object`.
- *
- * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)
- * that affects Safari on at least iOS 8.1-8.3 ARM64.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {*} Returns the "length" value.
- */
-var getLength = baseProperty('length');
-
-/** Used as references for various `Number` constants. */
-var MAX_SAFE_INTEGER$1 = 9007199254740991;
-
-/**
- * Checks if `value` is a valid array-like length.
- *
- * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
- * @example
- *
- * _.isLength(3);
- * // => true
- *
- * _.isLength(Number.MIN_VALUE);
- * // => false
- *
- * _.isLength(Infinity);
- * // => false
- *
- * _.isLength('3');
- * // => false
- */
-function isLength(value) {
- return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$1;
-}
-
-/**
- * Checks if `value` is array-like. A value is considered array-like if it's
- * not a function and has a `value.length` that's an integer greater than or
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
- *
- * @static
- * @memberOf _
- * @type Function
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
- * @example
- *
- * _.isArrayLike([1, 2, 3]);
- * // => true
- *
- * _.isArrayLike(document.body.children);
- * // => true
- *
- * _.isArrayLike('abc');
- * // => true
- *
- * _.isArrayLike(_.noop);
- * // => false
- */
-function isArrayLike(value) {
- return value != null &&
- !(typeof value == 'function' && isFunction(value)) && isLength(getLength(value));
-}
-
-/** Used for built-in method references. */
-var objectProto = Object.prototype;
-
-/** Used to check objects for own properties. */
-var hasOwnProperty = objectProto.hasOwnProperty;
-
-/** Built-in value references. */
-var getPrototypeOf = Object.getPrototypeOf;
-
-/**
- * The base implementation of `_.has` without support for deep paths.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {Array|string} key The key to check.
- * @returns {boolean} Returns `true` if `key` exists, else `false`.
- */
-function baseHas(object, key) {
- // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`,
- // that are composed entirely of index properties, return `false` for
- // `hasOwnProperty` checks of them.
- return hasOwnProperty.call(object, key) ||
- (typeof object == 'object' && key in object && getPrototypeOf(object) === null);
-}
-
-/* Built-in method references for those with the same name as other `lodash` methods. */
-var nativeKeys = Object.keys;
-
-/**
- * The base implementation of `_.keys` which doesn't skip the constructor
- * property of prototypes or treat sparse arrays as dense.
- *
- * @private
- * @type Function
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- */
-function baseKeys(object) {
- return nativeKeys(Object(object));
-}
-
-/**
- * The base implementation of `_.times` without support for callback shorthands
- * or max array length checks.
- *
- * @private
- * @param {number} n The number of times to invoke `iteratee`.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array} Returns the array of results.
- */
-function baseTimes(n, iteratee) {
- var index = -1,
- result = Array(n);
-
- while (++index < n) {
- result[index] = iteratee(index);
- }
- return result;
-}
-
-/**
- * This method is like `_.isArrayLike` except that it also checks if `value`
- * is an object.
- *
- * @static
- * @memberOf _
- * @type Function
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`.
- * @example
- *
- * _.isArrayLikeObject([1, 2, 3]);
- * // => true
- *
- * _.isArrayLikeObject(document.body.children);
- * // => true
- *
- * _.isArrayLikeObject('abc');
- * // => false
- *
- * _.isArrayLikeObject(_.noop);
- * // => false
- */
-function isArrayLikeObject(value) {
- return isObjectLike(value) && isArrayLike(value);
-}
-
-/** `Object#toString` result references. */
-var argsTag = '[object Arguments]';
-
-/** Used for built-in method references. */
-var objectProto$4 = Object.prototype;
-
-/** Used to check objects for own properties. */
-var hasOwnProperty$1 = objectProto$4.hasOwnProperty;
-
-/**
- * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
- * of values.
- */
-var objToString$2 = objectProto$4.toString;
-
-/** Built-in value references. */
-var propertyIsEnumerable = objectProto$4.propertyIsEnumerable;
-
-/**
- * Checks if `value` is likely an `arguments` object.
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
- * @example
- *
- * _.isArguments(function() { return arguments; }());
- * // => true
- *
- * _.isArguments([1, 2, 3]);
- * // => false
- */
-function isArguments(value) {
- // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode.
- return isArrayLikeObject(value) && hasOwnProperty$1.call(value, 'callee') &&
- (!propertyIsEnumerable.call(value, 'callee') || objToString$2.call(value) == argsTag);
-}
-
-/**
- * Creates an array of index keys for `object` values of arrays,
- * `arguments` objects, and strings, otherwise `null` is returned.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array|null} Returns index keys, else `null`.
- */
-function indexKeys(object) {
- var length = object ? object.length : undefined;
- return (isLength(length) && (isArray(object) || isString(object) || isArguments(object)))
- ? baseTimes(length, String)
- : null;
-}
-
-/** Used as references for various `Number` constants. */
-var MAX_SAFE_INTEGER = 9007199254740991;
-
-/** Used to detect unsigned integer values. */
-var reIsUint = /^(?:0|[1-9]\d*)$/;
-
-/**
- * Checks if `value` is a valid array-like index.
- *
- * @private
- * @param {*} value The value to check.
- * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
- * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
- */
-function isIndex(value, length) {
- value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
- length = length == null ? MAX_SAFE_INTEGER : length;
- return value > -1 && value % 1 == 0 && value < length;
-}
-
-/** Used for built-in method references. */
-var objectProto$1 = Object.prototype;
-
-/**
- * Checks if `value` is likely a prototype object.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
- */
-function isPrototype(value) {
- var Ctor = value && value.constructor,
- proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$1;
-
- return value === proto;
-}
-
-/**
- * Creates an array of the own enumerable property names of `object`.
- *
- * **Note:** Non-object values are coerced to objects. See the
- * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)
- * for more details.
- *
- * @static
- * @memberOf _
- * @category Object
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.keys(new Foo);
- * // => ['a', 'b'] (iteration order is not guaranteed)
- *
- * _.keys('hi');
- * // => ['0', '1']
- */
-function keys(object) {
- var isProto = isPrototype(object);
- if (!(isProto || isArrayLike(object))) {
- return baseKeys(object);
- }
- var indexes = indexKeys(object),
- skipIndexes = !!indexes,
- result = indexes || [],
- length = result.length;
-
- for (var key in object) {
- if (baseHas(object, key) &&
- !(skipIndexes && (key == 'length' || isIndex(key, length))) &&
- !(isProto && key == 'constructor')) {
- result.push(key);
- }
- }
- return result;
-}
-
-function keyIterator(coll) {
- var i = -1;
- var len;
- if (isArrayLike(coll)) {
- len = coll.length;
- return function next() {
- i++;
- return i < len ? i : null;
- };
- } else {
- var okeys = keys(coll);
- len = okeys.length;
- return function next() {
- i++;
- return i < len ? okeys[i] : null;
- };
}
-}
-function onlyOnce(fn) {
- return function () {
- if (fn === null) throw new Error("Callback was already called.");
- fn.apply(this, arguments);
- fn = null;
- };
-}
+ /**
+ * A specialized version of `_.map` for arrays without support for callback
+ * shorthands.
+ *
+ * @private
+ * @param {Array} array The array to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Array} Returns the new mapped array.
+ */
+ function arrayMap(array, iteratee) {
+ var index = -1,
+ length = array.length,
+ result = Array(length);
+
+ while (++index < length) {
+ result[index] = iteratee(array[index], index, array);
+ }
+ return result;
+ }
-var _setImmediate = typeof setImmediate === 'function' && setImmediate;
+ /**
+ * The base implementation of `_.property` without support for deep paths.
+ *
+ * @private
+ * @param {string} key The key of the property to get.
+ * @returns {Function} Returns the new function.
+ */
+ function baseProperty(key) {
+ return function(object) {
+ return object == null ? undefined : object[key];
+ };
+ }
-var _delay;
-if (_setImmediate) {
- _delay = function (fn) {
- // not a direct alias for IE10 compatibility
- _setImmediate(fn);
- };
-} else if (typeof process === 'object' && typeof process.nextTick === 'function') {
- _delay = process.nextTick;
-} else {
- _delay = function (fn) {
- setTimeout(fn, 0);
- };
-}
+ /** Used as references for various `Number` constants. */
+ var INFINITY$1 = 1 / 0;
+
+ /**
+ * Converts `value` to a string if it's not one. An empty string is returned
+ * for `null` and `undefined` values. The sign of `-0` is preserved.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to process.
+ * @returns {string} Returns the string.
+ * @example
+ *
+ * _.toString(null);
+ * // => ''
+ *
+ * _.toString(-0);
+ * // => '-0'
+ *
+ * _.toString([1, 2, 3]);
+ * // => '1,2,3'
+ */
+ function toString(value) {
+ // Exit early for strings to avoid a performance hit in some environments.
+ if (typeof value == 'string') {
+ return value;
+ }
+ var result = value == null ? '' : (value + '');
+ return (result == '0' && (1 / value) == -INFINITY$1) ? '-0' : result;
+ }
-var setImmediate$1 = _delay;
+ /** Used to match property names within property paths. */
+ var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g;
+
+ /** Used to match backslashes in property paths. */
+ var reEscapeChar = /\\(\\)?/g;
+
+ /**
+ * Converts `string` to a property path array.
+ *
+ * @private
+ * @param {string} string The string to convert.
+ * @returns {Array} Returns the property path array.
+ */
+ function stringToPath(string) {
+ var result = [];
+ toString(string).replace(rePropName, function(match, number, quote, string) {
+ result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
+ });
+ return result;
+ }
-function eachOfSeries(obj, iterator, callback) {
- callback = once(callback || noop);
- obj = obj || [];
- var nextKey = keyIterator(obj);
- var key = nextKey();
+ /**
+ * The base implementation of `_.toPath` which only converts `value` to a
+ * path if it's not one.
+ *
+ * @private
+ * @param {*} value The value to process.
+ * @returns {Array} Returns the property path array.
+ */
+ function baseToPath(value) {
+ return isArray(value) ? value : stringToPath(value);
+ }
- function iterate() {
- var sync = true;
- if (key === null) {
- return callback(null);
- }
- iterator(obj[key], key, onlyOnce(function (err) {
- if (err) {
- callback(err);
- } else {
- key = nextKey();
- if (key === null) {
- return callback(null);
- } else {
- if (sync) {
- setImmediate$1(iterate);
- } else {
- iterate();
- }
+ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
+ var reIsPlainProp = /^\w*$/;
+ /**
+ * Checks if `value` is a property name and not a property path.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @param {Object} [object] The object to query keys on.
+ * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
+ */
+ function isKey(value, object) {
+ if (typeof value == 'number') {
+ return true;
+ }
+ return !isArray(value) &&
+ (reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
+ (object != null && value in Object(object)));
+ }
+
+ /**
+ * The base implementation of `_.get` without support for default values.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @param {Array|string} path The path of the property to get.
+ * @returns {*} Returns the resolved value.
+ */
+ function baseGet(object, path) {
+ path = isKey(path, object) ? [path + ''] : baseToPath(path);
+
+ var index = 0,
+ length = path.length;
+
+ while (object != null && index < length) {
+ object = object[path[index++]];
+ }
+ return (index && index == length) ? object : undefined;
+ }
+
+ /**
+ * A specialized version of `baseProperty` which supports deep paths.
+ *
+ * @private
+ * @param {Array|string} path The path of the property to get.
+ * @returns {Function} Returns the new function.
+ */
+ function basePropertyDeep(path) {
+ return function(object) {
+ return baseGet(object, path);
+ };
+ }
+
+ /**
+ * Creates a function that returns the value at `path` of a given object.
+ *
+ * @static
+ * @memberOf _
+ * @category Utility
+ * @param {Array|string} path The path of the property to get.
+ * @returns {Function} Returns the new function.
+ * @example
+ *
+ * var objects = [
+ * { 'a': { 'b': { 'c': 2 } } },
+ * { 'a': { 'b': { 'c': 1 } } }
+ * ];
+ *
+ * _.map(objects, _.property('a.b.c'));
+ * // => [2, 1]
+ *
+ * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c');
+ * // => [1, 2]
+ */
+ function property(path) {
+ return isKey(path) ? baseProperty(path) : basePropertyDeep(path);
+ }
+
+ function _filter(eachfn, arr, iterator, callback) {
+ var results = [];
+ eachfn(arr, function (x, index, callback) {
+ iterator(x, function (v) {
+ if (v) {
+ results.push({ index: index, value: x });
}
- }
- }));
- sync = false;
+ callback();
+ });
+ }, function () {
+ callback(arrayMap(results.sort(function (a, b) {
+ return a.index - b.index;
+ }), property('value')));
+ });
}
- iterate();
-}
-function doSeries(fn) {
- return function (obj, iterator, callback) {
- return fn(eachOfSeries, obj, iterator, callback);
- };
-}
+ /** Used as the `TypeError` message for "Functions" methods. */
+ var FUNC_ERROR_TEXT$1 = 'Expected a function';
+
+ /**
+ * Creates a function that invokes `func`, with the `this` binding and arguments
+ * of the created function, while it's called less than `n` times. Subsequent
+ * calls to the created function return the result of the last `func` invocation.
+ *
+ * @static
+ * @memberOf _
+ * @category Function
+ * @param {number} n The number of calls at which `func` is no longer invoked.
+ * @param {Function} func The function to restrict.
+ * @returns {Function} Returns the new restricted function.
+ * @example
+ *
+ * jQuery(element).on('click', _.before(5, addContactToList));
+ * // => allows adding up to 4 contacts to the list
+ */
+ function before(n, func) {
+ var result;
+ if (typeof func != 'function') {
+ throw new TypeError(FUNC_ERROR_TEXT$1);
+ }
+ n = toInteger(n);
+ return function() {
+ if (--n > 0) {
+ result = func.apply(this, arguments);
+ }
+ if (n <= 1) {
+ func = undefined;
+ }
+ return result;
+ };
+ }
+
+ /**
+ * Creates a function that is restricted to invoking `func` once. Repeat calls
+ * to the function return the value of the first invocation. The `func` is
+ * invoked with the `this` binding and arguments of the created function.
+ *
+ * @static
+ * @memberOf _
+ * @category Function
+ * @param {Function} func The function to restrict.
+ * @returns {Function} Returns the new restricted function.
+ * @example
+ *
+ * var initialize = _.once(createApplication);
+ * initialize();
+ * initialize();
+ * // `initialize` invokes `createApplication` once
+ */
+ function once(func) {
+ return before(2, func);
+ }
+
+ /**
+ * A no-operation function that returns `undefined` regardless of the
+ * arguments it receives.
+ *
+ * @static
+ * @memberOf _
+ * @category Utility
+ * @example
+ *
+ * var object = { 'user': 'fred' };
+ *
+ * _.noop(object) === undefined;
+ * // => true
+ */
+ function noop() {
+ // No operation performed.
+ }
+
+ /**
+ * Gets the "length" property value of `object`.
+ *
+ * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)
+ * that affects Safari on at least iOS 8.1-8.3 ARM64.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @returns {*} Returns the "length" value.
+ */
+ var getLength = baseProperty('length');
+
+ /** Used as references for various `Number` constants. */
+ var MAX_SAFE_INTEGER$1 = 9007199254740991;
+
+ /**
+ * Checks if `value` is a valid array-like length.
+ *
+ * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
+ * @example
+ *
+ * _.isLength(3);
+ * // => true
+ *
+ * _.isLength(Number.MIN_VALUE);
+ * // => false
+ *
+ * _.isLength(Infinity);
+ * // => false
+ *
+ * _.isLength('3');
+ * // => false
+ */
+ function isLength(value) {
+ return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$1;
+ }
+
+ /**
+ * Checks if `value` is array-like. A value is considered array-like if it's
+ * not a function and has a `value.length` that's an integer greater than or
+ * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
+ *
+ * @static
+ * @memberOf _
+ * @type Function
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
+ * @example
+ *
+ * _.isArrayLike([1, 2, 3]);
+ * // => true
+ *
+ * _.isArrayLike(document.body.children);
+ * // => true
+ *
+ * _.isArrayLike('abc');
+ * // => true
+ *
+ * _.isArrayLike(_.noop);
+ * // => false
+ */
+ function isArrayLike(value) {
+ return value != null &&
+ !(typeof value == 'function' && isFunction(value)) && isLength(getLength(value));
+ }
+
+ /** Used for built-in method references. */
+ var objectProto = Object.prototype;
+
+ /** Used to check objects for own properties. */
+ var hasOwnProperty = objectProto.hasOwnProperty;
+
+ /** Built-in value references. */
+ var getPrototypeOf = Object.getPrototypeOf;
+
+ /**
+ * The base implementation of `_.has` without support for deep paths.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @param {Array|string} key The key to check.
+ * @returns {boolean} Returns `true` if `key` exists, else `false`.
+ */
+ function baseHas(object, key) {
+ // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`,
+ // that are composed entirely of index properties, return `false` for
+ // `hasOwnProperty` checks of them.
+ return hasOwnProperty.call(object, key) ||
+ (typeof object == 'object' && key in object && getPrototypeOf(object) === null);
+ }
-var filterSeries = doSeries(_filter);
+ /* Built-in method references for those with the same name as other `lodash` methods. */
+ var nativeKeys = Object.keys;
+
+ /**
+ * The base implementation of `_.keys` which doesn't skip the constructor
+ * property of prototypes or treat sparse arrays as dense.
+ *
+ * @private
+ * @type Function
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the array of property names.
+ */
+ function baseKeys(object) {
+ return nativeKeys(Object(object));
+ }
-function _eachOfLimit(limit) {
- return function (obj, iterator, callback) {
+ /**
+ * The base implementation of `_.times` without support for callback shorthands
+ * or max array length checks.
+ *
+ * @private
+ * @param {number} n The number of times to invoke `iteratee`.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Array} Returns the array of results.
+ */
+ function baseTimes(n, iteratee) {
+ var index = -1,
+ result = Array(n);
+
+ while (++index < n) {
+ result[index] = iteratee(index);
+ }
+ return result;
+ }
+
+ /**
+ * This method is like `_.isArrayLike` except that it also checks if `value`
+ * is an object.
+ *
+ * @static
+ * @memberOf _
+ * @type Function
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`.
+ * @example
+ *
+ * _.isArrayLikeObject([1, 2, 3]);
+ * // => true
+ *
+ * _.isArrayLikeObject(document.body.children);
+ * // => true
+ *
+ * _.isArrayLikeObject('abc');
+ * // => false
+ *
+ * _.isArrayLikeObject(_.noop);
+ * // => false
+ */
+ function isArrayLikeObject(value) {
+ return isObjectLike(value) && isArrayLike(value);
+ }
+
+ /** `Object#toString` result references. */
+ var argsTag = '[object Arguments]';
+
+ /** Used for built-in method references. */
+ var objectProto$4 = Object.prototype;
+
+ /** Used to check objects for own properties. */
+ var hasOwnProperty$1 = objectProto$4.hasOwnProperty;
+
+ /**
+ * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
+ * of values.
+ */
+ var objectToString$2 = objectProto$4.toString;
+
+ /** Built-in value references. */
+ var propertyIsEnumerable = objectProto$4.propertyIsEnumerable;
+
+ /**
+ * Checks if `value` is likely an `arguments` object.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @example
+ *
+ * _.isArguments(function() { return arguments; }());
+ * // => true
+ *
+ * _.isArguments([1, 2, 3]);
+ * // => false
+ */
+ function isArguments(value) {
+ // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode.
+ return isArrayLikeObject(value) && hasOwnProperty$1.call(value, 'callee') &&
+ (!propertyIsEnumerable.call(value, 'callee') || objectToString$2.call(value) == argsTag);
+ }
+
+ /**
+ * Creates an array of index keys for `object` values of arrays,
+ * `arguments` objects, and strings, otherwise `null` is returned.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @returns {Array|null} Returns index keys, else `null`.
+ */
+ function indexKeys(object) {
+ var length = object ? object.length : undefined;
+ return (isLength(length) && (isArray(object) || isString(object) || isArguments(object)))
+ ? baseTimes(length, String)
+ : null;
+ }
+
+ /** Used as references for various `Number` constants. */
+ var MAX_SAFE_INTEGER = 9007199254740991;
+
+ /** Used to detect unsigned integer values. */
+ var reIsUint = /^(?:0|[1-9]\d*)$/;
+
+ /**
+ * Checks if `value` is a valid array-like index.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
+ * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
+ */
+ function isIndex(value, length) {
+ value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
+ length = length == null ? MAX_SAFE_INTEGER : length;
+ return value > -1 && value % 1 == 0 && value < length;
+ }
+
+ /** Used for built-in method references. */
+ var objectProto$1 = Object.prototype;
+
+ /**
+ * Checks if `value` is likely a prototype object.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
+ */
+ function isPrototype(value) {
+ var Ctor = value && value.constructor,
+ proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$1;
+
+ return value === proto;
+ }
+
+ /**
+ * Creates an array of the own enumerable property names of `object`.
+ *
+ * **Note:** Non-object values are coerced to objects. See the
+ * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)
+ * for more details.
+ *
+ * @static
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the array of property names.
+ * @example
+ *
+ * function Foo() {
+ * this.a = 1;
+ * this.b = 2;
+ * }
+ *
+ * Foo.prototype.c = 3;
+ *
+ * _.keys(new Foo);
+ * // => ['a', 'b'] (iteration order is not guaranteed)
+ *
+ * _.keys('hi');
+ * // => ['0', '1']
+ */
+ function keys(object) {
+ var isProto = isPrototype(object);
+ if (!(isProto || isArrayLike(object))) {
+ return baseKeys(object);
+ }
+ var indexes = indexKeys(object),
+ skipIndexes = !!indexes,
+ result = indexes || [],
+ length = result.length;
+
+ for (var key in object) {
+ if (baseHas(object, key) &&
+ !(skipIndexes && (key == 'length' || isIndex(key, length))) &&
+ !(isProto && key == 'constructor')) {
+ result.push(key);
+ }
+ }
+ return result;
+ }
+
+ function keyIterator(coll) {
+ var i = -1;
+ var len;
+ if (isArrayLike(coll)) {
+ len = coll.length;
+ return function next() {
+ i++;
+ return i < len ? i : null;
+ };
+ } else {
+ var okeys = keys(coll);
+ len = okeys.length;
+ return function next() {
+ i++;
+ return i < len ? okeys[i] : null;
+ };
+ }
+ }
+
+ function onlyOnce(fn) {
+ return function () {
+ if (fn === null) throw new Error("Callback was already called.");
+ fn.apply(this, arguments);
+ fn = null;
+ };
+ }
+
+ var _setImmediate = typeof setImmediate === 'function' && setImmediate;
+
+ var _delay;
+ if (_setImmediate) {
+ _delay = function (fn) {
+ // not a direct alias for IE10 compatibility
+ _setImmediate(fn);
+ };
+ } else if (typeof process === 'object' && typeof process.nextTick === 'function') {
+ _delay = process.nextTick;
+ } else {
+ _delay = function (fn) {
+ setTimeout(fn, 0);
+ };
+ }
+
+ var setImmediate$1 = _delay;
+
+ function eachOfSeries(obj, iterator, callback) {
callback = once(callback || noop);
obj = obj || [];
var nextKey = keyIterator(obj);
- if (limit <= 0) {
- return callback(null);
+ var key = nextKey();
+
+ function iterate() {
+ var sync = true;
+ if (key === null) {
+ return callback(null);
+ }
+ iterator(obj[key], key, onlyOnce(function (err) {
+ if (err) {
+ callback(err);
+ } else {
+ key = nextKey();
+ if (key === null) {
+ return callback(null);
+ } else {
+ if (sync) {
+ setImmediate$1(iterate);
+ } else {
+ iterate();
+ }
+ }
+ }
+ }));
+ sync = false;
}
- var done = false;
- var running = 0;
- var errored = false;
+ iterate();
+ }
+
+ function doSeries(fn) {
+ return function (obj, iterator, callback) {
+ return fn(eachOfSeries, obj, iterator, callback);
+ };
+ }
+
+ var filterSeries = doSeries(_filter);
- (function replenish() {
- if (done && running <= 0) {
+ function _eachOfLimit(limit) {
+ return function (obj, iterator, callback) {
+ callback = once(callback || noop);
+ obj = obj || [];
+ var nextKey = keyIterator(obj);
+ if (limit <= 0) {
return callback(null);
}
+ var done = false;
+ var running = 0;
+ var errored = false;
- while (running < limit && !errored) {
- var key = nextKey();
- if (key === null) {
- done = true;
- if (running <= 0) {
- callback(null);
- }
- return;
+ (function replenish() {
+ if (done && running <= 0) {
+ return callback(null);
}
- running += 1;
- iterator(obj[key], key, onlyOnce(function (err) {
- running -= 1;
- if (err) {
- callback(err);
- errored = true;
- } else {
- replenish();
+
+ while (running < limit && !errored) {
+ var key = nextKey();
+ if (key === null) {
+ done = true;
+ if (running <= 0) {
+ callback(null);
+ }
+ return;
}
- }));
+ running += 1;
+ iterator(obj[key], key, onlyOnce(function (err) {
+ running -= 1;
+ if (err) {
+ callback(err);
+ errored = true;
+ } else {
+ replenish();
+ }
+ }));
+ }
+ })();
+ };
+ }
+
+ function doParallelLimit(fn) {
+ return function (obj, limit, iterator, callback) {
+ return fn(_eachOfLimit(limit), obj, iterator, callback);
+ };
+ }
+
+ var filterLimit = doParallelLimit(_filter);
+
+ function eachOf(object, iterator, callback) {
+ callback = once(callback || noop);
+ object = object || [];
+
+ var iter = keyIterator(object);
+ var key,
+ completed = 0;
+
+ while ((key = iter()) != null) {
+ completed += 1;
+ iterator(object[key], key, onlyOnce(done));
+ }
+
+ if (completed === 0) callback(null);
+
+ function done(err) {
+ completed--;
+ if (err) {
+ callback(err);
}
- })();
- };
-}
+ // Check key is null in case iterator isn't exhausted
+ // and done resolved synchronously.
+ else if (key === null && completed <= 0) {
+ callback(null);
+ }
+ }
+ }
-function doParallelLimit(fn) {
- return function (obj, limit, iterator, callback) {
- return fn(_eachOfLimit(limit), obj, iterator, callback);
- };
-}
+ function doParallel(fn) {
+ return function (obj, iterator, callback) {
+ return fn(eachOf, obj, iterator, callback);
+ };
+ }
-var filterLimit = doParallelLimit(_filter);
+ var filter = doParallel(_filter);
+
+ /** Built-in value references. */
+ var Symbol = root.Symbol;
+
+ /**
+ * Copies the values of `source` to `array`.
+ *
+ * @private
+ * @param {Array} source The array to copy values from.
+ * @param {Array} [array=[]] The array to copy values to.
+ * @returns {Array} Returns `array`.
+ */
+ function copyArray(source, array) {
+ var index = -1,
+ length = source.length;
+
+ array || (array = Array(length));
+ while (++index < length) {
+ array[index] = source[index];
+ }
+ return array;
+ }
-function eachOf(object, iterator, callback) {
- callback = once(callback || noop);
- object = object || [];
+ /**
+ * Checks if `value` is a host object in IE < 9.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
+ */
+ function isHostObject(value) {
+ // Many host objects are `Object` objects that can coerce to strings
+ // despite having improperly defined `toString` methods.
+ var result = false;
+ if (value != null && typeof value.toString != 'function') {
+ try {
+ result = !!(value + '');
+ } catch (e) {}
+ }
+ return result;
+ }
- var iter = keyIterator(object);
- var key,
- completed = 0;
+ /** Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). */
+ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
+
+ /** Used to detect host constructors (Safari > 5). */
+ var reIsHostCtor = /^\[object .+?Constructor\]$/;
+
+ /** Used for built-in method references. */
+ var objectProto$6 = Object.prototype;
+
+ /** Used to resolve the decompiled source of functions. */
+ var funcToString$1 = Function.prototype.toString;
+
+ /** Used to check objects for own properties. */
+ var hasOwnProperty$2 = objectProto$6.hasOwnProperty;
+
+ /** Used to detect if a method is native. */
+ var reIsNative = RegExp('^' +
+ funcToString$1.call(hasOwnProperty$2).replace(reRegExpChar, '\\$&')
+ .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
+ );
+
+ /**
+ * Checks if `value` is a native function.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a native function, else `false`.
+ * @example
+ *
+ * _.isNative(Array.prototype.push);
+ * // => true
+ *
+ * _.isNative(_);
+ * // => false
+ */
+ function isNative(value) {
+ if (value == null) {
+ return false;
+ }
+ if (isFunction(value)) {
+ return reIsNative.test(funcToString$1.call(value));
+ }
+ return isObjectLike(value) &&
+ (isHostObject(value) ? reIsNative : reIsHostCtor).test(value);
+ }
- while ((key = iter()) != null) {
- completed += 1;
- iterator(object[key], key, onlyOnce(done));
+ /**
+ * Gets the native function at `key` of `object`.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @param {string} key The key of the method to get.
+ * @returns {*} Returns the function if it's native, else `undefined`.
+ */
+ function getNative(object, key) {
+ var value = object == null ? undefined : object[key];
+ return isNative(value) ? value : undefined;
}
- if (completed === 0) callback(null);
+ /* Built-in method references that are verified to be native. */
+ var Map = getNative(root, 'Map');
+
+ /* Built-in method references that are verified to be native. */
+ var Set = getNative(root, 'Set');
+
+ var mapTag$1 = '[object Map]';
+ var objectTag = '[object Object]';
+ var setTag$1 = '[object Set]';
+ /** Used for built-in method references. */
+ var objectProto$2 = Object.prototype;
+
+ /** Used to resolve the decompiled source of functions. */
+ var funcToString = Function.prototype.toString;
+
+ /**
+ * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
+ * of values.
+ */
+ var objectToString = objectProto$2.toString;
+
+ /** Used to detect maps and sets. */
+ var mapCtorString = Map ? funcToString.call(Map) : '';
+ var setCtorString = Set ? funcToString.call(Set) : '';
+ /**
+ * Gets the `toStringTag` of `value`.
+ *
+ * @private
+ * @param {*} value The value to query.
+ * @returns {string} Returns the `toStringTag`.
+ */
+ function getTag(value) {
+ return objectToString.call(value);
+ }
- function done(err) {
- completed--;
- if (err) {
- callback(err);
+ // Fallback for IE 11 providing `toStringTag` values for maps and sets.
+ if ((Map && getTag(new Map) != mapTag$1) || (Set && getTag(new Set) != setTag$1)) {
+ getTag = function(value) {
+ var result = objectToString.call(value),
+ Ctor = result == objectTag ? value.constructor : null,
+ ctorString = typeof Ctor == 'function' ? funcToString.call(Ctor) : '';
+
+ if (ctorString) {
+ if (ctorString == mapCtorString) {
+ return mapTag$1;
+ }
+ if (ctorString == setCtorString) {
+ return setTag$1;
+ }
}
- // Check key is null in case iterator isn't exhausted
- // and done resolved synchronously.
- else if (key === null && completed <= 0) {
- callback(null);
- }
+ return result;
+ };
}
-}
-function doParallel(fn) {
- return function (obj, iterator, callback) {
- return fn(eachOf, obj, iterator, callback);
- };
-}
-
-var filter = doParallel(_filter);
-
-/**
- * Copies the values of `source` to `array`.
- *
- * @private
- * @param {Array} source The array to copy values from.
- * @param {Array} [array=[]] The array to copy values to.
- * @returns {Array} Returns `array`.
- */
-function copyArray(source, array) {
- var index = -1,
- length = source.length;
-
- array || (array = Array(length));
- while (++index < length) {
- array[index] = source[index];
- }
- return array;
-}
-
-/**
- * Checks if `value` is a host object in IE < 9.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
- */
-function isHostObject(value) {
- // Many host objects are `Object` objects that can coerce to strings
- // despite having improperly defined `toString` methods.
- var result = false;
- if (value != null && typeof value.toString != 'function') {
- try {
- result = !!(value + '');
- } catch (e) {}
- }
- return result;
-}
-
-/** Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). */
-var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
-
-/** Used to detect host constructors (Safari > 5). */
-var reIsHostCtor = /^\[object .+?Constructor\]$/;
-
-/** Used for built-in method references. */
-var objectProto$6 = Object.prototype;
-
-/** Used to resolve the decompiled source of functions. */
-var fnToString$1 = Function.prototype.toString;
-
-/** Used to check objects for own properties. */
-var hasOwnProperty$2 = objectProto$6.hasOwnProperty;
-
-/** Used to detect if a method is native. */
-var reIsNative = RegExp('^' +
- fnToString$1.call(hasOwnProperty$2).replace(reRegExpChar, '\\$&')
- .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
-);
-
-/**
- * Checks if `value` is a native function.
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a native function, else `false`.
- * @example
- *
- * _.isNative(Array.prototype.push);
- * // => true
- *
- * _.isNative(_);
- * // => false
- */
-function isNative(value) {
- if (value == null) {
- return false;
- }
- if (isFunction(value)) {
- return reIsNative.test(fnToString$1.call(value));
- }
- return isObjectLike(value) &&
- (isHostObject(value) ? reIsNative : reIsHostCtor).test(value);
-}
-
-/**
- * Gets the native function at `key` of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {string} key The key of the method to get.
- * @returns {*} Returns the function if it's native, else `undefined`.
- */
-function getNative(object, key) {
- var value = object == null ? undefined : object[key];
- return isNative(value) ? value : undefined;
-}
-
-/* Built-in method references that are verified to be native. */
-var Map = getNative(root, 'Map');
-
-/* Built-in method references that are verified to be native. */
-var Set = getNative(root, 'Set');
-
-var mapTag$1 = '[object Map]';
-var objectTag = '[object Object]';
-var setTag$1 = '[object Set]';
-/** Used for built-in method references. */
-var objectProto$2 = Object.prototype;
-
-/** Used to resolve the decompiled source of functions. */
-var fnToString = Function.prototype.toString;
-
-/**
- * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
- * of values.
- */
-var objToString = objectProto$2.toString;
-
-/** Used to detect maps and sets. */
-var mapCtorString = Map ? fnToString.call(Map) : '';
-var setCtorString = Set ? fnToString.call(Set) : '';
-/**
- * Gets the `toStringTag` of `value`.
- *
- * @private
- * @param {*} value The value to query.
- * @returns {string} Returns the `toStringTag`.
- */
-function getTag(value) {
- return objToString.call(value);
-}
-
-// Fallback for IE 11 providing `toStringTag` values for maps and sets.
-if ((Map && getTag(new Map) != mapTag$1) || (Set && getTag(new Set) != setTag$1)) {
- getTag = function(value) {
- var result = objToString.call(value),
- Ctor = result == objectTag ? value.constructor : null,
- ctorString = typeof Ctor == 'function' ? fnToString.call(Ctor) : '';
-
- if (ctorString) {
- if (ctorString == mapCtorString) {
- return mapTag$1;
+ var getTag$1 = getTag;
+
+ /**
+ * Converts `iterator` to an array.
+ *
+ * @private
+ * @param {Object} iterator The iterator to convert.
+ * @returns {Array} Returns the converted array.
+ */
+ function iteratorToArray(iterator) {
+ var data,
+ result = [];
+
+ while (!(data = iterator.next()).done) {
+ result.push(data.value);
}
- if (ctorString == setCtorString) {
- return setTag$1;
+ return result;
+ }
+
+ /**
+ * Converts `map` to an array.
+ *
+ * @private
+ * @param {Object} map The map to convert.
+ * @returns {Array} Returns the converted array.
+ */
+ function mapToArray(map) {
+ var index = -1,
+ result = Array(map.size);
+
+ map.forEach(function(value, key) {
+ result[++index] = [key, value];
+ });
+ return result;
+ }
+
+ /**
+ * Converts `set` to an array.
+ *
+ * @private
+ * @param {Object} set The set to convert.
+ * @returns {Array} Returns the converted array.
+ */
+ function setToArray(set) {
+ var index = -1,
+ result = Array(set.size);
+
+ set.forEach(function(value) {
+ result[++index] = value;
+ });
+ return result;
+ }
+
+ /** Used to compose unicode character classes. */
+ var rsAstralRange = '\\ud800-\\udfff';
+ var rsComboRange = '\\u0300-\\u036f\\ufe20-\\ufe23';
+ var rsVarRange = '\\ufe0e\\ufe0f';
+ var rsAstral = '[' + rsAstralRange + ']';
+ var rsCombo = '[' + rsComboRange + ']';
+ var rsModifier = '(?:\\ud83c[\\udffb-\\udfff])';
+ var rsNonAstral = '[^' + rsAstralRange + ']';
+ var rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}';
+ var rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]';
+ var rsZWJ = '\\u200d';
+ var reOptMod = rsModifier + '?';
+ var rsOptVar = '[' + rsVarRange + ']?';
+ var rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*';
+ var rsSeq = rsOptVar + reOptMod + rsOptJoin;
+ var rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
+ /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
+ var reComplexSymbol = RegExp(rsSymbol + rsSeq, 'g');
+
+ /**
+ * Converts `string` to an array.
+ *
+ * @private
+ * @param {string} string The string to convert.
+ * @returns {Array} Returns the converted array.
+ */
+ function stringToArray(string) {
+ return string ? string.match(reComplexSymbol) : [];
+ }
+
+ /**
+ * The base implementation of `_.values` and `_.valuesIn` which creates an
+ * array of `object` property values corresponding to the property names
+ * of `props`.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @param {Array} props The property names to get values for.
+ * @returns {Object} Returns the array of property values.
+ */
+ function baseValues(object, props) {
+ return arrayMap(props, function(key) {
+ return object[key];
+ });
+ }
+
+ /**
+ * Creates an array of the own enumerable property values of `object`.
+ *
+ * **Note:** Non-object values are coerced to objects.
+ *
+ * @static
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the array of property values.
+ * @example
+ *
+ * function Foo() {
+ * this.a = 1;
+ * this.b = 2;
+ * }
+ *
+ * Foo.prototype.c = 3;
+ *
+ * _.values(new Foo);
+ * // => [1, 2] (iteration order is not guaranteed)
+ *
+ * _.values('hi');
+ * // => ['h', 'i']
+ */
+ function values(object) {
+ return object ? baseValues(object, keys(object)) : [];
+ }
+
+ var mapTag = '[object Map]';
+ var setTag = '[object Set]';
+ /** Built-in value references. */
+ var iteratorSymbol = typeof (iteratorSymbol = Symbol && Symbol.iterator) == 'symbol' ? iteratorSymbol : undefined;
+
+ /**
+ * Converts `value` to an array.
+ *
+ * @static
+ * @memberOf _
+ * @category Lang
+ * @param {*} value The value to convert.
+ * @returns {Array} Returns the converted array.
+ * @example
+ *
+ * (function() {
+ * return _.toArray(arguments).slice(1);
+ * }(1, 2, 3));
+ * // => [2, 3]
+ */
+ function toArray(value) {
+ if (!value) {
+ return [];
+ }
+ if (isArrayLike(value)) {
+ return isString(value) ? stringToArray(value) : copyArray(value);
+ }
+ if (iteratorSymbol && value[iteratorSymbol]) {
+ return iteratorToArray(value[iteratorSymbol]());
}
+ var tag = getTag$1(value),
+ func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
+
+ return func(value);
}
- return result;
- };
-}
-
-var getTag$1 = getTag;
-
-/**
- * Converts `iterator` to an array.
- *
- * @private
- * @param {Object} iterator The iterator to convert.
- * @returns {Array} Returns the converted array.
- */
-function iteratorToArray(iterator) {
- var data,
- result = [];
-
- while (!(data = iterator.next()).done) {
- result.push(data.value);
- }
- return result;
-}
-
-/**
- * Converts `map` to an array.
- *
- * @private
- * @param {Object} map The map to convert.
- * @returns {Array} Returns the converted array.
- */
-function mapToArray(map) {
- var index = -1,
- result = Array(map.size);
-
- map.forEach(function(value, key) {
- result[++index] = [key, value];
- });
- return result;
-}
-
-/**
- * Converts `set` to an array.
- *
- * @private
- * @param {Object} set The set to convert.
- * @returns {Array} Returns the converted array.
- */
-function setToArray(set) {
- var index = -1,
- result = Array(set.size);
-
- set.forEach(function(value) {
- result[++index] = value;
- });
- return result;
-}
-
-/** Used to compose unicode character classes. */
-var rsAstralRange = '\\ud800-\\udfff';
-var rsComboRange = '\\u0300-\\u036f\\ufe20-\\ufe23';
-var rsVarRange = '\\ufe0e\\ufe0f';
-var rsAstral = '[' + rsAstralRange + ']';
-var rsCombo = '[' + rsComboRange + ']';
-var rsModifier = '(?:\\ud83c[\\udffb-\\udfff])';
-var rsNonAstral = '[^' + rsAstralRange + ']';
-var rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}';
-var rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]';
-var rsZWJ = '\\u200d';
-var reOptMod = rsModifier + '?';
-var rsOptVar = '[' + rsVarRange + ']?';
-var rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*';
-var rsSeq = rsOptVar + reOptMod + rsOptJoin;
-var rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
-/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
-var reComplexSymbol = RegExp(rsSymbol + rsSeq, 'g');
-
-/**
- * Converts `string` to an array.
- *
- * @private
- * @param {string} string The string to convert.
- * @returns {Array} Returns the converted array.
- */
-function stringToArray(string) {
- return string ? string.match(reComplexSymbol) : [];
-}
-
-/**
- * The base implementation of `_.values` and `_.valuesIn` which creates an
- * array of `object` property values corresponding to the property names
- * of `props`.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {Array} props The property names to get values for.
- * @returns {Object} Returns the array of property values.
- */
-function baseValues(object, props) {
- return arrayMap(props, function(key) {
- return object[key];
- });
-}
-
-/**
- * Creates an array of the own enumerable property values of `object`.
- *
- * **Note:** Non-object values are coerced to objects.
- *
- * @static
- * @memberOf _
- * @category Object
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property values.
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.values(new Foo);
- * // => [1, 2] (iteration order is not guaranteed)
- *
- * _.values('hi');
- * // => ['h', 'i']
- */
-function values(object) {
- return object ? baseValues(object, keys(object)) : [];
-}
-
-var mapTag = '[object Map]';
-var setTag = '[object Set]';
-var Symbol = root.Symbol;
-var iteratorSymbol = typeof (iteratorSymbol = Symbol && Symbol.iterator) == 'symbol' ? iteratorSymbol : undefined;
-/**
- * Converts `value` to an array.
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to convert.
- * @returns {Array} Returns the converted array.
- * @example
- *
- * (function() {
- * return _.toArray(arguments).slice(1);
- * }(1, 2, 3));
- * // => [2, 3]
- */
-function toArray(value) {
- if (!value) {
- return [];
- }
- if (isArrayLike(value)) {
- return isString(value) ? stringToArray(value) : copyArray(value);
- }
- if (iteratorSymbol && value[iteratorSymbol]) {
- return iteratorToArray(value[iteratorSymbol]());
- }
- var tag = getTag$1(value),
- func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
-
- return func(value);
-}
-
-function reduce(arr, memo, iterator, cb) {
- eachOfSeries(arr, function (x, i, cb) {
- iterator(memo, x, function (err, v) {
- memo = v;
- cb(err);
+
+ function reduce(arr, memo, iterator, cb) {
+ eachOfSeries(arr, function (x, i, cb) {
+ iterator(memo, x, function (err, v) {
+ memo = v;
+ cb(err);
+ });
+ }, function (err) {
+ cb(err, memo);
});
- }, function (err) {
- cb(err, memo);
- });
-}
+ }
-function reduceRight(arr, memo, iterator, cb) {
- var reversed = toArray(arr).reverse();
- reduce(reversed, memo, iterator, cb);
-}
+ function reduceRight(arr, memo, iterator, cb) {
+ var reversed = toArray(arr).reverse();
+ reduce(reversed, memo, iterator, cb);
+ }
-function eachOfLimit(obj, limit, iterator, cb) {
- _eachOfLimit(limit)(obj, iterator, cb);
-}
+ function eachOfLimit(obj, limit, iterator, cb) {
+ _eachOfLimit(limit)(obj, iterator, cb);
+ }
-function _withoutIndex(iterator) {
- return function (value, index, callback) {
- return iterator(value, callback);
- };
-}
-
-function eachLimit(arr, limit, iterator, cb) {
- return _eachOfLimit(limit)(arr, _withoutIndex(iterator), cb);
-}
-
-function eachSeries(arr, iterator, cb) {
- return eachOfSeries(arr, _withoutIndex(iterator), cb);
-}
-
-function each(arr, iterator, cb) {
- return eachOf(arr, _withoutIndex(iterator), cb);
-}
-
-/**
- * This method returns the first argument provided to it.
- *
- * @static
- * @memberOf _
- * @category Utility
- * @param {*} value Any value.
- * @returns {*} Returns `value`.
- * @example
- *
- * var object = { 'user': 'fred' };
- *
- * _.identity(object) === object;
- * // => true
- */
-function identity(value) {
- return value;
-}
-
-function _createTester(eachfn, check, getResult) {
- return function (arr, limit, iterator, cb) {
- function done() {
- if (cb) cb(getResult(false, void 0));
- }
- function iteratee(x, _, callback) {
- if (!cb) return callback();
- iterator(x, function (v) {
- if (cb && check(v)) {
- cb(getResult(true, x));
- cb = iterator = false;
- }
- callback();
- });
- }
- if (arguments.length > 3) {
- eachfn(arr, limit, iteratee, done);
- } else {
- cb = iterator;
- iterator = limit;
- eachfn(arr, iteratee, done);
- }
- };
-}
+ function _withoutIndex(iterator) {
+ return function (value, index, callback) {
+ return iterator(value, callback);
+ };
+ }
+
+ function eachLimit(arr, limit, iterator, cb) {
+ return _eachOfLimit(limit)(arr, _withoutIndex(iterator), cb);
+ }
-var some = _createTester(eachOf, Boolean, identity);
+ function eachSeries(arr, iterator, cb) {
+ return eachOfSeries(arr, _withoutIndex(iterator), cb);
+ }
-function notId(v) {
- return !v;
-}
+ function each(arr, iterator, cb) {
+ return eachOf(arr, _withoutIndex(iterator), cb);
+ }
-var every = _createTester(eachOf, notId, notId);
+ /**
+ * This method returns the first argument provided to it.
+ *
+ * @static
+ * @memberOf _
+ * @category Utility
+ * @param {*} value Any value.
+ * @returns {*} Returns `value`.
+ * @example
+ *
+ * var object = { 'user': 'fred' };
+ *
+ * _.identity(object) === object;
+ * // => true
+ */
+ function identity(value) {
+ return value;
+ }
-function whilst(test, iterator, cb) {
- cb = cb || noop;
- if (!test()) return cb(null);
- var next = rest(function (err, args) {
- if (err) return cb(err);
- if (test.apply(this, args)) return iterator(next);
- cb.apply(null, [null].concat(args));
- });
- iterator(next);
-}
-
-function ensureAsync(fn) {
- return rest(function (args) {
- var callback = args.pop();
- args.push(function () {
- var innerArgs = arguments;
- if (sync) {
- setImmediate$1(function () {
- callback.apply(null, innerArgs);
+ function _createTester(eachfn, check, getResult) {
+ return function (arr, limit, iterator, cb) {
+ function done() {
+ if (cb) cb(getResult(false, void 0));
+ }
+ function iteratee(x, _, callback) {
+ if (!cb) return callback();
+ iterator(x, function (v) {
+ if (cb && check(v)) {
+ cb(getResult(true, x));
+ cb = iterator = false;
+ }
+ callback();
});
+ }
+ if (arguments.length > 3) {
+ eachfn(arr, limit, iteratee, done);
} else {
- callback.apply(null, innerArgs);
+ cb = iterator;
+ iterator = limit;
+ eachfn(arr, iteratee, done);
}
+ };
+ }
+
+ var some = _createTester(eachOf, Boolean, identity);
+
+ function notId(v) {
+ return !v;
+ }
+
+ var every = _createTester(eachOf, notId, notId);
+
+ function whilst(test, iterator, cb) {
+ cb = cb || noop;
+ if (!test()) return cb(null);
+ var next = rest(function (err, args) {
+ if (err) return cb(err);
+ if (test.apply(this, args)) return iterator(next);
+ cb.apply(null, [null].concat(args));
});
- var sync = true;
- fn.apply(this, args);
- sync = false;
- });
-}
+ iterator(next);
+ }
+
+ function ensureAsync(fn) {
+ return rest(function (args) {
+ var callback = args.pop();
+ args.push(function () {
+ var innerArgs = arguments;
+ if (sync) {
+ setImmediate$1(function () {
+ callback.apply(null, innerArgs);
+ });
+ } else {
+ callback.apply(null, innerArgs);
+ }
+ });
+ var sync = true;
+ fn.apply(this, args);
+ sync = false;
+ });
+ }
-function iterator (tasks) {
- function makeCallback(index) {
- function fn() {
- if (tasks.length) {
- tasks[index].apply(null, arguments);
+ function iterator (tasks) {
+ function makeCallback(index) {
+ function fn() {
+ if (tasks.length) {
+ tasks[index].apply(null, arguments);
+ }
+ return fn.next();
}
- return fn.next();
+ fn.next = function () {
+ return index < tasks.length - 1 ? makeCallback(index + 1) : null;
+ };
+ return fn;
}
- fn.next = function () {
- return index < tasks.length - 1 ? makeCallback(index + 1) : null;
- };
- return fn;
+ return makeCallback(0);
}
- return makeCallback(0);
-}
-function waterfall (tasks, cb) {
- cb = once(cb || noop);
- if (!isArray(tasks)) return cb(new Error('First argument to waterfall must be an array of functions'));
- if (!tasks.length) return cb();
+ function waterfall (tasks, cb) {
+ cb = once(cb || noop);
+ if (!isArray(tasks)) return cb(new Error('First argument to waterfall must be an array of functions'));
+ if (!tasks.length) return cb();
- function wrapIterator(iterator) {
- return rest(function (err, args) {
- if (err) {
- cb.apply(null, [err].concat(args));
- } else {
- var next = iterator.next();
- if (next) {
- args.push(wrapIterator(next));
+ function wrapIterator(iterator) {
+ return rest(function (err, args) {
+ if (err) {
+ cb.apply(null, [err].concat(args));
} else {
- args.push(cb);
+ var next = iterator.next();
+ if (next) {
+ args.push(wrapIterator(next));
+ } else {
+ args.push(cb);
+ }
+ ensureAsync(iterator).apply(null, args);
}
- ensureAsync(iterator).apply(null, args);
- }
- });
+ });
+ }
+ wrapIterator(iterator(tasks))();
}
- wrapIterator(iterator(tasks))();
-}
-
-function until(test, iterator, cb) {
- return whilst(function () {
- return !test.apply(this, arguments);
- }, iterator, cb);
-}
-function unmemoize(fn) {
- return function () {
- return (fn.unmemoized || fn).apply(null, arguments);
- };
-}
+ function until(test, iterator, cb) {
+ return whilst(function () {
+ return !test.apply(this, arguments);
+ }, iterator, cb);
+ }
-function transform(arr, memo, iterator, callback) {
- if (arguments.length === 3) {
- callback = iterator;
- iterator = memo;
- memo = isArray(arr) ? [] : {};
+ function unmemoize(fn) {
+ return function () {
+ return (fn.unmemoized || fn).apply(null, arguments);
+ };
}
- eachOf(arr, function (v, k, cb) {
- iterator(memo, v, k, cb);
- }, function (err) {
- callback(err, memo);
- });
-}
-
-function _asyncMap(eachfn, arr, iterator, callback) {
- callback = once(callback || noop);
- arr = arr || [];
- var results = isArrayLike(arr) ? [] : {};
- eachfn(arr, function (value, index, callback) {
- iterator(value, function (err, v) {
- results[index] = v;
- callback(err);
+ function transform(arr, memo, iterator, callback) {
+ if (arguments.length === 3) {
+ callback = iterator;
+ iterator = memo;
+ memo = isArray(arr) ? [] : {};
+ }
+
+ eachOf(arr, function (v, k, cb) {
+ iterator(memo, v, k, cb);
+ }, function (err) {
+ callback(err, memo);
});
- }, function (err) {
- callback(err, results);
- });
-}
-
-var mapSeries = doSeries(_asyncMap);
-
-var nativeCeil = Math.ceil;
-var nativeMax$2 = Math.max;
-/**
- * The base implementation of `_.range` and `_.rangeRight`.
- *
- * @private
- * @param {number} [start=0] The start of the range.
- * @param {number} end The end of the range.
- * @param {number} [step=1] The value to increment or decrement by.
- * @param {boolean} [fromRight] Specify iterating from right to left.
- * @returns {Array} Returns the new array of numbers.
- */
-function baseRange(start, end, step, fromRight) {
- start = toNumber(start);
- start = start === start ? start : 0;
-
- if (end === undefined) {
- end = start;
- start = 0;
- } else {
- end = toNumber(end) || 0;
- }
- step = step === undefined ? (start < end ? 1 : -1) : (toNumber(step) || 0);
-
- var index = -1,
- length = nativeMax$2(nativeCeil((end - start) / (step || 1)), 0),
- result = Array(length);
-
- while (length--) {
- result[fromRight ? length : ++index] = start;
- start += step;
- }
- return result;
-}
-
-/**
- * Checks if the provided arguments are from an iteratee call.
- *
- * @private
- * @param {*} value The potential iteratee value argument.
- * @param {*} index The potential iteratee index or key argument.
- * @param {*} object The potential iteratee object argument.
- * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`.
- */
-function isIterateeCall(value, index, object) {
- if (!isObject(object)) {
- return false;
- }
- var type = typeof index;
- if (type == 'number'
- ? (isArrayLike(object) && isIndex(index, object.length))
- : (type == 'string' && index in object)) {
- var other = object[index];
- return value === value ? (value === other) : (other !== other);
- }
- return false;
-}
-
-/**
- * Creates an array of numbers (positive and/or negative) progressing from
- * `start` up to, but not including, `end`. A step of `-1` is used if a negative
- * `start` is specified without an `end` or `step`. If `end` is not specified
- * it's set to `start` with `start` then set to `0`. If `end` is less than
- * `start` a zero-length range is created unless a negative `step` is specified.
- *
- * **Note:** JavaScript follows the IEEE-754 standard for resolving
- * floating-point values which can produce unexpected results.
- *
- * @static
- * @memberOf _
- * @category Utility
- * @param {number} [start=0] The start of the range.
- * @param {number} end The end of the range.
- * @param {number} [step=1] The value to increment or decrement by.
- * @returns {Array} Returns the new array of numbers.
- * @example
- *
- * _.range(4);
- * // => [0, 1, 2, 3]
- *
- * _.range(-4);
- * // => [0, -1, -2, -3]
- *
- * _.range(1, 5);
- * // => [1, 2, 3, 4]
- *
- * _.range(0, 20, 5);
- * // => [0, 5, 10, 15]
- *
- * _.range(0, -4, -1);
- * // => [0, -1, -2, -3]
- *
- * _.range(1, 4, 0);
- * // => [1, 1, 1]
- *
- * _.range(0);
- * // => []
- */
-function range(start, end, step) {
- if (step && isIterateeCall(start, end, step)) {
- end = step = undefined;
- }
- return baseRange(start, end, step);
-}
-
-function timesSeries (count, iterator, callback) {
- mapSeries(range(0, count), iterator, callback);
-}
-
-var mapLimit = doParallelLimit(_asyncMap);
-
-function timeLimit(count, limit, iterator, cb) {
- return mapLimit(range(0, count), limit, iterator, cb);
-}
-
-var map = doParallel(_asyncMap);
-
-function times (count, iterator, callback) {
- map(range(0, count), iterator, callback);
-}
-
-function sortBy(arr, iterator, cb) {
- map(arr, function (x, cb) {
- iterator(x, function (err, criteria) {
- if (err) return cb(err);
- cb(null, { value: x, criteria: criteria });
+ }
+
+ function _asyncMap(eachfn, arr, iterator, callback) {
+ callback = once(callback || noop);
+ arr = arr || [];
+ var results = isArrayLike(arr) ? [] : {};
+ eachfn(arr, function (value, index, callback) {
+ iterator(value, function (err, v) {
+ results[index] = v;
+ callback(err);
+ });
+ }, function (err) {
+ callback(err, results);
});
- }, function (err, results) {
- if (err) return cb(err);
- cb(null, arrayMap(results.sort(comparator), property('value')));
- });
+ }
+
+ var mapSeries = doSeries(_asyncMap);
+
+ var nativeCeil = Math.ceil;
+ var nativeMax$2 = Math.max;
+ /**
+ * The base implementation of `_.range` and `_.rangeRight`.
+ *
+ * @private
+ * @param {number} [start=0] The start of the range.
+ * @param {number} end The end of the range.
+ * @param {number} [step=1] The value to increment or decrement by.
+ * @param {boolean} [fromRight] Specify iterating from right to left.
+ * @returns {Array} Returns the new array of numbers.
+ */
+ function baseRange(start, end, step, fromRight) {
+ start = toNumber(start);
+ start = start === start ? start : 0;
+
+ if (end === undefined) {
+ end = start;
+ start = 0;
+ } else {
+ end = toNumber(end) || 0;
+ }
+ step = step === undefined ? (start < end ? 1 : -1) : (toNumber(step) || 0);
+
+ var index = -1,
+ length = nativeMax$2(nativeCeil((end - start) / (step || 1)), 0),
+ result = Array(length);
+
+ while (length--) {
+ result[fromRight ? length : ++index] = start;
+ start += step;
+ }
+ return result;
+ }
- function comparator(left, right) {
- var a = left.criteria,
- b = right.criteria;
- return a < b ? -1 : a > b ? 1 : 0;
+ /**
+ * Checks if the provided arguments are from an iteratee call.
+ *
+ * @private
+ * @param {*} value The potential iteratee value argument.
+ * @param {*} index The potential iteratee index or key argument.
+ * @param {*} object The potential iteratee object argument.
+ * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`.
+ */
+ function isIterateeCall(value, index, object) {
+ if (!isObject(object)) {
+ return false;
+ }
+ var type = typeof index;
+ if (type == 'number'
+ ? (isArrayLike(object) && isIndex(index, object.length))
+ : (type == 'string' && index in object)) {
+ var other = object[index];
+ return value === value ? (value === other) : (other !== other);
+ }
+ return false;
}
-}
-var someLimit = _createTester(eachOfLimit, Boolean, identity);
+ /**
+ * Creates an array of numbers (positive and/or negative) progressing from
+ * `start` up to, but not including, `end`. A step of `-1` is used if a negative
+ * `start` is specified without an `end` or `step`. If `end` is not specified
+ * it's set to `start` with `start` then set to `0`. If `end` is less than
+ * `start` a zero-length range is created unless a negative `step` is specified.
+ *
+ * **Note:** JavaScript follows the IEEE-754 standard for resolving
+ * floating-point values which can produce unexpected results.
+ *
+ * @static
+ * @memberOf _
+ * @category Utility
+ * @param {number} [start=0] The start of the range.
+ * @param {number} end The end of the range.
+ * @param {number} [step=1] The value to increment or decrement by.
+ * @returns {Array} Returns the new array of numbers.
+ * @example
+ *
+ * _.range(4);
+ * // => [0, 1, 2, 3]
+ *
+ * _.range(-4);
+ * // => [0, -1, -2, -3]
+ *
+ * _.range(1, 5);
+ * // => [1, 2, 3, 4]
+ *
+ * _.range(0, 20, 5);
+ * // => [0, 5, 10, 15]
+ *
+ * _.range(0, -4, -1);
+ * // => [0, -1, -2, -3]
+ *
+ * _.range(1, 4, 0);
+ * // => [1, 1, 1]
+ *
+ * _.range(0);
+ * // => []
+ */
+ function range(start, end, step) {
+ if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
+ end = step = undefined;
+ }
+ return baseRange(start, end, step);
+ }
-function _parallel(eachfn, tasks, callback) {
- callback = callback || noop;
- var results = isArrayLike(tasks) ? [] : {};
+ function timesSeries (count, iterator, callback) {
+ mapSeries(range(0, count), iterator, callback);
+ }
- eachfn(tasks, function (task, key, callback) {
- task(rest(function (err, args) {
- if (args.length <= 1) {
- args = args[0];
- }
- results[key] = args;
- callback(err);
- }));
- }, function (err) {
- callback(err, results);
- });
-}
+ var mapLimit = doParallelLimit(_asyncMap);
-function series(tasks, cb) {
- return _parallel(eachOfSeries, tasks, cb);
-}
+ function timeLimit(count, limit, iterator, cb) {
+ return mapLimit(range(0, count), limit, iterator, cb);
+ }
-function seq() /* functions... */{
- var fns = arguments;
- return rest(function (args) {
- var that = this;
+ var map = doParallel(_asyncMap);
- var cb = args[args.length - 1];
- if (typeof cb == 'function') {
- args.pop();
- } else {
- cb = noop;
- }
+ function times (count, iterator, callback) {
+ map(range(0, count), iterator, callback);
+ }
- reduce(fns, args, function (newargs, fn, cb) {
- fn.apply(that, newargs.concat([rest(function (err, nextargs) {
- cb(err, nextargs);
- })]));
+ function sortBy(arr, iterator, cb) {
+ map(arr, function (x, cb) {
+ iterator(x, function (err, criteria) {
+ if (err) return cb(err);
+ cb(null, { value: x, criteria: criteria });
+ });
}, function (err, results) {
- cb.apply(that, [err].concat(results));
+ if (err) return cb(err);
+ cb(null, arrayMap(results.sort(comparator), property('value')));
});
- });
-}
-function retry(times, task, callback) {
- var DEFAULT_TIMES = 5;
- var DEFAULT_INTERVAL = 0;
+ function comparator(left, right) {
+ var a = left.criteria,
+ b = right.criteria;
+ return a < b ? -1 : a > b ? 1 : 0;
+ }
+ }
- var attempts = [];
+ var someLimit = _createTester(eachOfLimit, Boolean, identity);
- var opts = {
- times: DEFAULT_TIMES,
- interval: DEFAULT_INTERVAL
- };
+ function _parallel(eachfn, tasks, callback) {
+ callback = callback || noop;
+ var results = isArrayLike(tasks) ? [] : {};
- function parseTimes(acc, t) {
- if (typeof t === 'number') {
- acc.times = parseInt(t, 10) || DEFAULT_TIMES;
- } else if (typeof t === 'object') {
- acc.times = parseInt(t.times, 10) || DEFAULT_TIMES;
- acc.interval = parseInt(t.interval, 10) || DEFAULT_INTERVAL;
- } else {
- throw new Error('Unsupported argument type for \'times\': ' + typeof t);
- }
+ eachfn(tasks, function (task, key, callback) {
+ task(rest(function (err, args) {
+ if (args.length <= 1) {
+ args = args[0];
+ }
+ results[key] = args;
+ callback(err);
+ }));
+ }, function (err) {
+ callback(err, results);
+ });
}
- var length = arguments.length;
- if (length < 1 || length > 3) {
- throw new Error('Invalid arguments - must be either (task), (task, callback), (times, task) or (times, task, callback)');
- } else if (length <= 2 && typeof times === 'function') {
- callback = task;
- task = times;
+ function series(tasks, cb) {
+ return _parallel(eachOfSeries, tasks, cb);
}
- if (typeof times !== 'function') {
- parseTimes(opts, times);
+
+ function seq() /* functions... */{
+ var fns = arguments;
+ return rest(function (args) {
+ var that = this;
+
+ var cb = args[args.length - 1];
+ if (typeof cb == 'function') {
+ args.pop();
+ } else {
+ cb = noop;
+ }
+
+ reduce(fns, args, function (newargs, fn, cb) {
+ fn.apply(that, newargs.concat([rest(function (err, nextargs) {
+ cb(err, nextargs);
+ })]));
+ }, function (err, results) {
+ cb.apply(that, [err].concat(results));
+ });
+ });
}
- opts.callback = callback;
- opts.task = task;
- function wrappedTask(wrappedCallback, wrappedResults) {
- function retryAttempt(task, finalAttempt) {
- return function (seriesCallback) {
- task(function (err, result) {
- seriesCallback(!err || finalAttempt, {
- err: err,
- result: result
- });
- }, wrappedResults);
- };
+ function retry(times, task, callback) {
+ var DEFAULT_TIMES = 5;
+ var DEFAULT_INTERVAL = 0;
+
+ var attempts = [];
+
+ var opts = {
+ times: DEFAULT_TIMES,
+ interval: DEFAULT_INTERVAL
+ };
+
+ function parseTimes(acc, t) {
+ if (typeof t === 'number') {
+ acc.times = parseInt(t, 10) || DEFAULT_TIMES;
+ } else if (typeof t === 'object') {
+ acc.times = parseInt(t.times, 10) || DEFAULT_TIMES;
+ acc.interval = parseInt(t.interval, 10) || DEFAULT_INTERVAL;
+ } else {
+ throw new Error('Unsupported argument type for \'times\': ' + typeof t);
+ }
}
- function retryInterval(interval) {
- return function (seriesCallback) {
- setTimeout(function () {
- seriesCallback(null);
- }, interval);
- };
+ var length = arguments.length;
+ if (length < 1 || length > 3) {
+ throw new Error('Invalid arguments - must be either (task), (task, callback), (times, task) or (times, task, callback)');
+ } else if (length <= 2 && typeof times === 'function') {
+ callback = task;
+ task = times;
}
+ if (typeof times !== 'function') {
+ parseTimes(opts, times);
+ }
+ opts.callback = callback;
+ opts.task = task;
+
+ function wrappedTask(wrappedCallback, wrappedResults) {
+ function retryAttempt(task, finalAttempt) {
+ return function (seriesCallback) {
+ task(function (err, result) {
+ seriesCallback(!err || finalAttempt, {
+ err: err,
+ result: result
+ });
+ }, wrappedResults);
+ };
+ }
- while (opts.times) {
+ function retryInterval(interval) {
+ return function (seriesCallback) {
+ setTimeout(function () {
+ seriesCallback(null);
+ }, interval);
+ };
+ }
- var finalAttempt = !(opts.times -= 1);
- attempts.push(retryAttempt(opts.task, finalAttempt));
- if (!finalAttempt && opts.interval > 0) {
- attempts.push(retryInterval(opts.interval));
+ while (opts.times) {
+
+ var finalAttempt = !(opts.times -= 1);
+ attempts.push(retryAttempt(opts.task, finalAttempt));
+ if (!finalAttempt && opts.interval > 0) {
+ attempts.push(retryInterval(opts.interval));
+ }
}
+
+ series(attempts, function (done, data) {
+ data = data[data.length - 1];
+ (wrappedCallback || opts.callback)(data.err, data.result);
+ });
}
- series(attempts, function (done, data) {
- data = data[data.length - 1];
- (wrappedCallback || opts.callback)(data.err, data.result);
- });
+ // If a callback is passed, run this as a controll flow
+ return opts.callback ? wrappedTask() : wrappedTask;
}
- // If a callback is passed, run this as a controll flow
- return opts.callback ? wrappedTask() : wrappedTask;
-}
-
-function reject$1(eachfn, arr, iterator, callback) {
- _filter(eachfn, arr, function (value, cb) {
- iterator(value, function (v) {
- cb(!v);
- });
- }, callback);
-}
-
-var rejectSeries = doSeries(reject$1);
-
-var rejectLimit = doParallelLimit(reject$1);
-
-var reject = doParallel(reject$1);
-
-/**
- * A specialized version of `_.forEach` for arrays without support for
- * callback shorthands.
- *
- * @private
- * @param {Array} array The array to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array} Returns `array`.
- */
-function arrayEach(array, iteratee) {
- var index = -1,
- length = array.length;
-
- while (++index < length) {
- if (iteratee(array[index], index, array) === false) {
- break;
- }
- }
- return array;
-}
-
-function queue$1(worker, concurrency, payload) {
- if (concurrency == null) {
- concurrency = 1;
- } else if (concurrency === 0) {
- throw new Error('Concurrency must not be zero');
- }
- function _insert(q, data, pos, callback) {
- if (callback != null && typeof callback !== 'function') {
- throw new Error('task callback must be a function');
- }
- q.started = true;
- if (!isArray(data)) {
- data = [data];
- }
- if (data.length === 0 && q.idle()) {
- // call drain immediately if there are no tasks
- return setImmediate$1(function () {
- q.drain();
+ function reject$1(eachfn, arr, iterator, callback) {
+ _filter(eachfn, arr, function (value, cb) {
+ iterator(value, function (v) {
+ cb(!v);
});
+ }, callback);
+ }
+
+ var rejectSeries = doSeries(reject$1);
+
+ var rejectLimit = doParallelLimit(reject$1);
+
+ var reject = doParallel(reject$1);
+
+ /**
+ * A specialized version of `_.forEach` for arrays without support for
+ * callback shorthands.
+ *
+ * @private
+ * @param {Array} array The array to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Array} Returns `array`.
+ */
+ function arrayEach(array, iteratee) {
+ var index = -1,
+ length = array.length;
+
+ while (++index < length) {
+ if (iteratee(array[index], index, array) === false) {
+ break;
}
- arrayEach(data, function (task) {
- var item = {
- data: task,
- callback: callback || noop
- };
+ }
+ return array;
+ }
- if (pos) {
- q.tasks.unshift(item);
- } else {
- q.tasks.push(item);
+ function queue$1(worker, concurrency, payload) {
+ if (concurrency == null) {
+ concurrency = 1;
+ } else if (concurrency === 0) {
+ throw new Error('Concurrency must not be zero');
+ }
+ function _insert(q, data, pos, callback) {
+ if (callback != null && typeof callback !== 'function') {
+ throw new Error('task callback must be a function');
}
-
- if (q.tasks.length === q.concurrency) {
- q.saturated();
+ q.started = true;
+ if (!isArray(data)) {
+ data = [data];
}
- });
- setImmediate$1(q.process);
- }
- function _next(q, tasks) {
- return function () {
- workers -= 1;
-
- var removed = false;
- var args = arguments;
- arrayEach(tasks, function (task) {
- arrayEach(workersList, function (worker, index) {
- if (worker === task && !removed) {
- workersList.splice(index, 1);
- removed = true;
- }
+ if (data.length === 0 && q.idle()) {
+ // call drain immediately if there are no tasks
+ return setImmediate$1(function () {
+ q.drain();
});
+ }
+ arrayEach(data, function (task) {
+ var item = {
+ data: task,
+ callback: callback || noop
+ };
+
+ if (pos) {
+ q.tasks.unshift(item);
+ } else {
+ q.tasks.push(item);
+ }
- task.callback.apply(task, args);
+ if (q.tasks.length === q.concurrency) {
+ q.saturated();
+ }
});
- if (q.tasks.length + workers === 0) {
- q.drain();
+ setImmediate$1(q.process);
+ }
+ function _next(q, tasks) {
+ return function () {
+ workers -= 1;
+
+ var removed = false;
+ var args = arguments;
+ arrayEach(tasks, function (task) {
+ arrayEach(workersList, function (worker, index) {
+ if (worker === task && !removed) {
+ workersList.splice(index, 1);
+ removed = true;
+ }
+ });
+
+ task.callback.apply(task, args);
+ });
+ if (q.tasks.length + workers === 0) {
+ q.drain();
+ }
+ q.process();
+ };
+ }
+
+ var workers = 0;
+ var workersList = [];
+ var q = {
+ tasks: [],
+ concurrency: concurrency,
+ payload: payload,
+ saturated: noop,
+ empty: noop,
+ drain: noop,
+ started: false,
+ paused: false,
+ push: function (data, callback) {
+ _insert(q, data, false, callback);
+ },
+ kill: function () {
+ q.drain = noop;
+ q.tasks = [];
+ },
+ unshift: function (data, callback) {
+ _insert(q, data, true, callback);
+ },
+ process: function () {
+ while (!q.paused && workers < q.concurrency && q.tasks.length) {
+
+ var tasks = q.payload ? q.tasks.splice(0, q.payload) : q.tasks.splice(0, q.tasks.length);
+
+ var data = arrayMap(tasks, property('data'));
+
+ if (q.tasks.length === 0) {
+ q.empty();
+ }
+ workers += 1;
+ workersList.push(tasks[0]);
+ var cb = onlyOnce(_next(q, tasks));
+ worker(data, cb);
+ }
+ },
+ length: function () {
+ return q.tasks.length;
+ },
+ running: function () {
+ return workers;
+ },
+ workersList: function () {
+ return workersList;
+ },
+ idle: function () {
+ return q.tasks.length + workers === 0;
+ },
+ pause: function () {
+ q.paused = true;
+ },
+ resume: function () {
+ if (q.paused === false) {
+ return;
+ }
+ q.paused = false;
+ var resumeCount = Math.min(q.concurrency, q.tasks.length);
+ // Need to call q.process once per concurrent
+ // worker to preserve full concurrency after pause
+ for (var w = 1; w <= resumeCount; w++) {
+ setImmediate$1(q.process);
+ }
}
- q.process();
};
+ return q;
}
- var workers = 0;
- var workersList = [];
- var q = {
- tasks: [],
- concurrency: concurrency,
- payload: payload,
- saturated: noop,
- empty: noop,
- drain: noop,
- started: false,
- paused: false,
- push: function (data, callback) {
- _insert(q, data, false, callback);
- },
- kill: function () {
- q.drain = noop;
- q.tasks = [];
- },
- unshift: function (data, callback) {
- _insert(q, data, true, callback);
- },
- process: function () {
- while (!q.paused && workers < q.concurrency && q.tasks.length) {
-
- var tasks = q.payload ? q.tasks.splice(0, q.payload) : q.tasks.splice(0, q.tasks.length);
-
- var data = arrayMap(tasks, property('data'));
-
- if (q.tasks.length === 0) {
- q.empty();
+ function queue (worker, concurrency) {
+ return queue$1(function (items, cb) {
+ worker(items[0], cb);
+ }, concurrency, 1);
+ }
+
+ function priorityQueue (worker, concurrency) {
+ function _compareTasks(a, b) {
+ return a.priority - b.priority;
+ }
+
+ function _binarySearch(sequence, item, compare) {
+ var beg = -1,
+ end = sequence.length - 1;
+ while (beg < end) {
+ var mid = beg + (end - beg + 1 >>> 1);
+ if (compare(item, sequence[mid]) >= 0) {
+ beg = mid;
+ } else {
+ end = mid - 1;
}
- workers += 1;
- workersList.push(tasks[0]);
- var cb = onlyOnce(_next(q, tasks));
- worker(data, cb);
}
- },
- length: function () {
- return q.tasks.length;
- },
- running: function () {
- return workers;
- },
- workersList: function () {
- return workersList;
- },
- idle: function () {
- return q.tasks.length + workers === 0;
- },
- pause: function () {
- q.paused = true;
- },
- resume: function () {
- if (q.paused === false) {
- return;
+ return beg;
+ }
+
+ function _insert(q, data, priority, callback) {
+ if (callback != null && typeof callback !== 'function') {
+ throw new Error('task callback must be a function');
}
- q.paused = false;
- var resumeCount = Math.min(q.concurrency, q.tasks.length);
- // Need to call q.process once per concurrent
- // worker to preserve full concurrency after pause
- for (var w = 1; w <= resumeCount; w++) {
- setImmediate$1(q.process);
+ q.started = true;
+ if (!isArray(data)) {
+ data = [data];
}
- }
- };
- return q;
-}
-
-function queue (worker, concurrency) {
- return queue$1(function (items, cb) {
- worker(items[0], cb);
- }, concurrency, 1);
-}
-
-function priorityQueue (worker, concurrency) {
- function _compareTasks(a, b) {
- return a.priority - b.priority;
- }
-
- function _binarySearch(sequence, item, compare) {
- var beg = -1,
- end = sequence.length - 1;
- while (beg < end) {
- var mid = beg + (end - beg + 1 >>> 1);
- if (compare(item, sequence[mid]) >= 0) {
- beg = mid;
- } else {
- end = mid - 1;
+ if (data.length === 0) {
+ // call drain immediately if there are no tasks
+ return setImmediate$1(function () {
+ q.drain();
+ });
}
- }
- return beg;
- }
+ arrayEach(data, function (task) {
+ var item = {
+ data: task,
+ priority: priority,
+ callback: typeof callback === 'function' ? callback : noop
+ };
- function _insert(q, data, priority, callback) {
- if (callback != null && typeof callback !== 'function') {
- throw new Error('task callback must be a function');
- }
- q.started = true;
- if (!isArray(data)) {
- data = [data];
- }
- if (data.length === 0) {
- // call drain immediately if there are no tasks
- return setImmediate$1(function () {
- q.drain();
+ q.tasks.splice(_binarySearch(q.tasks, item, _compareTasks) + 1, 0, item);
+
+ if (q.tasks.length === q.concurrency) {
+ q.saturated();
+ }
+ setImmediate$1(q.process);
});
}
- arrayEach(data, function (task) {
- var item = {
- data: task,
- priority: priority,
- callback: typeof callback === 'function' ? callback : noop
- };
- q.tasks.splice(_binarySearch(q.tasks, item, _compareTasks) + 1, 0, item);
+ // Start with a normal queue
+ var q = queue(worker, concurrency);
- if (q.tasks.length === q.concurrency) {
- q.saturated();
- }
- setImmediate$1(q.process);
- });
- }
-
- // Start with a normal queue
- var q = queue(worker, concurrency);
+ // Override push to accept second parameter representing priority
+ q.push = function (data, priority, callback) {
+ _insert(q, data, priority, callback);
+ };
- // Override push to accept second parameter representing priority
- q.push = function (data, priority, callback) {
- _insert(q, data, priority, callback);
- };
+ // Remove unshift function
+ delete q.unshift;
- // Remove unshift function
- delete q.unshift;
+ return q;
+ }
- return q;
-}
+ function parallelLimit(tasks, limit, cb) {
+ return _parallel(_eachOfLimit(limit), tasks, cb);
+ }
-function parallelLimit(tasks, limit, cb) {
- return _parallel(_eachOfLimit(limit), tasks, cb);
-}
+ function parallel(tasks, cb) {
+ return _parallel(eachOf, tasks, cb);
+ }
-function parallel(tasks, cb) {
- return _parallel(eachOf, tasks, cb);
-}
+ var nexTick = typeof process === 'object' && typeof process.nextTick === 'function' ? process.nextTick : setImmediate$1;
-var nexTick = typeof process === 'object' && typeof process.nextTick === 'function' ? process.nextTick : setImmediate$1;
+ function memoize(fn, hasher) {
+ var memo = {};
+ var queues = {};
+ hasher = hasher || identity;
+ var memoized = rest(function memoized(args) {
+ var callback = args.pop();
+ var key = hasher.apply(null, args);
+ if (key in memo) {
+ setImmediate$1(function () {
+ callback.apply(null, memo[key]);
+ });
+ } else if (key in queues) {
+ queues[key].push(callback);
+ } else {
+ queues[key] = [callback];
+ fn.apply(null, args.concat([rest(function (args) {
+ memo[key] = args;
+ var q = queues[key];
+ delete queues[key];
+ for (var i = 0, l = q.length; i < l; i++) {
+ q[i].apply(null, args);
+ }
+ })]));
+ }
+ });
+ memoized.memo = memo;
+ memoized.unmemoized = fn;
+ return memoized;
+ }
-function memoize(fn, hasher) {
- var memo = {};
- var queues = {};
- hasher = hasher || identity;
- var memoized = rest(function memoized(args) {
- var callback = args.pop();
- var key = hasher.apply(null, args);
- if (key in memo) {
- setImmediate$1(function () {
- callback.apply(null, memo[key]);
- });
- } else if (key in queues) {
- queues[key].push(callback);
- } else {
- queues[key] = [callback];
- fn.apply(null, args.concat([rest(function (args) {
- memo[key] = args;
- var q = queues[key];
- delete queues[key];
- for (var i = 0, l = q.length; i < l; i++) {
- q[i].apply(null, args);
- }
- })]));
- }
- });
- memoized.memo = memo;
- memoized.unmemoized = fn;
- return memoized;
-}
-
-function consoleFunc(name) {
- return rest(function (fn, args) {
- fn.apply(null, args.concat([rest(function (err, args) {
- if (typeof console === 'object') {
- if (err) {
- if (console.error) {
- console.error(err);
+ function consoleFunc(name) {
+ return rest(function (fn, args) {
+ fn.apply(null, args.concat([rest(function (err, args) {
+ if (typeof console === 'object') {
+ if (err) {
+ if (console.error) {
+ console.error(err);
+ }
+ } else if (console[name]) {
+ arrayEach(args, function (x) {
+ console[name](x);
+ });
}
- } else if (console[name]) {
- arrayEach(args, function (x) {
- console[name](x);
- });
}
- }
- })]));
- });
-}
+ })]));
+ });
+ }
-var log = consoleFunc('log');
+ var log = consoleFunc('log');
-function forever(fn, cb) {
- var done = onlyOnce(cb || noop);
- var task = ensureAsync(fn);
+ function forever(fn, cb) {
+ var done = onlyOnce(cb || noop);
+ var task = ensureAsync(fn);
- function next(err) {
- if (err) return done(err);
- task(next);
+ function next(err) {
+ if (err) return done(err);
+ task(next);
+ }
+ next();
}
- next();
-}
-var everyLimit = _createTester(eachOfLimit, notId, notId);
+ var everyLimit = _createTester(eachOfLimit, notId, notId);
-function during(test, iterator, cb) {
- cb = cb || noop;
+ function during(test, iterator, cb) {
+ cb = cb || noop;
- var next = rest(function (err, args) {
- if (err) {
- cb(err);
- } else {
- args.push(check);
- test.apply(this, args);
- }
- });
+ var next = rest(function (err, args) {
+ if (err) {
+ cb(err);
+ } else {
+ args.push(check);
+ test.apply(this, args);
+ }
+ });
- var check = function (err, truth) {
- if (err) return cb(err);
- if (!truth) return cb(null);
- iterator(next);
- };
+ var check = function (err, truth) {
+ if (err) return cb(err);
+ if (!truth) return cb(null);
+ iterator(next);
+ };
- test(check);
-}
+ test(check);
+ }
-function doWhilst(iterator, test, cb) {
- var calls = 0;
- return whilst(function () {
- return ++calls <= 1 || test.apply(this, arguments);
- }, iterator, cb);
-}
+ function doWhilst(iterator, test, cb) {
+ var calls = 0;
+ return whilst(function () {
+ return ++calls <= 1 || test.apply(this, arguments);
+ }, iterator, cb);
+ }
-function doUntil(iterator, test, cb) {
- return doWhilst(iterator, function () {
- return !test.apply(this, arguments);
- }, cb);
-}
+ function doUntil(iterator, test, cb) {
+ return doWhilst(iterator, function () {
+ return !test.apply(this, arguments);
+ }, cb);
+ }
-function doDuring(iterator, test, cb) {
- var calls = 0;
+ function doDuring(iterator, test, cb) {
+ var calls = 0;
- during(function (next) {
- if (calls++ < 1) return next(null, true);
- test.apply(this, arguments);
- }, iterator, cb);
-}
+ during(function (next) {
+ if (calls++ < 1) return next(null, true);
+ test.apply(this, arguments);
+ }, iterator, cb);
+ }
-var dir = consoleFunc('dir');
+ var dir = consoleFunc('dir');
-function _findGetResult(v, x) {
- return x;
-}
+ function _findGetResult(v, x) {
+ return x;
+ }
-var detectSeries = _createTester(eachOfSeries, identity, _findGetResult);
+ var detectSeries = _createTester(eachOfSeries, identity, _findGetResult);
-var detectLimit = _createTester(eachOfLimit, identity, _findGetResult);
+ var detectLimit = _createTester(eachOfLimit, identity, _findGetResult);
-var detect = _createTester(eachOf, identity, _findGetResult);
+ var detect = _createTester(eachOf, identity, _findGetResult);
-var constant = rest(function (values) {
- var args = [null].concat(values);
- return function (cb) {
- return cb.apply(this, args);
- };
-});
-
-function concat$1(eachfn, arr, fn, callback) {
- var result = [];
- eachfn(arr, function (x, index, cb) {
- fn(x, function (err, y) {
- result = result.concat(y || []);
- cb(err);
- });
- }, function (err) {
- callback(err, result);
+ var constant = rest(function (values) {
+ var args = [null].concat(values);
+ return function (cb) {
+ return cb.apply(this, args);
+ };
});
-}
-var concatSeries = doSeries(concat$1);
-
-var concat = doParallel(concat$1);
+ function concat$1(eachfn, arr, fn, callback) {
+ var result = [];
+ eachfn(arr, function (x, index, cb) {
+ fn(x, function (err, y) {
+ result = result.concat(y || []);
+ cb(err);
+ });
+ }, function (err) {
+ callback(err, result);
+ });
+ }
-var reverse = Array.prototype.reverse;
+ var concatSeries = doSeries(concat$1);
-function compose() /* functions... */{
- return seq.apply(null, reverse.call(arguments));
-}
+ var concat = doParallel(concat$1);
-function cargo(worker, payload) {
- return queue$1(worker, 1, payload);
-}
+ var reverse = Array.prototype.reverse;
-/**
- * A specialized version of `_.every` for arrays without support for
- * callback shorthands.
- *
- * @private
- * @param {Array} array The array to iterate over.
- * @param {Function} predicate The function invoked per iteration.
- * @returns {boolean} Returns `true` if all elements pass the predicate check, else `false`.
- */
-function arrayEvery(array, predicate) {
- var index = -1,
- length = array.length;
+ function compose() /* functions... */{
+ return seq.apply(null, reverse.call(arguments));
+ }
- while (++index < length) {
- if (!predicate(array[index], index, array)) {
- return false;
+ function cargo(worker, payload) {
+ return queue$1(worker, 1, payload);
}
- }
- return true;
-}
-
-/**
- * Creates a base function for methods like `_.forIn`.
- *
- * @private
- * @param {boolean} [fromRight] Specify iterating from right to left.
- * @returns {Function} Returns the new base function.
- */
-function createBaseFor(fromRight) {
- return function(object, iteratee, keysFunc) {
- var index = -1,
- iterable = Object(object),
- props = keysFunc(object),
- length = props.length;
-
- while (length--) {
- var key = props[fromRight ? length : ++index];
- if (iteratee(iterable[key], key, iterable) === false) {
- break;
+
+ /**
+ * A specialized version of `_.every` for arrays without support for
+ * callback shorthands.
+ *
+ * @private
+ * @param {Array} array The array to iterate over.
+ * @param {Function} predicate The function invoked per iteration.
+ * @returns {boolean} Returns `true` if all elements pass the predicate check, else `false`.
+ */
+ function arrayEvery(array, predicate) {
+ var index = -1,
+ length = array.length;
+
+ while (++index < length) {
+ if (!predicate(array[index], index, array)) {
+ return false;
+ }
}
+ return true;
}
- return object;
- };
-}
-
-/**
- * The base implementation of `baseForIn` and `baseForOwn` which iterates
- * over `object` properties returned by `keysFunc` invoking `iteratee` for
- * each property. Iteratee functions may exit iteration early by explicitly
- * returning `false`.
- *
- * @private
- * @param {Object} object The object to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @param {Function} keysFunc The function to get the keys of `object`.
- * @returns {Object} Returns `object`.
- */
-var baseFor = createBaseFor();
-
-/**
- * The base implementation of `_.forOwn` without support for callback shorthands.
- *
- * @private
- * @param {Object} object The object to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Object} Returns `object`.
- */
-function baseForOwn(object, iteratee) {
- return object && baseFor(object, iteratee, keys);
-}
-
-/**
- * Converts `value` to a function if it's not one.
- *
- * @private
- * @param {*} value The value to process.
- * @returns {Function} Returns the function.
- */
-function toFunction(value) {
- return typeof value == 'function' ? value : identity;
-}
-
-/**
- * Iterates over own enumerable properties of an object invoking `iteratee`
- * for each property. The iteratee is invoked with three arguments:
- * (value, key, object). Iteratee functions may exit iteration early by
- * explicitly returning `false`.
- *
- * @static
- * @memberOf _
- * @category Object
- * @param {Object} object The object to iterate over.
- * @param {Function} [iteratee=_.identity] The function invoked per iteration.
- * @returns {Object} Returns `object`.
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.forOwn(new Foo, function(value, key) {
- * console.log(key);
- * });
- * // => logs 'a' then 'b' (iteration order is not guaranteed)
- */
-function forOwn(object, iteratee) {
- return object && baseForOwn(object, toFunction(iteratee));
-}
-
-/**
- * Gets the index at which the first occurrence of `NaN` is found in `array`.
- *
- * @private
- * @param {Array} array The array to search.
- * @param {number} fromIndex The index to search from.
- * @param {boolean} [fromRight] Specify iterating from right to left.
- * @returns {number} Returns the index of the matched `NaN`, else `-1`.
- */
-function indexOfNaN(array, fromIndex, fromRight) {
- var length = array.length,
- index = fromIndex + (fromRight ? 0 : -1);
-
- while ((fromRight ? index-- : ++index < length)) {
- var other = array[index];
- if (other !== other) {
- return index;
+
+ /**
+ * Creates a base function for methods like `_.forIn`.
+ *
+ * @private
+ * @param {boolean} [fromRight] Specify iterating from right to left.
+ * @returns {Function} Returns the new base function.
+ */
+ function createBaseFor(fromRight) {
+ return function(object, iteratee, keysFunc) {
+ var index = -1,
+ iterable = Object(object),
+ props = keysFunc(object),
+ length = props.length;
+
+ while (length--) {
+ var key = props[fromRight ? length : ++index];
+ if (iteratee(iterable[key], key, iterable) === false) {
+ break;
+ }
+ }
+ return object;
+ };
}
- }
- return -1;
-}
-
-/**
- * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
- *
- * @private
- * @param {Array} array The array to search.
- * @param {*} value The value to search for.
- * @param {number} fromIndex The index to search from.
- * @returns {number} Returns the index of the matched value, else `-1`.
- */
-function baseIndexOf(array, value, fromIndex) {
- if (value !== value) {
- return indexOfNaN(array, fromIndex);
- }
- var index = fromIndex - 1,
- length = array.length;
-
- while (++index < length) {
- if (array[index] === value) {
- return index;
+
+ /**
+ * The base implementation of `baseForIn` and `baseForOwn` which iterates
+ * over `object` properties returned by `keysFunc` invoking `iteratee` for
+ * each property. Iteratee functions may exit iteration early by explicitly
+ * returning `false`.
+ *
+ * @private
+ * @param {Object} object The object to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @param {Function} keysFunc The function to get the keys of `object`.
+ * @returns {Object} Returns `object`.
+ */
+ var baseFor = createBaseFor();
+
+ /**
+ * The base implementation of `_.forOwn` without support for callback shorthands.
+ *
+ * @private
+ * @param {Object} object The object to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Object} Returns `object`.
+ */
+ function baseForOwn(object, iteratee) {
+ return object && baseFor(object, iteratee, keys);
}
- }
- return -1;
-}
-
-/* Built-in method references for those with the same name as other `lodash` methods. */
-var nativeMax$1 = Math.max;
-
-/**
- * Gets the index at which the first occurrence of `value` is found in `array`
- * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
- * for equality comparisons. If `fromIndex` is negative, it's used as the offset
- * from the end of `array`. If `array` is sorted providing `true` for `fromIndex`
- * performs a faster binary search.
- *
- * @static
- * @memberOf _
- * @category Array
- * @param {Array} array The array to search.
- * @param {*} value The value to search for.
- * @param {number} [fromIndex=0] The index to search from.
- * @returns {number} Returns the index of the matched value, else `-1`.
- * @example
- *
- * _.indexOf([1, 2, 1, 2], 2);
- * // => 1
- *
- * // using `fromIndex`
- * _.indexOf([1, 2, 1, 2], 2, 2);
- * // => 3
- */
-function indexOf(array, value, fromIndex) {
- var length = array ? array.length : 0;
- if (!length) {
- return -1;
- }
- fromIndex = toInteger(fromIndex);
- if (fromIndex < 0) {
- fromIndex = nativeMax$1(length + fromIndex, 0);
- }
- return baseIndexOf(array, value, fromIndex);
-}
-
-function auto (tasks, concurrency, callback) {
- if (typeof arguments[1] === 'function') {
- // concurrency is optional, shift the args.
- callback = concurrency;
- concurrency = null;
- }
- callback = once(callback || noop);
- var keys$$ = keys(tasks);
- var remainingTasks = keys$$.length;
- if (!remainingTasks) {
- return callback(null);
- }
- if (!concurrency) {
- concurrency = remainingTasks;
- }
-
- var results = {};
- var runningTasks = 0;
-
- var listeners = [];
- function addListener(fn) {
- listeners.unshift(fn);
- }
- function removeListener(fn) {
- var idx = indexOf(listeners, fn);
- if (idx >= 0) listeners.splice(idx, 1);
- }
- function taskComplete() {
- remainingTasks--;
- arrayEach(listeners.slice(), function (fn) {
- fn();
- });
+
+ /**
+ * Converts `value` to a function if it's not one.
+ *
+ * @private
+ * @param {*} value The value to process.
+ * @returns {Function} Returns the function.
+ */
+ function toFunction(value) {
+ return typeof value == 'function' ? value : identity;
+ }
+
+ /**
+ * Iterates over own enumerable properties of an object invoking `iteratee`
+ * for each property. The iteratee is invoked with three arguments:
+ * (value, key, object). Iteratee functions may exit iteration early by
+ * explicitly returning `false`.
+ *
+ * @static
+ * @memberOf _
+ * @category Object
+ * @param {Object} object The object to iterate over.
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
+ * @returns {Object} Returns `object`.
+ * @example
+ *
+ * function Foo() {
+ * this.a = 1;
+ * this.b = 2;
+ * }
+ *
+ * Foo.prototype.c = 3;
+ *
+ * _.forOwn(new Foo, function(value, key) {
+ * console.log(key);
+ * });
+ * // => logs 'a' then 'b' (iteration order is not guaranteed)
+ */
+ function forOwn(object, iteratee) {
+ return object && baseForOwn(object, toFunction(iteratee));
+ }
+
+ /**
+ * Gets the index at which the first occurrence of `NaN` is found in `array`.
+ *
+ * @private
+ * @param {Array} array The array to search.
+ * @param {number} fromIndex The index to search from.
+ * @param {boolean} [fromRight] Specify iterating from right to left.
+ * @returns {number} Returns the index of the matched `NaN`, else `-1`.
+ */
+ function indexOfNaN(array, fromIndex, fromRight) {
+ var length = array.length,
+ index = fromIndex + (fromRight ? 0 : -1);
+
+ while ((fromRight ? index-- : ++index < length)) {
+ var other = array[index];
+ if (other !== other) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
+ *
+ * @private
+ * @param {Array} array The array to search.
+ * @param {*} value The value to search for.
+ * @param {number} fromIndex The index to search from.
+ * @returns {number} Returns the index of the matched value, else `-1`.
+ */
+ function baseIndexOf(array, value, fromIndex) {
+ if (value !== value) {
+ return indexOfNaN(array, fromIndex);
+ }
+ var index = fromIndex - 1,
+ length = array.length;
+
+ while (++index < length) {
+ if (array[index] === value) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ /* Built-in method references for those with the same name as other `lodash` methods. */
+ var nativeMax$1 = Math.max;
+
+ /**
+ * Gets the index at which the first occurrence of `value` is found in `array`
+ * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
+ * for equality comparisons. If `fromIndex` is negative, it's used as the offset
+ * from the end of `array`. If `array` is sorted providing `true` for `fromIndex`
+ * performs a faster binary search.
+ *
+ * @static
+ * @memberOf _
+ * @category Array
+ * @param {Array} array The array to search.
+ * @param {*} value The value to search for.
+ * @param {number} [fromIndex=0] The index to search from.
+ * @returns {number} Returns the index of the matched value, else `-1`.
+ * @example
+ *
+ * _.indexOf([1, 2, 1, 2], 2);
+ * // => 1
+ *
+ * // using `fromIndex`
+ * _.indexOf([1, 2, 1, 2], 2, 2);
+ * // => 3
+ */
+ function indexOf(array, value, fromIndex) {
+ var length = array ? array.length : 0;
+ if (!length) {
+ return -1;
+ }
+ fromIndex = toInteger(fromIndex);
+ if (fromIndex < 0) {
+ fromIndex = nativeMax$1(length + fromIndex, 0);
+ }
+ return baseIndexOf(array, value, fromIndex);
}
- addListener(function () {
+ function auto (tasks, concurrency, callback) {
+ if (typeof arguments[1] === 'function') {
+ // concurrency is optional, shift the args.
+ callback = concurrency;
+ concurrency = null;
+ }
+ callback = once(callback || noop);
+ var keys$$ = keys(tasks);
+ var remainingTasks = keys$$.length;
if (!remainingTasks) {
- callback(null, results);
+ return callback(null);
+ }
+ if (!concurrency) {
+ concurrency = remainingTasks;
}
- });
- arrayEach(keys$$, function (k) {
- var task = isArray(tasks[k]) ? tasks[k] : [tasks[k]];
- var taskCallback = rest(function (err, args) {
- runningTasks--;
- if (args.length <= 1) {
- args = args[0];
- }
- if (err) {
- var safeResults = {};
- forOwn(results, function (val, rkey) {
- safeResults[rkey] = val;
- });
- safeResults[k] = args;
- callback(err, safeResults);
- } else {
- results[k] = args;
- setImmediate$1(taskComplete);
+ var results = {};
+ var runningTasks = 0;
+
+ var listeners = [];
+ function addListener(fn) {
+ listeners.unshift(fn);
+ }
+ function removeListener(fn) {
+ var idx = indexOf(listeners, fn);
+ if (idx >= 0) listeners.splice(idx, 1);
+ }
+ function taskComplete() {
+ remainingTasks--;
+ arrayEach(listeners.slice(), function (fn) {
+ fn();
+ });
+ }
+
+ addListener(function () {
+ if (!remainingTasks) {
+ callback(null, results);
}
});
- var requires = task.slice(0, task.length - 1);
- // prevent dead-locks
- var len = requires.length;
- var dep;
- while (len--) {
- if (!(dep = tasks[requires[len]])) {
- throw new Error('Has inexistant dependency');
+
+ arrayEach(keys$$, function (k) {
+ var task = isArray(tasks[k]) ? tasks[k] : [tasks[k]];
+ var taskCallback = rest(function (err, args) {
+ runningTasks--;
+ if (args.length <= 1) {
+ args = args[0];
+ }
+ if (err) {
+ var safeResults = {};
+ forOwn(results, function (val, rkey) {
+ safeResults[rkey] = val;
+ });
+ safeResults[k] = args;
+ callback(err, safeResults);
+ } else {
+ results[k] = args;
+ setImmediate$1(taskComplete);
+ }
+ });
+ var requires = task.slice(0, task.length - 1);
+ // prevent dead-locks
+ var len = requires.length;
+ var dep;
+ while (len--) {
+ if (!(dep = tasks[requires[len]])) {
+ throw new Error('Has inexistant dependency');
+ }
+ if (isArray(dep) && indexOf(dep, k) >= 0) {
+ throw new Error('Has cyclic dependencies');
+ }
}
- if (isArray(dep) && indexOf(dep, k) >= 0) {
- throw new Error('Has cyclic dependencies');
+ function ready() {
+ return runningTasks < concurrency && arrayEvery(requires, function (x) {
+ return results.hasOwnProperty(x);
+ }) && !results.hasOwnProperty(k);
}
- }
- function ready() {
- return runningTasks < concurrency && arrayEvery(requires, function (x) {
- return results.hasOwnProperty(x);
- }) && !results.hasOwnProperty(k);
- }
- if (ready()) {
- runningTasks++;
- task[task.length - 1](taskCallback, results);
- } else {
- addListener(listener);
- }
- function listener() {
if (ready()) {
runningTasks++;
- removeListener(listener);
task[task.length - 1](taskCallback, results);
+ } else {
+ addListener(listener);
}
- }
- });
-}
+ function listener() {
+ if (ready()) {
+ runningTasks++;
+ removeListener(listener);
+ task[task.length - 1](taskCallback, results);
+ }
+ }
+ });
+ }
-var apply = rest(function (fn, args) {
- return rest(function (callArgs) {
- return fn.apply(null, args.concat(callArgs));
+ var apply = rest(function (fn, args) {
+ return rest(function (callArgs) {
+ return fn.apply(null, args.concat(callArgs));
+ });
});
-});
-function _applyEach(eachfn) {
- return rest(function (fns, args) {
- var go = rest(function (args) {
- var that = this;
- var callback = args.pop();
- return eachfn(fns, function (fn, _, cb) {
- fn.apply(that, args.concat([cb]));
- }, callback);
+ function _applyEach(eachfn) {
+ return rest(function (fns, args) {
+ var go = rest(function (args) {
+ var that = this;
+ var callback = args.pop();
+ return eachfn(fns, function (fn, _, cb) {
+ fn.apply(that, args.concat([cb]));
+ }, callback);
+ });
+ if (args.length) {
+ return go.apply(this, args);
+ } else {
+ return go;
+ }
});
- if (args.length) {
- return go.apply(this, args);
- } else {
- return go;
- }
- });
-}
-
-var applyEachSeries = _applyEach(eachOfSeries);
-
-var applyEach = _applyEach(eachOf);
-
-var index = {
- applyEach: applyEach,
- applyEachSeries: applyEachSeries,
- apply: apply,
- asyncify: asyncify,
- auto: auto,
- cargo: cargo,
- compose: compose,
- concat: concat,
- concatSeries: concatSeries,
- constant: constant,
- detect: detect,
- detectLimit: detectLimit,
- detectSeries: detectSeries,
- dir: dir,
- doDuring: doDuring,
- doUntil: doUntil,
- doWhilst: doWhilst,
- during: during,
- each: each,
- eachLimit: eachLimit,
- eachOf: eachOf,
- eachOfLimit: eachOfLimit,
- eachOfSeries: eachOfSeries,
- eachSeries: eachSeries,
- ensureAsync: ensureAsync,
- every: every,
- everyLimit: everyLimit,
- filter: filter,
- filterLimit: filterLimit,
- filterSeries: filterSeries,
- forever: forever,
- iterator: iterator,
- log: log,
- map: map,
- mapLimit: mapLimit,
- mapSeries: mapSeries,
- memoize: memoize,
- nextTick: nexTick,
- parallel: parallel,
- parallelLimit: parallelLimit,
- priorityQueue: priorityQueue,
- queue: queue,
- reduce: reduce,
- reduceRight: reduceRight,
- reject: reject,
- rejectLimit: rejectLimit,
- rejectSeries: rejectSeries,
- retry: retry,
- seq: seq,
- series: series,
- setImmediate: setImmediate$1,
- some: some,
- someLimit: someLimit,
- sortBy: sortBy,
- times: times,
- timesLimit: timeLimit,
- timesSeries: timesSeries,
- transform: transform,
- unmemoize: unmemoize,
- until: until,
- waterfall: waterfall,
- whilst: whilst,
-
- // aliases
- all: every,
- any: some,
- forEach: each,
- forEachSeries: eachSeries,
- forEachLimit: eachLimit,
- forEachOf: eachOf,
- forEachOfSeries: eachOfSeries,
- forEachOfLimit: eachOfLimit,
- inject: reduce,
- foldl: reduce,
- foldr: reduceRight,
- select: filter,
- selectLimit: filterLimit,
- selectSeries: filterSeries,
- wrapSync: asyncify
-};
-
-exports['default'] = index;
-exports.applyEach = applyEach;
-exports.applyEachSeries = applyEachSeries;
-exports.apply = apply;
-exports.asyncify = asyncify;
-exports.auto = auto;
-exports.cargo = cargo;
-exports.compose = compose;
-exports.concat = concat;
-exports.concatSeries = concatSeries;
-exports.constant = constant;
-exports.detect = detect;
-exports.detectLimit = detectLimit;
-exports.detectSeries = detectSeries;
-exports.dir = dir;
-exports.doDuring = doDuring;
-exports.doUntil = doUntil;
-exports.doWhilst = doWhilst;
-exports.during = during;
-exports.each = each;
-exports.eachLimit = eachLimit;
-exports.eachOf = eachOf;
-exports.eachOfLimit = eachOfLimit;
-exports.eachOfSeries = eachOfSeries;
-exports.eachSeries = eachSeries;
-exports.ensureAsync = ensureAsync;
-exports.every = every;
-exports.everyLimit = everyLimit;
-exports.filter = filter;
-exports.filterLimit = filterLimit;
-exports.filterSeries = filterSeries;
-exports.forever = forever;
-exports.iterator = iterator;
-exports.log = log;
-exports.map = map;
-exports.mapLimit = mapLimit;
-exports.mapSeries = mapSeries;
-exports.memoize = memoize;
-exports.nextTick = nexTick;
-exports.parallel = parallel;
-exports.parallelLimit = parallelLimit;
-exports.priorityQueue = priorityQueue;
-exports.queue = queue;
-exports.reduce = reduce;
-exports.reduceRight = reduceRight;
-exports.reject = reject;
-exports.rejectLimit = rejectLimit;
-exports.rejectSeries = rejectSeries;
-exports.retry = retry;
-exports.seq = seq;
-exports.series = series;
-exports.setImmediate = setImmediate$1;
-exports.some = some;
-exports.someLimit = someLimit;
-exports.sortBy = sortBy;
-exports.times = times;
-exports.timesLimit = timeLimit;
-exports.timesSeries = timesSeries;
-exports.transform = transform;
-exports.unmemoize = unmemoize;
-exports.until = until;
-exports.waterfall = waterfall;
-exports.whilst = whilst;
-exports.all = every;
-exports.any = some;
-exports.forEach = each;
-exports.forEachSeries = eachSeries;
-exports.forEachLimit = eachLimit;
-exports.forEachOf = eachOf;
-exports.forEachOfSeries = eachOfSeries;
-exports.forEachOfLimit = eachOfLimit;
-exports.inject = reduce;
-exports.foldl = reduce;
-exports.foldr = reduceRight;
-exports.select = filter;
-exports.selectLimit = filterLimit;
-exports.selectSeries = filterSeries;
-exports.wrapSync = asyncify; \ No newline at end of file
+ }
+
+ var applyEachSeries = _applyEach(eachOfSeries);
+
+ var applyEach = _applyEach(eachOf);
+
+ var index = {
+ applyEach: applyEach,
+ applyEachSeries: applyEachSeries,
+ apply: apply,
+ asyncify: asyncify,
+ auto: auto,
+ cargo: cargo,
+ compose: compose,
+ concat: concat,
+ concatSeries: concatSeries,
+ constant: constant,
+ detect: detect,
+ detectLimit: detectLimit,
+ detectSeries: detectSeries,
+ dir: dir,
+ doDuring: doDuring,
+ doUntil: doUntil,
+ doWhilst: doWhilst,
+ during: during,
+ each: each,
+ eachLimit: eachLimit,
+ eachOf: eachOf,
+ eachOfLimit: eachOfLimit,
+ eachOfSeries: eachOfSeries,
+ eachSeries: eachSeries,
+ ensureAsync: ensureAsync,
+ every: every,
+ everyLimit: everyLimit,
+ filter: filter,
+ filterLimit: filterLimit,
+ filterSeries: filterSeries,
+ forever: forever,
+ iterator: iterator,
+ log: log,
+ map: map,
+ mapLimit: mapLimit,
+ mapSeries: mapSeries,
+ memoize: memoize,
+ nextTick: nexTick,
+ parallel: parallel,
+ parallelLimit: parallelLimit,
+ priorityQueue: priorityQueue,
+ queue: queue,
+ reduce: reduce,
+ reduceRight: reduceRight,
+ reject: reject,
+ rejectLimit: rejectLimit,
+ rejectSeries: rejectSeries,
+ retry: retry,
+ seq: seq,
+ series: series,
+ setImmediate: setImmediate$1,
+ some: some,
+ someLimit: someLimit,
+ sortBy: sortBy,
+ times: times,
+ timesLimit: timeLimit,
+ timesSeries: timesSeries,
+ transform: transform,
+ unmemoize: unmemoize,
+ until: until,
+ waterfall: waterfall,
+ whilst: whilst,
+
+ // aliases
+ all: every,
+ any: some,
+ forEach: each,
+ forEachSeries: eachSeries,
+ forEachLimit: eachLimit,
+ forEachOf: eachOf,
+ forEachOfSeries: eachOfSeries,
+ forEachOfLimit: eachOfLimit,
+ inject: reduce,
+ foldl: reduce,
+ foldr: reduceRight,
+ select: filter,
+ selectLimit: filterLimit,
+ selectSeries: filterSeries,
+ wrapSync: asyncify
+ };
+
+ exports['default'] = index;
+ exports.applyEach = applyEach;
+ exports.applyEachSeries = applyEachSeries;
+ exports.apply = apply;
+ exports.asyncify = asyncify;
+ exports.auto = auto;
+ exports.cargo = cargo;
+ exports.compose = compose;
+ exports.concat = concat;
+ exports.concatSeries = concatSeries;
+ exports.constant = constant;
+ exports.detect = detect;
+ exports.detectLimit = detectLimit;
+ exports.detectSeries = detectSeries;
+ exports.dir = dir;
+ exports.doDuring = doDuring;
+ exports.doUntil = doUntil;
+ exports.doWhilst = doWhilst;
+ exports.during = during;
+ exports.each = each;
+ exports.eachLimit = eachLimit;
+ exports.eachOf = eachOf;
+ exports.eachOfLimit = eachOfLimit;
+ exports.eachOfSeries = eachOfSeries;
+ exports.eachSeries = eachSeries;
+ exports.ensureAsync = ensureAsync;
+ exports.every = every;
+ exports.everyLimit = everyLimit;
+ exports.filter = filter;
+ exports.filterLimit = filterLimit;
+ exports.filterSeries = filterSeries;
+ exports.forever = forever;
+ exports.iterator = iterator;
+ exports.log = log;
+ exports.map = map;
+ exports.mapLimit = mapLimit;
+ exports.mapSeries = mapSeries;
+ exports.memoize = memoize;
+ exports.nextTick = nexTick;
+ exports.parallel = parallel;
+ exports.parallelLimit = parallelLimit;
+ exports.priorityQueue = priorityQueue;
+ exports.queue = queue;
+ exports.reduce = reduce;
+ exports.reduceRight = reduceRight;
+ exports.reject = reject;
+ exports.rejectLimit = rejectLimit;
+ exports.rejectSeries = rejectSeries;
+ exports.retry = retry;
+ exports.seq = seq;
+ exports.series = series;
+ exports.setImmediate = setImmediate$1;
+ exports.some = some;
+ exports.someLimit = someLimit;
+ exports.sortBy = sortBy;
+ exports.times = times;
+ exports.timesLimit = timeLimit;
+ exports.timesSeries = timesSeries;
+ exports.transform = transform;
+ exports.unmemoize = unmemoize;
+ exports.until = until;
+ exports.waterfall = waterfall;
+ exports.whilst = whilst;
+ exports.all = every;
+ exports.any = some;
+ exports.forEach = each;
+ exports.forEachSeries = eachSeries;
+ exports.forEachLimit = eachLimit;
+ exports.forEachOf = eachOf;
+ exports.forEachOfSeries = eachOfSeries;
+ exports.forEachOfLimit = eachOfLimit;
+ exports.inject = reduce;
+ exports.foldl = reduce;
+ exports.foldr = reduceRight;
+ exports.select = filter;
+ exports.selectLimit = filterLimit;
+ exports.selectSeries = filterSeries;
+ exports.wrapSync = asyncify;
+
+})); \ No newline at end of file
diff --git a/build/async-cjs.js b/build/async-cjs.js
new file mode 100644
index 0000000..0dc28c5
--- /dev/null
+++ b/build/async-cjs.js
@@ -0,0 +1,1230 @@
+'use strict';
+
+var rest = require('lodash/function/rest');
+rest = 'default' in rest ? rest['default'] : rest;
+var isObject = require('lodash/lang/isObject');
+isObject = 'default' in isObject ? isObject['default'] : isObject;
+var arrayEach = require('lodash/internal/arrayEach');
+arrayEach = 'default' in arrayEach ? arrayEach['default'] : arrayEach;
+var arrayEvery = require('lodash/internal/arrayEvery');
+arrayEvery = 'default' in arrayEvery ? arrayEvery['default'] : arrayEvery;
+var forOwn = require('lodash/object/forOwn');
+forOwn = 'default' in forOwn ? forOwn['default'] : forOwn;
+var indexOf = require('lodash/array/indexOf');
+indexOf = 'default' in indexOf ? indexOf['default'] : indexOf;
+var isArray = require('lodash/lang/isArray');
+isArray = 'default' in isArray ? isArray['default'] : isArray;
+var okeys = require('lodash/object/keys');
+okeys = 'default' in okeys ? okeys['default'] : okeys;
+var noop = require('lodash/utility/noop');
+noop = 'default' in noop ? noop['default'] : noop;
+var once = require('lodash/function/once');
+once = 'default' in once ? once['default'] : once;
+var identity = require('lodash/utility/identity');
+identity = 'default' in identity ? identity['default'] : identity;
+var toArray = require('lodash/lang/toArray');
+toArray = 'default' in toArray ? toArray['default'] : toArray;
+var arrayMap = require('lodash/internal/arrayMap');
+arrayMap = 'default' in arrayMap ? arrayMap['default'] : arrayMap;
+var property = require('lodash/utility/property');
+property = 'default' in property ? property['default'] : property;
+var range = require('lodash/utility/range');
+range = 'default' in range ? range['default'] : range;
+var isArrayLike = require('lodash/lang/isArrayLike');
+isArrayLike = 'default' in isArrayLike ? isArrayLike['default'] : isArrayLike;
+
+function asyncify(func) {
+ return rest(function (args) {
+ var callback = args.pop();
+ var result;
+ try {
+ result = func.apply(this, args);
+ } catch (e) {
+ return callback(e);
+ }
+ // if result is Promise object
+ if (isObject(result) && typeof result.then === 'function') {
+ result.then(function (value) {
+ callback(null, value);
+ })['catch'](function (err) {
+ callback(err.message ? err : new Error(err));
+ });
+ } else {
+ callback(null, result);
+ }
+ });
+}
+
+function _filter(eachfn, arr, iterator, callback) {
+ var results = [];
+ eachfn(arr, function (x, index, callback) {
+ iterator(x, function (v) {
+ if (v) {
+ results.push({ index: index, value: x });
+ }
+ callback();
+ });
+ }, function () {
+ callback(arrayMap(results.sort(function (a, b) {
+ return a.index - b.index;
+ }), property('value')));
+ });
+}
+
+function keyIterator(coll) {
+ var i = -1;
+ var len;
+ if (isArrayLike(coll)) {
+ len = coll.length;
+ return function next() {
+ i++;
+ return i < len ? i : null;
+ };
+ } else {
+ var okeys$$ = okeys(coll);
+ len = okeys$$.length;
+ return function next() {
+ i++;
+ return i < len ? okeys$$[i] : null;
+ };
+ }
+}
+
+function onlyOnce(fn) {
+ return function () {
+ if (fn === null) throw new Error("Callback was already called.");
+ fn.apply(this, arguments);
+ fn = null;
+ };
+}
+
+var _setImmediate = typeof setImmediate === 'function' && setImmediate;
+
+var _delay;
+if (_setImmediate) {
+ _delay = function (fn) {
+ // not a direct alias for IE10 compatibility
+ _setImmediate(fn);
+ };
+} else if (typeof process === 'object' && typeof process.nextTick === 'function') {
+ _delay = process.nextTick;
+} else {
+ _delay = function (fn) {
+ setTimeout(fn, 0);
+ };
+}
+
+var setImmediate$1 = _delay;
+
+function eachOfSeries(obj, iterator, callback) {
+ callback = once(callback || noop);
+ obj = obj || [];
+ var nextKey = keyIterator(obj);
+ var key = nextKey();
+
+ function iterate() {
+ var sync = true;
+ if (key === null) {
+ return callback(null);
+ }
+ iterator(obj[key], key, onlyOnce(function (err) {
+ if (err) {
+ callback(err);
+ } else {
+ key = nextKey();
+ if (key === null) {
+ return callback(null);
+ } else {
+ if (sync) {
+ setImmediate$1(iterate);
+ } else {
+ iterate();
+ }
+ }
+ }
+ }));
+ sync = false;
+ }
+ iterate();
+}
+
+function doSeries(fn) {
+ return function (obj, iterator, callback) {
+ return fn(eachOfSeries, obj, iterator, callback);
+ };
+}
+
+var filterSeries = doSeries(_filter);
+
+function _eachOfLimit(limit) {
+ return function (obj, iterator, callback) {
+ callback = once(callback || noop);
+ obj = obj || [];
+ var nextKey = keyIterator(obj);
+ if (limit <= 0) {
+ return callback(null);
+ }
+ var done = false;
+ var running = 0;
+ var errored = false;
+
+ (function replenish() {
+ if (done && running <= 0) {
+ return callback(null);
+ }
+
+ while (running < limit && !errored) {
+ var key = nextKey();
+ if (key === null) {
+ done = true;
+ if (running <= 0) {
+ callback(null);
+ }
+ return;
+ }
+ running += 1;
+ iterator(obj[key], key, onlyOnce(function (err) {
+ running -= 1;
+ if (err) {
+ callback(err);
+ errored = true;
+ } else {
+ replenish();
+ }
+ }));
+ }
+ })();
+ };
+}
+
+function doParallelLimit(fn) {
+ return function (obj, limit, iterator, callback) {
+ return fn(_eachOfLimit(limit), obj, iterator, callback);
+ };
+}
+
+var filterLimit = doParallelLimit(_filter);
+
+function eachOf(object, iterator, callback) {
+ callback = once(callback || noop);
+ object = object || [];
+
+ var iter = keyIterator(object);
+ var key,
+ completed = 0;
+
+ while ((key = iter()) != null) {
+ completed += 1;
+ iterator(object[key], key, onlyOnce(done));
+ }
+
+ if (completed === 0) callback(null);
+
+ function done(err) {
+ completed--;
+ if (err) {
+ callback(err);
+ }
+ // Check key is null in case iterator isn't exhausted
+ // and done resolved synchronously.
+ else if (key === null && completed <= 0) {
+ callback(null);
+ }
+ }
+}
+
+function doParallel(fn) {
+ return function (obj, iterator, callback) {
+ return fn(eachOf, obj, iterator, callback);
+ };
+}
+
+var filter = doParallel(_filter);
+
+function reduce(arr, memo, iterator, cb) {
+ eachOfSeries(arr, function (x, i, cb) {
+ iterator(memo, x, function (err, v) {
+ memo = v;
+ cb(err);
+ });
+ }, function (err) {
+ cb(err, memo);
+ });
+}
+
+function reduceRight(arr, memo, iterator, cb) {
+ var reversed = toArray(arr).reverse();
+ reduce(reversed, memo, iterator, cb);
+}
+
+function eachOfLimit(obj, limit, iterator, cb) {
+ _eachOfLimit(limit)(obj, iterator, cb);
+}
+
+function _withoutIndex(iterator) {
+ return function (value, index, callback) {
+ return iterator(value, callback);
+ };
+}
+
+function eachLimit(arr, limit, iterator, cb) {
+ return _eachOfLimit(limit)(arr, _withoutIndex(iterator), cb);
+}
+
+function eachSeries(arr, iterator, cb) {
+ return eachOfSeries(arr, _withoutIndex(iterator), cb);
+}
+
+function each(arr, iterator, cb) {
+ return eachOf(arr, _withoutIndex(iterator), cb);
+}
+
+function _createTester(eachfn, check, getResult) {
+ return function (arr, limit, iterator, cb) {
+ function done() {
+ if (cb) cb(getResult(false, void 0));
+ }
+ function iteratee(x, _, callback) {
+ if (!cb) return callback();
+ iterator(x, function (v) {
+ if (cb && check(v)) {
+ cb(getResult(true, x));
+ cb = iterator = false;
+ }
+ callback();
+ });
+ }
+ if (arguments.length > 3) {
+ eachfn(arr, limit, iteratee, done);
+ } else {
+ cb = iterator;
+ iterator = limit;
+ eachfn(arr, iteratee, done);
+ }
+ };
+}
+
+var some = _createTester(eachOf, Boolean, identity);
+
+function notId(v) {
+ return !v;
+}
+
+var every = _createTester(eachOf, notId, notId);
+
+function whilst(test, iterator, cb) {
+ cb = cb || noop;
+ if (!test()) return cb(null);
+ var next = rest(function (err, args) {
+ if (err) return cb(err);
+ if (test.apply(this, args)) return iterator(next);
+ cb.apply(null, [null].concat(args));
+ });
+ iterator(next);
+}
+
+function ensureAsync(fn) {
+ return rest(function (args) {
+ var callback = args.pop();
+ args.push(function () {
+ var innerArgs = arguments;
+ if (sync) {
+ setImmediate$1(function () {
+ callback.apply(null, innerArgs);
+ });
+ } else {
+ callback.apply(null, innerArgs);
+ }
+ });
+ var sync = true;
+ fn.apply(this, args);
+ sync = false;
+ });
+}
+
+function iterator (tasks) {
+ function makeCallback(index) {
+ function fn() {
+ if (tasks.length) {
+ tasks[index].apply(null, arguments);
+ }
+ return fn.next();
+ }
+ fn.next = function () {
+ return index < tasks.length - 1 ? makeCallback(index + 1) : null;
+ };
+ return fn;
+ }
+ return makeCallback(0);
+}
+
+function waterfall (tasks, cb) {
+ cb = once(cb || noop);
+ if (!isArray(tasks)) return cb(new Error('First argument to waterfall must be an array of functions'));
+ if (!tasks.length) return cb();
+
+ function wrapIterator(iterator) {
+ return rest(function (err, args) {
+ if (err) {
+ cb.apply(null, [err].concat(args));
+ } else {
+ var next = iterator.next();
+ if (next) {
+ args.push(wrapIterator(next));
+ } else {
+ args.push(cb);
+ }
+ ensureAsync(iterator).apply(null, args);
+ }
+ });
+ }
+ wrapIterator(iterator(tasks))();
+}
+
+function until(test, iterator, cb) {
+ return whilst(function () {
+ return !test.apply(this, arguments);
+ }, iterator, cb);
+}
+
+function unmemoize(fn) {
+ return function () {
+ return (fn.unmemoized || fn).apply(null, arguments);
+ };
+}
+
+function transform(arr, memo, iterator, callback) {
+ if (arguments.length === 3) {
+ callback = iterator;
+ iterator = memo;
+ memo = isArray(arr) ? [] : {};
+ }
+
+ eachOf(arr, function (v, k, cb) {
+ iterator(memo, v, k, cb);
+ }, function (err) {
+ callback(err, memo);
+ });
+}
+
+function _asyncMap(eachfn, arr, iterator, callback) {
+ callback = once(callback || noop);
+ arr = arr || [];
+ var results = isArrayLike(arr) ? [] : {};
+ eachfn(arr, function (value, index, callback) {
+ iterator(value, function (err, v) {
+ results[index] = v;
+ callback(err);
+ });
+ }, function (err) {
+ callback(err, results);
+ });
+}
+
+var mapSeries = doSeries(_asyncMap);
+
+function timesSeries (count, iterator, callback) {
+ mapSeries(range(0, count), iterator, callback);
+}
+
+var mapLimit = doParallelLimit(_asyncMap);
+
+function timeLimit(count, limit, iterator, cb) {
+ return mapLimit(range(0, count), limit, iterator, cb);
+}
+
+var map = doParallel(_asyncMap);
+
+function times (count, iterator, callback) {
+ map(range(0, count), iterator, callback);
+}
+
+function sortBy(arr, iterator, cb) {
+ map(arr, function (x, cb) {
+ iterator(x, function (err, criteria) {
+ if (err) return cb(err);
+ cb(null, { value: x, criteria: criteria });
+ });
+ }, function (err, results) {
+ if (err) return cb(err);
+ cb(null, arrayMap(results.sort(comparator), property('value')));
+ });
+
+ function comparator(left, right) {
+ var a = left.criteria,
+ b = right.criteria;
+ return a < b ? -1 : a > b ? 1 : 0;
+ }
+}
+
+var someLimit = _createTester(eachOfLimit, Boolean, identity);
+
+function _parallel(eachfn, tasks, callback) {
+ callback = callback || noop;
+ var results = isArrayLike(tasks) ? [] : {};
+
+ eachfn(tasks, function (task, key, callback) {
+ task(rest(function (err, args) {
+ if (args.length <= 1) {
+ args = args[0];
+ }
+ results[key] = args;
+ callback(err);
+ }));
+ }, function (err) {
+ callback(err, results);
+ });
+}
+
+function series(tasks, cb) {
+ return _parallel(eachOfSeries, tasks, cb);
+}
+
+function seq() /* functions... */{
+ var fns = arguments;
+ return rest(function (args) {
+ var that = this;
+
+ var cb = args[args.length - 1];
+ if (typeof cb == 'function') {
+ args.pop();
+ } else {
+ cb = noop;
+ }
+
+ reduce(fns, args, function (newargs, fn, cb) {
+ fn.apply(that, newargs.concat([rest(function (err, nextargs) {
+ cb(err, nextargs);
+ })]));
+ }, function (err, results) {
+ cb.apply(that, [err].concat(results));
+ });
+ });
+}
+
+function retry(times, task, callback) {
+ var DEFAULT_TIMES = 5;
+ var DEFAULT_INTERVAL = 0;
+
+ var attempts = [];
+
+ var opts = {
+ times: DEFAULT_TIMES,
+ interval: DEFAULT_INTERVAL
+ };
+
+ function parseTimes(acc, t) {
+ if (typeof t === 'number') {
+ acc.times = parseInt(t, 10) || DEFAULT_TIMES;
+ } else if (typeof t === 'object') {
+ acc.times = parseInt(t.times, 10) || DEFAULT_TIMES;
+ acc.interval = parseInt(t.interval, 10) || DEFAULT_INTERVAL;
+ } else {
+ throw new Error('Unsupported argument type for \'times\': ' + typeof t);
+ }
+ }
+
+ var length = arguments.length;
+ if (length < 1 || length > 3) {
+ throw new Error('Invalid arguments - must be either (task), (task, callback), (times, task) or (times, task, callback)');
+ } else if (length <= 2 && typeof times === 'function') {
+ callback = task;
+ task = times;
+ }
+ if (typeof times !== 'function') {
+ parseTimes(opts, times);
+ }
+ opts.callback = callback;
+ opts.task = task;
+
+ function wrappedTask(wrappedCallback, wrappedResults) {
+ function retryAttempt(task, finalAttempt) {
+ return function (seriesCallback) {
+ task(function (err, result) {
+ seriesCallback(!err || finalAttempt, {
+ err: err,
+ result: result
+ });
+ }, wrappedResults);
+ };
+ }
+
+ function retryInterval(interval) {
+ return function (seriesCallback) {
+ setTimeout(function () {
+ seriesCallback(null);
+ }, interval);
+ };
+ }
+
+ while (opts.times) {
+
+ var finalAttempt = !(opts.times -= 1);
+ attempts.push(retryAttempt(opts.task, finalAttempt));
+ if (!finalAttempt && opts.interval > 0) {
+ attempts.push(retryInterval(opts.interval));
+ }
+ }
+
+ series(attempts, function (done, data) {
+ data = data[data.length - 1];
+ (wrappedCallback || opts.callback)(data.err, data.result);
+ });
+ }
+
+ // If a callback is passed, run this as a controll flow
+ return opts.callback ? wrappedTask() : wrappedTask;
+}
+
+function reject$1(eachfn, arr, iterator, callback) {
+ _filter(eachfn, arr, function (value, cb) {
+ iterator(value, function (v) {
+ cb(!v);
+ });
+ }, callback);
+}
+
+var rejectSeries = doSeries(reject$1);
+
+var rejectLimit = doParallelLimit(reject$1);
+
+var reject = doParallel(reject$1);
+
+function queue$1(worker, concurrency, payload) {
+ if (concurrency == null) {
+ concurrency = 1;
+ } else if (concurrency === 0) {
+ throw new Error('Concurrency must not be zero');
+ }
+ function _insert(q, data, pos, callback) {
+ if (callback != null && typeof callback !== 'function') {
+ throw new Error('task callback must be a function');
+ }
+ q.started = true;
+ if (!isArray(data)) {
+ data = [data];
+ }
+ if (data.length === 0 && q.idle()) {
+ // call drain immediately if there are no tasks
+ return setImmediate$1(function () {
+ q.drain();
+ });
+ }
+ arrayEach(data, function (task) {
+ var item = {
+ data: task,
+ callback: callback || noop
+ };
+
+ if (pos) {
+ q.tasks.unshift(item);
+ } else {
+ q.tasks.push(item);
+ }
+
+ if (q.tasks.length === q.concurrency) {
+ q.saturated();
+ }
+ });
+ setImmediate$1(q.process);
+ }
+ function _next(q, tasks) {
+ return function () {
+ workers -= 1;
+
+ var removed = false;
+ var args = arguments;
+ arrayEach(tasks, function (task) {
+ arrayEach(workersList, function (worker, index) {
+ if (worker === task && !removed) {
+ workersList.splice(index, 1);
+ removed = true;
+ }
+ });
+
+ task.callback.apply(task, args);
+ });
+ if (q.tasks.length + workers === 0) {
+ q.drain();
+ }
+ q.process();
+ };
+ }
+
+ var workers = 0;
+ var workersList = [];
+ var q = {
+ tasks: [],
+ concurrency: concurrency,
+ payload: payload,
+ saturated: noop,
+ empty: noop,
+ drain: noop,
+ started: false,
+ paused: false,
+ push: function (data, callback) {
+ _insert(q, data, false, callback);
+ },
+ kill: function () {
+ q.drain = noop;
+ q.tasks = [];
+ },
+ unshift: function (data, callback) {
+ _insert(q, data, true, callback);
+ },
+ process: function () {
+ while (!q.paused && workers < q.concurrency && q.tasks.length) {
+
+ var tasks = q.payload ? q.tasks.splice(0, q.payload) : q.tasks.splice(0, q.tasks.length);
+
+ var data = arrayMap(tasks, property('data'));
+
+ if (q.tasks.length === 0) {
+ q.empty();
+ }
+ workers += 1;
+ workersList.push(tasks[0]);
+ var cb = onlyOnce(_next(q, tasks));
+ worker(data, cb);
+ }
+ },
+ length: function () {
+ return q.tasks.length;
+ },
+ running: function () {
+ return workers;
+ },
+ workersList: function () {
+ return workersList;
+ },
+ idle: function () {
+ return q.tasks.length + workers === 0;
+ },
+ pause: function () {
+ q.paused = true;
+ },
+ resume: function () {
+ if (q.paused === false) {
+ return;
+ }
+ q.paused = false;
+ var resumeCount = Math.min(q.concurrency, q.tasks.length);
+ // Need to call q.process once per concurrent
+ // worker to preserve full concurrency after pause
+ for (var w = 1; w <= resumeCount; w++) {
+ setImmediate$1(q.process);
+ }
+ }
+ };
+ return q;
+}
+
+function queue (worker, concurrency) {
+ return queue$1(function (items, cb) {
+ worker(items[0], cb);
+ }, concurrency, 1);
+}
+
+function priorityQueue (worker, concurrency) {
+ function _compareTasks(a, b) {
+ return a.priority - b.priority;
+ }
+
+ function _binarySearch(sequence, item, compare) {
+ var beg = -1,
+ end = sequence.length - 1;
+ while (beg < end) {
+ var mid = beg + (end - beg + 1 >>> 1);
+ if (compare(item, sequence[mid]) >= 0) {
+ beg = mid;
+ } else {
+ end = mid - 1;
+ }
+ }
+ return beg;
+ }
+
+ function _insert(q, data, priority, callback) {
+ if (callback != null && typeof callback !== 'function') {
+ throw new Error('task callback must be a function');
+ }
+ q.started = true;
+ if (!isArray(data)) {
+ data = [data];
+ }
+ if (data.length === 0) {
+ // call drain immediately if there are no tasks
+ return setImmediate$1(function () {
+ q.drain();
+ });
+ }
+ arrayEach(data, function (task) {
+ var item = {
+ data: task,
+ priority: priority,
+ callback: typeof callback === 'function' ? callback : noop
+ };
+
+ q.tasks.splice(_binarySearch(q.tasks, item, _compareTasks) + 1, 0, item);
+
+ if (q.tasks.length === q.concurrency) {
+ q.saturated();
+ }
+ setImmediate$1(q.process);
+ });
+ }
+
+ // Start with a normal queue
+ var q = queue(worker, concurrency);
+
+ // Override push to accept second parameter representing priority
+ q.push = function (data, priority, callback) {
+ _insert(q, data, priority, callback);
+ };
+
+ // Remove unshift function
+ delete q.unshift;
+
+ return q;
+}
+
+function parallelLimit(tasks, limit, cb) {
+ return _parallel(_eachOfLimit(limit), tasks, cb);
+}
+
+function parallel(tasks, cb) {
+ return _parallel(eachOf, tasks, cb);
+}
+
+var nexTick = typeof process === 'object' && typeof process.nextTick === 'function' ? process.nextTick : setImmediate$1;
+
+function memoize(fn, hasher) {
+ var memo = {};
+ var queues = {};
+ hasher = hasher || identity;
+ var memoized = rest(function memoized(args) {
+ var callback = args.pop();
+ var key = hasher.apply(null, args);
+ if (key in memo) {
+ setImmediate$1(function () {
+ callback.apply(null, memo[key]);
+ });
+ } else if (key in queues) {
+ queues[key].push(callback);
+ } else {
+ queues[key] = [callback];
+ fn.apply(null, args.concat([rest(function (args) {
+ memo[key] = args;
+ var q = queues[key];
+ delete queues[key];
+ for (var i = 0, l = q.length; i < l; i++) {
+ q[i].apply(null, args);
+ }
+ })]));
+ }
+ });
+ memoized.memo = memo;
+ memoized.unmemoized = fn;
+ return memoized;
+}
+
+function consoleFunc(name) {
+ return rest(function (fn, args) {
+ fn.apply(null, args.concat([rest(function (err, args) {
+ if (typeof console === 'object') {
+ if (err) {
+ if (console.error) {
+ console.error(err);
+ }
+ } else if (console[name]) {
+ arrayEach(args, function (x) {
+ console[name](x);
+ });
+ }
+ }
+ })]));
+ });
+}
+
+var log = consoleFunc('log');
+
+function forever(fn, cb) {
+ var done = onlyOnce(cb || noop);
+ var task = ensureAsync(fn);
+
+ function next(err) {
+ if (err) return done(err);
+ task(next);
+ }
+ next();
+}
+
+var everyLimit = _createTester(eachOfLimit, notId, notId);
+
+function during(test, iterator, cb) {
+ cb = cb || noop;
+
+ var next = rest(function (err, args) {
+ if (err) {
+ cb(err);
+ } else {
+ args.push(check);
+ test.apply(this, args);
+ }
+ });
+
+ var check = function (err, truth) {
+ if (err) return cb(err);
+ if (!truth) return cb(null);
+ iterator(next);
+ };
+
+ test(check);
+}
+
+function doWhilst(iterator, test, cb) {
+ var calls = 0;
+ return whilst(function () {
+ return ++calls <= 1 || test.apply(this, arguments);
+ }, iterator, cb);
+}
+
+function doUntil(iterator, test, cb) {
+ return doWhilst(iterator, function () {
+ return !test.apply(this, arguments);
+ }, cb);
+}
+
+function doDuring(iterator, test, cb) {
+ var calls = 0;
+
+ during(function (next) {
+ if (calls++ < 1) return next(null, true);
+ test.apply(this, arguments);
+ }, iterator, cb);
+}
+
+var dir = consoleFunc('dir');
+
+function _findGetResult(v, x) {
+ return x;
+}
+
+var detectSeries = _createTester(eachOfSeries, identity, _findGetResult);
+
+var detectLimit = _createTester(eachOfLimit, identity, _findGetResult);
+
+var detect = _createTester(eachOf, identity, _findGetResult);
+
+var constant = rest(function (values) {
+ var args = [null].concat(values);
+ return function (cb) {
+ return cb.apply(this, args);
+ };
+});
+
+function concat$1(eachfn, arr, fn, callback) {
+ var result = [];
+ eachfn(arr, function (x, index, cb) {
+ fn(x, function (err, y) {
+ result = result.concat(y || []);
+ cb(err);
+ });
+ }, function (err) {
+ callback(err, result);
+ });
+}
+
+var concatSeries = doSeries(concat$1);
+
+var concat = doParallel(concat$1);
+
+var reverse = Array.prototype.reverse;
+
+function compose() /* functions... */{
+ return seq.apply(null, reverse.call(arguments));
+}
+
+function cargo(worker, payload) {
+ return queue$1(worker, 1, payload);
+}
+
+function auto (tasks, concurrency, callback) {
+ if (typeof arguments[1] === 'function') {
+ // concurrency is optional, shift the args.
+ callback = concurrency;
+ concurrency = null;
+ }
+ callback = once(callback || noop);
+ var keys = okeys(tasks);
+ var remainingTasks = keys.length;
+ if (!remainingTasks) {
+ return callback(null);
+ }
+ if (!concurrency) {
+ concurrency = remainingTasks;
+ }
+
+ var results = {};
+ var runningTasks = 0;
+
+ var listeners = [];
+ function addListener(fn) {
+ listeners.unshift(fn);
+ }
+ function removeListener(fn) {
+ var idx = indexOf(listeners, fn);
+ if (idx >= 0) listeners.splice(idx, 1);
+ }
+ function taskComplete() {
+ remainingTasks--;
+ arrayEach(listeners.slice(), function (fn) {
+ fn();
+ });
+ }
+
+ addListener(function () {
+ if (!remainingTasks) {
+ callback(null, results);
+ }
+ });
+
+ arrayEach(keys, function (k) {
+ var task = isArray(tasks[k]) ? tasks[k] : [tasks[k]];
+ var taskCallback = rest(function (err, args) {
+ runningTasks--;
+ if (args.length <= 1) {
+ args = args[0];
+ }
+ if (err) {
+ var safeResults = {};
+ forOwn(results, function (val, rkey) {
+ safeResults[rkey] = val;
+ });
+ safeResults[k] = args;
+ callback(err, safeResults);
+ } else {
+ results[k] = args;
+ setImmediate$1(taskComplete);
+ }
+ });
+ var requires = task.slice(0, task.length - 1);
+ // prevent dead-locks
+ var len = requires.length;
+ var dep;
+ while (len--) {
+ if (!(dep = tasks[requires[len]])) {
+ throw new Error('Has inexistant dependency');
+ }
+ if (isArray(dep) && indexOf(dep, k) >= 0) {
+ throw new Error('Has cyclic dependencies');
+ }
+ }
+ function ready() {
+ return runningTasks < concurrency && arrayEvery(requires, function (x) {
+ return results.hasOwnProperty(x);
+ }) && !results.hasOwnProperty(k);
+ }
+ if (ready()) {
+ runningTasks++;
+ task[task.length - 1](taskCallback, results);
+ } else {
+ addListener(listener);
+ }
+ function listener() {
+ if (ready()) {
+ runningTasks++;
+ removeListener(listener);
+ task[task.length - 1](taskCallback, results);
+ }
+ }
+ });
+}
+
+var apply = rest(function (fn, args) {
+ return rest(function (callArgs) {
+ return fn.apply(null, args.concat(callArgs));
+ });
+});
+
+function _applyEach(eachfn) {
+ return rest(function (fns, args) {
+ var go = rest(function (args) {
+ var that = this;
+ var callback = args.pop();
+ return eachfn(fns, function (fn, _, cb) {
+ fn.apply(that, args.concat([cb]));
+ }, callback);
+ });
+ if (args.length) {
+ return go.apply(this, args);
+ } else {
+ return go;
+ }
+ });
+}
+
+var applyEachSeries = _applyEach(eachOfSeries);
+
+var applyEach = _applyEach(eachOf);
+
+var index = {
+ applyEach: applyEach,
+ applyEachSeries: applyEachSeries,
+ apply: apply,
+ asyncify: asyncify,
+ auto: auto,
+ cargo: cargo,
+ compose: compose,
+ concat: concat,
+ concatSeries: concatSeries,
+ constant: constant,
+ detect: detect,
+ detectLimit: detectLimit,
+ detectSeries: detectSeries,
+ dir: dir,
+ doDuring: doDuring,
+ doUntil: doUntil,
+ doWhilst: doWhilst,
+ during: during,
+ each: each,
+ eachLimit: eachLimit,
+ eachOf: eachOf,
+ eachOfLimit: eachOfLimit,
+ eachOfSeries: eachOfSeries,
+ eachSeries: eachSeries,
+ ensureAsync: ensureAsync,
+ every: every,
+ everyLimit: everyLimit,
+ filter: filter,
+ filterLimit: filterLimit,
+ filterSeries: filterSeries,
+ forever: forever,
+ iterator: iterator,
+ log: log,
+ map: map,
+ mapLimit: mapLimit,
+ mapSeries: mapSeries,
+ memoize: memoize,
+ nextTick: nexTick,
+ parallel: parallel,
+ parallelLimit: parallelLimit,
+ priorityQueue: priorityQueue,
+ queue: queue,
+ reduce: reduce,
+ reduceRight: reduceRight,
+ reject: reject,
+ rejectLimit: rejectLimit,
+ rejectSeries: rejectSeries,
+ retry: retry,
+ seq: seq,
+ series: series,
+ setImmediate: setImmediate$1,
+ some: some,
+ someLimit: someLimit,
+ sortBy: sortBy,
+ times: times,
+ timesLimit: timeLimit,
+ timesSeries: timesSeries,
+ transform: transform,
+ unmemoize: unmemoize,
+ until: until,
+ waterfall: waterfall,
+ whilst: whilst,
+
+ // aliases
+ all: every,
+ any: some,
+ forEach: each,
+ forEachSeries: eachSeries,
+ forEachLimit: eachLimit,
+ forEachOf: eachOf,
+ forEachOfSeries: eachOfSeries,
+ forEachOfLimit: eachOfLimit,
+ inject: reduce,
+ foldl: reduce,
+ foldr: reduceRight,
+ select: filter,
+ selectLimit: filterLimit,
+ selectSeries: filterSeries,
+ wrapSync: asyncify
+};
+
+exports['default'] = index;
+exports.applyEach = applyEach;
+exports.applyEachSeries = applyEachSeries;
+exports.apply = apply;
+exports.asyncify = asyncify;
+exports.auto = auto;
+exports.cargo = cargo;
+exports.compose = compose;
+exports.concat = concat;
+exports.concatSeries = concatSeries;
+exports.constant = constant;
+exports.detect = detect;
+exports.detectLimit = detectLimit;
+exports.detectSeries = detectSeries;
+exports.dir = dir;
+exports.doDuring = doDuring;
+exports.doUntil = doUntil;
+exports.doWhilst = doWhilst;
+exports.during = during;
+exports.each = each;
+exports.eachLimit = eachLimit;
+exports.eachOf = eachOf;
+exports.eachOfLimit = eachOfLimit;
+exports.eachOfSeries = eachOfSeries;
+exports.eachSeries = eachSeries;
+exports.ensureAsync = ensureAsync;
+exports.every = every;
+exports.everyLimit = everyLimit;
+exports.filter = filter;
+exports.filterLimit = filterLimit;
+exports.filterSeries = filterSeries;
+exports.forever = forever;
+exports.iterator = iterator;
+exports.log = log;
+exports.map = map;
+exports.mapLimit = mapLimit;
+exports.mapSeries = mapSeries;
+exports.memoize = memoize;
+exports.nextTick = nexTick;
+exports.parallel = parallel;
+exports.parallelLimit = parallelLimit;
+exports.priorityQueue = priorityQueue;
+exports.queue = queue;
+exports.reduce = reduce;
+exports.reduceRight = reduceRight;
+exports.reject = reject;
+exports.rejectLimit = rejectLimit;
+exports.rejectSeries = rejectSeries;
+exports.retry = retry;
+exports.seq = seq;
+exports.series = series;
+exports.setImmediate = setImmediate$1;
+exports.some = some;
+exports.someLimit = someLimit;
+exports.sortBy = sortBy;
+exports.times = times;
+exports.timesLimit = timeLimit;
+exports.timesSeries = timesSeries;
+exports.transform = transform;
+exports.unmemoize = unmemoize;
+exports.until = until;
+exports.waterfall = waterfall;
+exports.whilst = whilst;
+exports.all = every;
+exports.any = some;
+exports.forEach = each;
+exports.forEachSeries = eachSeries;
+exports.forEachLimit = eachLimit;
+exports.forEachOf = eachOf;
+exports.forEachOfSeries = eachOfSeries;
+exports.forEachOfLimit = eachOfLimit;
+exports.inject = reduce;
+exports.foldl = reduce;
+exports.foldr = reduceRight;
+exports.select = filter;
+exports.selectLimit = filterLimit;
+exports.selectSeries = filterSeries;
+exports.wrapSync = asyncify; \ No newline at end of file
diff --git a/build/modules-es6/apply.js b/build/modules-es6/apply.js
deleted file mode 100644
index 8a8d25e..0000000
--- a/build/modules-es6/apply.js
+++ /dev/null
@@ -1,9 +0,0 @@
-'use strict';
-
-import rest from '../../deps/lodash-es/function/rest';
-
-export default rest(function (fn, args) {
- return rest(function (callArgs) {
- return fn.apply(null, args.concat(callArgs));
- });
-}); \ No newline at end of file
diff --git a/build/modules-es6/applyEach.js b/build/modules-es6/applyEach.js
deleted file mode 100644
index 7ad6680..0000000
--- a/build/modules-es6/applyEach.js
+++ /dev/null
@@ -1,6 +0,0 @@
-'use strict';
-
-import applyEach from './internal/applyEach';
-import eachOf from './eachOf';
-
-export default applyEach(eachOf); \ No newline at end of file
diff --git a/build/modules-es6/applyEachSeries.js b/build/modules-es6/applyEachSeries.js
deleted file mode 100644
index 99ebfc7..0000000
--- a/build/modules-es6/applyEachSeries.js
+++ /dev/null
@@ -1,6 +0,0 @@
-'use strict';
-
-import applyEach from './internal/applyEach';
-import eachOfSeries from './eachOfSeries';
-
-export default applyEach(eachOfSeries); \ No newline at end of file
diff --git a/build/modules-es6/asyncify.js b/build/modules-es6/asyncify.js
deleted file mode 100644
index 876869f..0000000
--- a/build/modules-es6/asyncify.js
+++ /dev/null
@@ -1,26 +0,0 @@
-'use strict';
-
-import isObject from '../../deps/lodash-es/lang/isObject';
-import rest from '../../deps/lodash-es/function/rest';
-
-export default function asyncify(func) {
- return rest(function (args) {
- var callback = args.pop();
- var result;
- try {
- result = func.apply(this, args);
- } catch (e) {
- return callback(e);
- }
- // if result is Promise object
- if (isObject(result) && typeof result.then === 'function') {
- result.then(function (value) {
- callback(null, value);
- })['catch'](function (err) {
- callback(err.message ? err : new Error(err));
- });
- } else {
- callback(null, result);
- }
- });
-} \ No newline at end of file
diff --git a/build/modules-es6/auto.js b/build/modules-es6/auto.js
deleted file mode 100644
index 14e1285..0000000
--- a/build/modules-es6/auto.js
+++ /dev/null
@@ -1,105 +0,0 @@
-'use strict';
-
-import arrayEach from '../../deps/lodash-es/internal/arrayEach';
-import arrayEvery from '../../deps/lodash-es/internal/arrayEvery';
-import forOwn from '../../deps/lodash-es/object/forOwn';
-import indexOf from '../../deps/lodash-es/array/indexOf';
-import isArray from '../../deps/lodash-es/lang/isArray';
-import okeys from '../../deps/lodash-es/object/keys';
-import noop from '../../deps/lodash-es/utility/noop';
-import once from '../../deps/lodash-es/function/once';
-import rest from '../../deps/lodash-es/function/rest';
-
-import setImmediate from './internal/setImmediate';
-
-export default function (tasks, concurrency, callback) {
- if (typeof arguments[1] === 'function') {
- // concurrency is optional, shift the args.
- callback = concurrency;
- concurrency = null;
- }
- callback = once(callback || noop);
- var keys = okeys(tasks);
- var remainingTasks = keys.length;
- if (!remainingTasks) {
- return callback(null);
- }
- if (!concurrency) {
- concurrency = remainingTasks;
- }
-
- var results = {};
- var runningTasks = 0;
-
- var listeners = [];
- function addListener(fn) {
- listeners.unshift(fn);
- }
- function removeListener(fn) {
- var idx = indexOf(listeners, fn);
- if (idx >= 0) listeners.splice(idx, 1);
- }
- function taskComplete() {
- remainingTasks--;
- arrayEach(listeners.slice(), function (fn) {
- fn();
- });
- }
-
- addListener(function () {
- if (!remainingTasks) {
- callback(null, results);
- }
- });
-
- arrayEach(keys, function (k) {
- var task = isArray(tasks[k]) ? tasks[k] : [tasks[k]];
- var taskCallback = rest(function (err, args) {
- runningTasks--;
- if (args.length <= 1) {
- args = args[0];
- }
- if (err) {
- var safeResults = {};
- forOwn(results, function (val, rkey) {
- safeResults[rkey] = val;
- });
- safeResults[k] = args;
- callback(err, safeResults);
- } else {
- results[k] = args;
- setImmediate(taskComplete);
- }
- });
- var requires = task.slice(0, task.length - 1);
- // prevent dead-locks
- var len = requires.length;
- var dep;
- while (len--) {
- if (!(dep = tasks[requires[len]])) {
- throw new Error('Has inexistant dependency');
- }
- if (isArray(dep) && indexOf(dep, k) >= 0) {
- throw new Error('Has cyclic dependencies');
- }
- }
- function ready() {
- return runningTasks < concurrency && arrayEvery(requires, function (x) {
- return results.hasOwnProperty(x);
- }) && !results.hasOwnProperty(k);
- }
- if (ready()) {
- runningTasks++;
- task[task.length - 1](taskCallback, results);
- } else {
- addListener(listener);
- }
- function listener() {
- if (ready()) {
- runningTasks++;
- removeListener(listener);
- task[task.length - 1](taskCallback, results);
- }
- }
- });
-} \ No newline at end of file
diff --git a/build/modules-es6/cargo.js b/build/modules-es6/cargo.js
deleted file mode 100644
index e7db792..0000000
--- a/build/modules-es6/cargo.js
+++ /dev/null
@@ -1,7 +0,0 @@
-'use strict';
-
-import queue from './internal/queue';
-
-export default function cargo(worker, payload) {
- return queue(worker, 1, payload);
-} \ No newline at end of file
diff --git a/build/modules-es6/compose.js b/build/modules-es6/compose.js
deleted file mode 100644
index 291731a..0000000
--- a/build/modules-es6/compose.js
+++ /dev/null
@@ -1,9 +0,0 @@
-'use strict';
-
-import seq from './seq';
-
-var reverse = Array.prototype.reverse;
-
-export default function compose() /* functions... */{
- return seq.apply(null, reverse.call(arguments));
-} \ No newline at end of file
diff --git a/build/modules-es6/concat.js b/build/modules-es6/concat.js
deleted file mode 100644
index 19ff515..0000000
--- a/build/modules-es6/concat.js
+++ /dev/null
@@ -1,6 +0,0 @@
-'use strict';
-
-import concat from './internal/concat';
-import doParallel from './internal/doParallel';
-
-export default doParallel(concat); \ No newline at end of file
diff --git a/build/modules-es6/concatSeries.js b/build/modules-es6/concatSeries.js
deleted file mode 100644
index 8fb614b..0000000
--- a/build/modules-es6/concatSeries.js
+++ /dev/null
@@ -1,6 +0,0 @@
-'use strict';
-
-import concat from './internal/concat';
-import doSeries from './internal/doSeries';
-
-export default doSeries(concat); \ No newline at end of file
diff --git a/build/modules-es6/constant.js b/build/modules-es6/constant.js
deleted file mode 100644
index 16d9755..0000000
--- a/build/modules-es6/constant.js
+++ /dev/null
@@ -1,10 +0,0 @@
-'use strict';
-
-import rest from '../../deps/lodash-es/function/rest';
-
-export default rest(function (values) {
- var args = [null].concat(values);
- return function (cb) {
- return cb.apply(this, args);
- };
-}); \ No newline at end of file
diff --git a/build/modules-es6/detect.js b/build/modules-es6/detect.js
deleted file mode 100644
index 4030f60..0000000
--- a/build/modules-es6/detect.js
+++ /dev/null
@@ -1,9 +0,0 @@
-'use strict';
-
-import identity from '../../deps/lodash-es/utility/identity';
-
-import createTester from './internal/createTester';
-import eachOf from './eachOf';
-import findGetResult from './internal/findGetResult';
-
-export default createTester(eachOf, identity, findGetResult); \ No newline at end of file
diff --git a/build/modules-es6/detectLimit.js b/build/modules-es6/detectLimit.js
deleted file mode 100644
index 159a963..0000000
--- a/build/modules-es6/detectLimit.js
+++ /dev/null
@@ -1,9 +0,0 @@
-'use strict';
-
-import identity from '../../deps/lodash-es/utility/identity';
-
-import createTester from './internal/createTester';
-import eachOfLimit from './eachOfLimit';
-import findGetResult from './internal/findGetResult';
-
-export default createTester(eachOfLimit, identity, findGetResult); \ No newline at end of file
diff --git a/build/modules-es6/detectSeries.js b/build/modules-es6/detectSeries.js
deleted file mode 100644
index a8ea35a..0000000
--- a/build/modules-es6/detectSeries.js
+++ /dev/null
@@ -1,9 +0,0 @@
-'use strict';
-
-import identity from '../../deps/lodash-es/utility/identity';
-
-import createTester from './internal/createTester';
-import eachOfSeries from './eachOfSeries';
-import findGetResult from './internal/findGetResult';
-
-export default createTester(eachOfSeries, identity, findGetResult); \ No newline at end of file
diff --git a/build/modules-es6/dir.js b/build/modules-es6/dir.js
deleted file mode 100644
index e91b2fe..0000000
--- a/build/modules-es6/dir.js
+++ /dev/null
@@ -1,5 +0,0 @@
-'use strict';
-
-import consoleFunc from './internal/consoleFunc';
-
-export default consoleFunc('dir'); \ No newline at end of file
diff --git a/build/modules-es6/doDuring.js b/build/modules-es6/doDuring.js
deleted file mode 100644
index e0299b0..0000000
--- a/build/modules-es6/doDuring.js
+++ /dev/null
@@ -1,12 +0,0 @@
-'use strict';
-
-import during from './during';
-
-export default function doDuring(iterator, test, cb) {
- var calls = 0;
-
- during(function (next) {
- if (calls++ < 1) return next(null, true);
- test.apply(this, arguments);
- }, iterator, cb);
-} \ No newline at end of file
diff --git a/build/modules-es6/doUntil.js b/build/modules-es6/doUntil.js
deleted file mode 100644
index 07863dc..0000000
--- a/build/modules-es6/doUntil.js
+++ /dev/null
@@ -1,9 +0,0 @@
-'use strict';
-
-import doWhilst from './doWhilst';
-
-export default function doUntil(iterator, test, cb) {
- return doWhilst(iterator, function () {
- return !test.apply(this, arguments);
- }, cb);
-} \ No newline at end of file
diff --git a/build/modules-es6/doWhilst.js b/build/modules-es6/doWhilst.js
deleted file mode 100644
index aee4a9b..0000000
--- a/build/modules-es6/doWhilst.js
+++ /dev/null
@@ -1,10 +0,0 @@
-'use strict';
-
-import whilst from './whilst';
-
-export default function doWhilst(iterator, test, cb) {
- var calls = 0;
- return whilst(function () {
- return ++calls <= 1 || test.apply(this, arguments);
- }, iterator, cb);
-} \ No newline at end of file
diff --git a/build/modules-es6/during.js b/build/modules-es6/during.js
deleted file mode 100644
index f5fd2fc..0000000
--- a/build/modules-es6/during.js
+++ /dev/null
@@ -1,25 +0,0 @@
-'use strict';
-
-import noop from '../../deps/lodash-es/utility/noop';
-import rest from '../../deps/lodash-es/function/rest';
-
-export default function during(test, iterator, cb) {
- cb = cb || noop;
-
- var next = rest(function (err, args) {
- if (err) {
- cb(err);
- } else {
- args.push(check);
- test.apply(this, args);
- }
- });
-
- var check = function (err, truth) {
- if (err) return cb(err);
- if (!truth) return cb(null);
- iterator(next);
- };
-
- test(check);
-} \ No newline at end of file
diff --git a/build/modules-es6/each.js b/build/modules-es6/each.js
deleted file mode 100644
index 2b90bce..0000000
--- a/build/modules-es6/each.js
+++ /dev/null
@@ -1,8 +0,0 @@
-'use strict';
-
-import eachOf from './eachOf';
-import withoutIndex from './internal/withoutIndex';
-
-export default function each(arr, iterator, cb) {
- return eachOf(arr, withoutIndex(iterator), cb);
-} \ No newline at end of file
diff --git a/build/modules-es6/eachLimit.js b/build/modules-es6/eachLimit.js
deleted file mode 100644
index 99903cb..0000000
--- a/build/modules-es6/eachLimit.js
+++ /dev/null
@@ -1,8 +0,0 @@
-'use strict';
-
-import eachOfLimit from './internal/eachOfLimit';
-import withoutIndex from './internal/withoutIndex';
-
-export default function eachLimit(arr, limit, iterator, cb) {
- return eachOfLimit(limit)(arr, withoutIndex(iterator), cb);
-} \ No newline at end of file
diff --git a/build/modules-es6/eachOf.js b/build/modules-es6/eachOf.js
deleted file mode 100644
index 973745c..0000000
--- a/build/modules-es6/eachOf.js
+++ /dev/null
@@ -1,35 +0,0 @@
-'use strict';
-
-import once from '../../deps/lodash-es/function/once';
-import noop from '../../deps/lodash-es/utility/noop';
-
-import keyIterator from './internal/keyIterator';
-import onlyOnce from './internal/onlyOnce';
-
-export default function eachOf(object, iterator, callback) {
- callback = once(callback || noop);
- object = object || [];
-
- var iter = keyIterator(object);
- var key,
- completed = 0;
-
- while ((key = iter()) != null) {
- completed += 1;
- iterator(object[key], key, onlyOnce(done));
- }
-
- if (completed === 0) callback(null);
-
- function done(err) {
- completed--;
- if (err) {
- callback(err);
- }
- // Check key is null in case iterator isn't exhausted
- // and done resolved synchronously.
- else if (key === null && completed <= 0) {
- callback(null);
- }
- }
-} \ No newline at end of file
diff --git a/build/modules-es6/eachOfLimit.js b/build/modules-es6/eachOfLimit.js
deleted file mode 100644
index a6b86f2..0000000
--- a/build/modules-es6/eachOfLimit.js
+++ /dev/null
@@ -1,7 +0,0 @@
-'use strict';
-
-import _eachOfLimit from './internal/eachOfLimit';
-
-export default function eachOfLimit(obj, limit, iterator, cb) {
- _eachOfLimit(limit)(obj, iterator, cb);
-} \ No newline at end of file
diff --git a/build/modules-es6/eachOfSeries.js b/build/modules-es6/eachOfSeries.js
deleted file mode 100644
index b2ce43a..0000000
--- a/build/modules-es6/eachOfSeries.js
+++ /dev/null
@@ -1,40 +0,0 @@
-'use strict';
-
-import once from '../../deps/lodash-es/function/once';
-import noop from '../../deps/lodash-es/utility/noop';
-
-import keyIterator from './internal/keyIterator';
-import onlyOnce from './internal/onlyOnce';
-import setImmediate from './setImmediate';
-
-export default function eachOfSeries(obj, iterator, callback) {
- callback = once(callback || noop);
- obj = obj || [];
- var nextKey = keyIterator(obj);
- var key = nextKey();
-
- function iterate() {
- var sync = true;
- if (key === null) {
- return callback(null);
- }
- iterator(obj[key], key, onlyOnce(function (err) {
- if (err) {
- callback(err);
- } else {
- key = nextKey();
- if (key === null) {
- return callback(null);
- } else {
- if (sync) {
- setImmediate(iterate);
- } else {
- iterate();
- }
- }
- }
- }));
- sync = false;
- }
- iterate();
-} \ No newline at end of file
diff --git a/build/modules-es6/eachSeries.js b/build/modules-es6/eachSeries.js
deleted file mode 100644
index f6d61e8..0000000
--- a/build/modules-es6/eachSeries.js
+++ /dev/null
@@ -1,8 +0,0 @@
-'use strict';
-
-import eachOfSeries from './eachOfSeries';
-import withoutIndex from './internal/withoutIndex';
-
-export default function eachSeries(arr, iterator, cb) {
- return eachOfSeries(arr, withoutIndex(iterator), cb);
-} \ No newline at end of file
diff --git a/build/modules-es6/ensureAsync.js b/build/modules-es6/ensureAsync.js
deleted file mode 100644
index 1124c2f..0000000
--- a/build/modules-es6/ensureAsync.js
+++ /dev/null
@@ -1,24 +0,0 @@
-'use strict';
-
-import rest from '../../deps/lodash-es/function/rest';
-
-import setImmediate from './internal/setImmediate';
-
-export default function ensureAsync(fn) {
- return rest(function (args) {
- var callback = args.pop();
- args.push(function () {
- var innerArgs = arguments;
- if (sync) {
- setImmediate(function () {
- callback.apply(null, innerArgs);
- });
- } else {
- callback.apply(null, innerArgs);
- }
- });
- var sync = true;
- fn.apply(this, args);
- sync = false;
- });
-} \ No newline at end of file
diff --git a/build/modules-es6/every.js b/build/modules-es6/every.js
deleted file mode 100644
index e9c413a..0000000
--- a/build/modules-es6/every.js
+++ /dev/null
@@ -1,7 +0,0 @@
-'use strict';
-
-import createTester from './internal/createTester';
-import eachOf from './eachOf';
-import notId from './internal/notId';
-
-export default createTester(eachOf, notId, notId); \ No newline at end of file
diff --git a/build/modules-es6/everyLimit.js b/build/modules-es6/everyLimit.js
deleted file mode 100644
index b5fb508..0000000
--- a/build/modules-es6/everyLimit.js
+++ /dev/null
@@ -1,7 +0,0 @@
-'use strict';
-
-import createTester from './internal/createTester';
-import eachOfLimit from './eachOfLimit';
-import notId from './internal/notId';
-
-export default createTester(eachOfLimit, notId, notId); \ No newline at end of file
diff --git a/build/modules-es6/filter.js b/build/modules-es6/filter.js
deleted file mode 100644
index 775d812..0000000
--- a/build/modules-es6/filter.js
+++ /dev/null
@@ -1,6 +0,0 @@
-'use strict';
-
-import filter from './internal/filter';
-import doParallel from './internal/doParallel';
-
-export default doParallel(filter); \ No newline at end of file
diff --git a/build/modules-es6/filterLimit.js b/build/modules-es6/filterLimit.js
deleted file mode 100644
index f818c5a..0000000
--- a/build/modules-es6/filterLimit.js
+++ /dev/null
@@ -1,6 +0,0 @@
-'use strict';
-
-import filter from './internal/filter';
-import doParallelLimit from './internal/doParallelLimit';
-
-export default doParallelLimit(filter); \ No newline at end of file
diff --git a/build/modules-es6/filterSeries.js b/build/modules-es6/filterSeries.js
deleted file mode 100644
index 5c6258b..0000000
--- a/build/modules-es6/filterSeries.js
+++ /dev/null
@@ -1,6 +0,0 @@
-'use strict';
-
-import filter from './internal/filter';
-import doSeries from './internal/doSeries';
-
-export default doSeries(filter); \ No newline at end of file
diff --git a/build/modules-es6/forever.js b/build/modules-es6/forever.js
deleted file mode 100644
index 790b463..0000000
--- a/build/modules-es6/forever.js
+++ /dev/null
@@ -1,17 +0,0 @@
-'use strict';
-
-import noop from '../../deps/lodash-es/utility/noop';
-
-import onlyOnce from './internal/onlyOnce';
-import ensureAsync from './ensureAsync';
-
-export default function forever(fn, cb) {
- var done = onlyOnce(cb || noop);
- var task = ensureAsync(fn);
-
- function next(err) {
- if (err) return done(err);
- task(next);
- }
- next();
-} \ No newline at end of file
diff --git a/build/modules-es6/index.js b/build/modules-es6/index.js
deleted file mode 100644
index 49dae96..0000000
--- a/build/modules-es6/index.js
+++ /dev/null
@@ -1,151 +0,0 @@
-'use strict';
-
-import applyEach from './applyEach';
-import applyEachSeries from './applyEachSeries';
-import apply from './apply';
-import asyncify from './asyncify';
-import auto from './auto';
-import cargo from './cargo';
-import compose from './compose';
-import concat from './concat';
-import concatSeries from './concatSeries';
-import constant from './constant';
-import detect from './detect';
-import detectLimit from './detectLimit';
-import detectSeries from './detectSeries';
-import dir from './dir';
-import doDuring from './doDuring';
-import doUntil from './doUntil';
-import doWhilst from './doWhilst';
-import during from './during';
-import each from './each';
-import eachLimit from './eachLimit';
-import eachOf from './eachOf';
-import eachOfLimit from './eachOfLimit';
-import eachOfSeries from './eachOfSeries';
-import eachSeries from './eachSeries';
-import ensureAsync from './ensureAsync';
-import every from './every';
-import everyLimit from './everyLimit';
-import filter from './filter';
-import filterLimit from './filterLimit';
-import filterSeries from './filterSeries';
-import forever from './forever';
-import iterator from './iterator';
-import log from './log';
-import map from './map';
-import mapLimit from './mapLimit';
-import mapSeries from './mapSeries';
-import memoize from './memoize';
-import nextTick from './nextTick';
-import parallel from './parallel';
-import parallelLimit from './parallelLimit';
-import priorityQueue from './priorityQueue';
-import queue from './queue';
-import reduce from './reduce';
-import reduceRight from './reduceRight';
-import reject from './reject';
-import rejectLimit from './rejectLimit';
-import rejectSeries from './rejectSeries';
-import retry from './retry';
-import seq from './seq';
-import series from './series';
-import setImmediate from './setImmediate';
-import some from './some';
-import someLimit from './someLimit';
-import sortBy from './sortBy';
-import times from './times';
-import timesLimit from './timesLimit';
-import timesSeries from './timesSeries';
-import transform from './transform';
-import unmemoize from './unmemoize';
-import until from './until';
-import waterfall from './waterfall';
-import whilst from './whilst';
-
-export default {
- applyEach: applyEach,
- applyEachSeries: applyEachSeries,
- apply: apply,
- asyncify: asyncify,
- auto: auto,
- cargo: cargo,
- compose: compose,
- concat: concat,
- concatSeries: concatSeries,
- constant: constant,
- detect: detect,
- detectLimit: detectLimit,
- detectSeries: detectSeries,
- dir: dir,
- doDuring: doDuring,
- doUntil: doUntil,
- doWhilst: doWhilst,
- during: during,
- each: each,
- eachLimit: eachLimit,
- eachOf: eachOf,
- eachOfLimit: eachOfLimit,
- eachOfSeries: eachOfSeries,
- eachSeries: eachSeries,
- ensureAsync: ensureAsync,
- every: every,
- everyLimit: everyLimit,
- filter: filter,
- filterLimit: filterLimit,
- filterSeries: filterSeries,
- forever: forever,
- iterator: iterator,
- log: log,
- map: map,
- mapLimit: mapLimit,
- mapSeries: mapSeries,
- memoize: memoize,
- nextTick: nextTick,
- parallel: parallel,
- parallelLimit: parallelLimit,
- priorityQueue: priorityQueue,
- queue: queue,
- reduce: reduce,
- reduceRight: reduceRight,
- reject: reject,
- rejectLimit: rejectLimit,
- rejectSeries: rejectSeries,
- retry: retry,
- seq: seq,
- series: series,
- setImmediate: setImmediate,
- some: some,
- someLimit: someLimit,
- sortBy: sortBy,
- times: times,
- timesLimit: timesLimit,
- timesSeries: timesSeries,
- transform: transform,
- unmemoize: unmemoize,
- until: until,
- waterfall: waterfall,
- whilst: whilst,
-
- // aliases
- all: every,
- any: some,
- forEach: each,
- forEachSeries: eachSeries,
- forEachLimit: eachLimit,
- forEachOf: eachOf,
- forEachOfSeries: eachOfSeries,
- forEachOfLimit: eachOfLimit,
- inject: reduce,
- foldl: reduce,
- foldr: reduceRight,
- select: filter,
- selectLimit: filterLimit,
- selectSeries: filterSeries,
- wrapSync: asyncify
-};
-
-export { applyEach, applyEachSeries, apply, asyncify, auto, cargo, compose, concat, concatSeries, constant, detect, detectLimit, detectSeries, dir, doDuring, doUntil, doWhilst, during, each, eachLimit, eachOf, eachOfLimit, eachOfSeries, eachSeries, ensureAsync, every, everyLimit, filter, filterLimit, filterSeries, forever, iterator, log, map, mapLimit, mapSeries, memoize, nextTick, parallel, parallelLimit, priorityQueue, queue, reduce, reduceRight, reject, rejectLimit, rejectSeries, retry, seq, series, setImmediate, some, someLimit, sortBy, times, timesLimit, timesSeries, transform, unmemoize, until, waterfall, whilst,
-
-// Aliases
-every as all, some as any, each as forEach, eachSeries as forEachSeries, eachLimit as forEachLimit, eachOf as forEachOf, eachOfSeries as forEachOfSeries, eachOfLimit as forEachOfLimit, reduce as inject, reduce as foldl, reduceRight as foldr, filter as select, filterLimit as selectLimit, filterSeries as selectSeries, asyncify as wrapSync }; \ No newline at end of file
diff --git a/build/modules-es6/internal/applyEach.js b/build/modules-es6/internal/applyEach.js
deleted file mode 100644
index a11b0bd..0000000
--- a/build/modules-es6/internal/applyEach.js
+++ /dev/null
@@ -1,20 +0,0 @@
-'use strict';
-
-import rest from '../../../deps/lodash-es/function/rest';
-
-export default function _applyEach(eachfn) {
- return rest(function (fns, args) {
- var go = rest(function (args) {
- var that = this;
- var callback = args.pop();
- return eachfn(fns, function (fn, _, cb) {
- fn.apply(that, args.concat([cb]));
- }, callback);
- });
- if (args.length) {
- return go.apply(this, args);
- } else {
- return go;
- }
- });
-} \ No newline at end of file
diff --git a/build/modules-es6/internal/concat.js b/build/modules-es6/internal/concat.js
deleted file mode 100644
index 94c56e7..0000000
--- a/build/modules-es6/internal/concat.js
+++ /dev/null
@@ -1,13 +0,0 @@
-'use strict';
-
-export default function concat(eachfn, arr, fn, callback) {
- var result = [];
- eachfn(arr, function (x, index, cb) {
- fn(x, function (err, y) {
- result = result.concat(y || []);
- cb(err);
- });
- }, function (err) {
- callback(err, result);
- });
-} \ No newline at end of file
diff --git a/build/modules-es6/internal/consoleFunc.js b/build/modules-es6/internal/consoleFunc.js
deleted file mode 100644
index e0048f1..0000000
--- a/build/modules-es6/internal/consoleFunc.js
+++ /dev/null
@@ -1,22 +0,0 @@
-'use strict';
-
-import arrayEach from '../../../deps/lodash-es/internal/arrayEach';
-import rest from '../../../deps/lodash-es/function/rest';
-
-export default function consoleFunc(name) {
- return rest(function (fn, args) {
- fn.apply(null, args.concat([rest(function (err, args) {
- if (typeof console === 'object') {
- if (err) {
- if (console.error) {
- console.error(err);
- }
- } else if (console[name]) {
- arrayEach(args, function (x) {
- console[name](x);
- });
- }
- }
- })]));
- });
-} \ No newline at end of file
diff --git a/build/modules-es6/internal/createTester.js b/build/modules-es6/internal/createTester.js
deleted file mode 100644
index 61a2d7d..0000000
--- a/build/modules-es6/internal/createTester.js
+++ /dev/null
@@ -1,26 +0,0 @@
-'use strict';
-
-export default function _createTester(eachfn, check, getResult) {
- return function (arr, limit, iterator, cb) {
- function done() {
- if (cb) cb(getResult(false, void 0));
- }
- function iteratee(x, _, callback) {
- if (!cb) return callback();
- iterator(x, function (v) {
- if (cb && check(v)) {
- cb(getResult(true, x));
- cb = iterator = false;
- }
- callback();
- });
- }
- if (arguments.length > 3) {
- eachfn(arr, limit, iteratee, done);
- } else {
- cb = iterator;
- iterator = limit;
- eachfn(arr, iteratee, done);
- }
- };
-} \ No newline at end of file
diff --git a/build/modules-es6/internal/doParallel.js b/build/modules-es6/internal/doParallel.js
deleted file mode 100644
index a3b36f1..0000000
--- a/build/modules-es6/internal/doParallel.js
+++ /dev/null
@@ -1,9 +0,0 @@
-'use strict';
-
-import eachOf from '../eachOf';
-
-export default function doParallel(fn) {
- return function (obj, iterator, callback) {
- return fn(eachOf, obj, iterator, callback);
- };
-} \ No newline at end of file
diff --git a/build/modules-es6/internal/doParallelLimit.js b/build/modules-es6/internal/doParallelLimit.js
deleted file mode 100644
index 435826b..0000000
--- a/build/modules-es6/internal/doParallelLimit.js
+++ /dev/null
@@ -1,9 +0,0 @@
-'use strict';
-
-import eachOfLimit from './eachOfLimit';
-
-export default function doParallelLimit(fn) {
- return function (obj, limit, iterator, callback) {
- return fn(eachOfLimit(limit), obj, iterator, callback);
- };
-} \ No newline at end of file
diff --git a/build/modules-es6/internal/doSeries.js b/build/modules-es6/internal/doSeries.js
deleted file mode 100644
index 3d089e3..0000000
--- a/build/modules-es6/internal/doSeries.js
+++ /dev/null
@@ -1,9 +0,0 @@
-'use strict';
-
-import eachOfSeries from '../eachOfSeries';
-
-export default function doSeries(fn) {
- return function (obj, iterator, callback) {
- return fn(eachOfSeries, obj, iterator, callback);
- };
-} \ No newline at end of file
diff --git a/build/modules-es6/internal/eachOfLimit.js b/build/modules-es6/internal/eachOfLimit.js
deleted file mode 100644
index 4d41202..0000000
--- a/build/modules-es6/internal/eachOfLimit.js
+++ /dev/null
@@ -1,48 +0,0 @@
-'use strict';
-
-import noop from '../../../deps/lodash-es/utility/noop';
-import once from '../../../deps/lodash-es/function/once';
-
-import keyIterator from './keyIterator';
-import onlyOnce from './onlyOnce';
-
-export default function _eachOfLimit(limit) {
- return function (obj, iterator, callback) {
- callback = once(callback || noop);
- obj = obj || [];
- var nextKey = keyIterator(obj);
- if (limit <= 0) {
- return callback(null);
- }
- var done = false;
- var running = 0;
- var errored = false;
-
- (function replenish() {
- if (done && running <= 0) {
- return callback(null);
- }
-
- while (running < limit && !errored) {
- var key = nextKey();
- if (key === null) {
- done = true;
- if (running <= 0) {
- callback(null);
- }
- return;
- }
- running += 1;
- iterator(obj[key], key, onlyOnce(function (err) {
- running -= 1;
- if (err) {
- callback(err);
- errored = true;
- } else {
- replenish();
- }
- }));
- }
- })();
- };
-} \ No newline at end of file
diff --git a/build/modules-es6/internal/filter.js b/build/modules-es6/internal/filter.js
deleted file mode 100644
index 002d8b2..0000000
--- a/build/modules-es6/internal/filter.js
+++ /dev/null
@@ -1,20 +0,0 @@
-'use strict';
-
-import arrayMap from '../../../deps/lodash-es/internal/arrayMap';
-import property from '../../../deps/lodash-es/utility/property';
-
-export default function _filter(eachfn, arr, iterator, callback) {
- var results = [];
- eachfn(arr, function (x, index, callback) {
- iterator(x, function (v) {
- if (v) {
- results.push({ index: index, value: x });
- }
- callback();
- });
- }, function () {
- callback(arrayMap(results.sort(function (a, b) {
- return a.index - b.index;
- }), property('value')));
- });
-} \ No newline at end of file
diff --git a/build/modules-es6/internal/findGetResult.js b/build/modules-es6/internal/findGetResult.js
deleted file mode 100644
index a3a3bc1..0000000
--- a/build/modules-es6/internal/findGetResult.js
+++ /dev/null
@@ -1,5 +0,0 @@
-'use strict';
-
-export default function _findGetResult(v, x) {
- return x;
-} \ No newline at end of file
diff --git a/build/modules-es6/internal/keyIterator.js b/build/modules-es6/internal/keyIterator.js
deleted file mode 100644
index 570aea2..0000000
--- a/build/modules-es6/internal/keyIterator.js
+++ /dev/null
@@ -1,23 +0,0 @@
-'use strict';
-
-import isArrayLike from '../../../deps/lodash-es/lang/isArrayLike';
-import keys from '../../../deps/lodash-es/object/keys';
-
-export default function keyIterator(coll) {
- var i = -1;
- var len;
- if (isArrayLike(coll)) {
- len = coll.length;
- return function next() {
- i++;
- return i < len ? i : null;
- };
- } else {
- var okeys = keys(coll);
- len = okeys.length;
- return function next() {
- i++;
- return i < len ? okeys[i] : null;
- };
- }
-} \ No newline at end of file
diff --git a/build/modules-es6/internal/map.js b/build/modules-es6/internal/map.js
deleted file mode 100644
index 4120bee..0000000
--- a/build/modules-es6/internal/map.js
+++ /dev/null
@@ -1,19 +0,0 @@
-'use strict';
-
-import isArrayLike from '../../../deps/lodash-es/lang/isArrayLike';
-import noop from '../../../deps/lodash-es/utility/noop';
-import once from '../../../deps/lodash-es/function/once';
-
-export default function _asyncMap(eachfn, arr, iterator, callback) {
- callback = once(callback || noop);
- arr = arr || [];
- var results = isArrayLike(arr) ? [] : {};
- eachfn(arr, function (value, index, callback) {
- iterator(value, function (err, v) {
- results[index] = v;
- callback(err);
- });
- }, function (err) {
- callback(err, results);
- });
-} \ No newline at end of file
diff --git a/build/modules-es6/internal/notId.js b/build/modules-es6/internal/notId.js
deleted file mode 100644
index adf0350..0000000
--- a/build/modules-es6/internal/notId.js
+++ /dev/null
@@ -1,5 +0,0 @@
-'use strict';
-
-export default function notId(v) {
- return !v;
-} \ No newline at end of file
diff --git a/build/modules-es6/internal/onlyOnce.js b/build/modules-es6/internal/onlyOnce.js
deleted file mode 100644
index 29481e9..0000000
--- a/build/modules-es6/internal/onlyOnce.js
+++ /dev/null
@@ -1,9 +0,0 @@
-'use strict';
-
-export default function onlyOnce(fn) {
- return function () {
- if (fn === null) throw new Error("Callback was already called.");
- fn.apply(this, arguments);
- fn = null;
- };
-} \ No newline at end of file
diff --git a/build/modules-es6/internal/parallel.js b/build/modules-es6/internal/parallel.js
deleted file mode 100644
index c1abfb2..0000000
--- a/build/modules-es6/internal/parallel.js
+++ /dev/null
@@ -1,22 +0,0 @@
-'use strict';
-
-import noop from '../../../deps/lodash-es/utility/noop';
-import isArrayLike from '../../../deps/lodash-es/lang/isArrayLike';
-import rest from '../../../deps/lodash-es/function/rest';
-
-export default function _parallel(eachfn, tasks, callback) {
- callback = callback || noop;
- var results = isArrayLike(tasks) ? [] : {};
-
- eachfn(tasks, function (task, key, callback) {
- task(rest(function (err, args) {
- if (args.length <= 1) {
- args = args[0];
- }
- results[key] = args;
- callback(err);
- }));
- }, function (err) {
- callback(err, results);
- });
-} \ No newline at end of file
diff --git a/build/modules-es6/internal/queue.js b/build/modules-es6/internal/queue.js
deleted file mode 100644
index ec07d2f..0000000
--- a/build/modules-es6/internal/queue.js
+++ /dev/null
@@ -1,139 +0,0 @@
-'use strict';
-
-import arrayEach from '../../../deps/lodash-es/internal/arrayEach';
-import arrayMap from '../../../deps/lodash-es/internal/arrayMap';
-import isArray from '../../../deps/lodash-es/lang/isArray';
-import noop from '../../../deps/lodash-es/utility/noop';
-import property from '../../../deps/lodash-es/utility/property';
-
-import onlyOnce from './onlyOnce';
-import setImmediate from './setImmediate';
-
-export default function queue(worker, concurrency, payload) {
- if (concurrency == null) {
- concurrency = 1;
- } else if (concurrency === 0) {
- throw new Error('Concurrency must not be zero');
- }
- function _insert(q, data, pos, callback) {
- if (callback != null && typeof callback !== 'function') {
- throw new Error('task callback must be a function');
- }
- q.started = true;
- if (!isArray(data)) {
- data = [data];
- }
- if (data.length === 0 && q.idle()) {
- // call drain immediately if there are no tasks
- return setImmediate(function () {
- q.drain();
- });
- }
- arrayEach(data, function (task) {
- var item = {
- data: task,
- callback: callback || noop
- };
-
- if (pos) {
- q.tasks.unshift(item);
- } else {
- q.tasks.push(item);
- }
-
- if (q.tasks.length === q.concurrency) {
- q.saturated();
- }
- });
- setImmediate(q.process);
- }
- function _next(q, tasks) {
- return function () {
- workers -= 1;
-
- var removed = false;
- var args = arguments;
- arrayEach(tasks, function (task) {
- arrayEach(workersList, function (worker, index) {
- if (worker === task && !removed) {
- workersList.splice(index, 1);
- removed = true;
- }
- });
-
- task.callback.apply(task, args);
- });
- if (q.tasks.length + workers === 0) {
- q.drain();
- }
- q.process();
- };
- }
-
- var workers = 0;
- var workersList = [];
- var q = {
- tasks: [],
- concurrency: concurrency,
- payload: payload,
- saturated: noop,
- empty: noop,
- drain: noop,
- started: false,
- paused: false,
- push: function (data, callback) {
- _insert(q, data, false, callback);
- },
- kill: function () {
- q.drain = noop;
- q.tasks = [];
- },
- unshift: function (data, callback) {
- _insert(q, data, true, callback);
- },
- process: function () {
- while (!q.paused && workers < q.concurrency && q.tasks.length) {
-
- var tasks = q.payload ? q.tasks.splice(0, q.payload) : q.tasks.splice(0, q.tasks.length);
-
- var data = arrayMap(tasks, property('data'));
-
- if (q.tasks.length === 0) {
- q.empty();
- }
- workers += 1;
- workersList.push(tasks[0]);
- var cb = onlyOnce(_next(q, tasks));
- worker(data, cb);
- }
- },
- length: function () {
- return q.tasks.length;
- },
- running: function () {
- return workers;
- },
- workersList: function () {
- return workersList;
- },
- idle: function () {
- return q.tasks.length + workers === 0;
- },
- pause: function () {
- q.paused = true;
- },
- resume: function () {
- if (q.paused === false) {
- return;
- }
- q.paused = false;
- var resumeCount = Math.min(q.concurrency, q.tasks.length);
- // Need to call q.process once per concurrent
- // worker to preserve full concurrency after pause
- for (var w = 1; w <= resumeCount; w++) {
- setImmediate(q.process);
- }
- }
- };
- return q;
-} \ No newline at end of file
diff --git a/build/modules-es6/internal/reject.js b/build/modules-es6/internal/reject.js
deleted file mode 100644
index a3807e3..0000000
--- a/build/modules-es6/internal/reject.js
+++ /dev/null
@@ -1,11 +0,0 @@
-'use strict';
-
-import filter from './filter';
-
-export default function reject(eachfn, arr, iterator, callback) {
- filter(eachfn, arr, function (value, cb) {
- iterator(value, function (v) {
- cb(!v);
- });
- }, callback);
-} \ No newline at end of file
diff --git a/build/modules-es6/internal/setImmediate.js b/build/modules-es6/internal/setImmediate.js
deleted file mode 100644
index ff6fa2c..0000000
--- a/build/modules-es6/internal/setImmediate.js
+++ /dev/null
@@ -1,19 +0,0 @@
-'use strict';
-
-var _setImmediate = typeof setImmediate === 'function' && setImmediate;
-
-var _delay;
-if (_setImmediate) {
- _delay = function (fn) {
- // not a direct alias for IE10 compatibility
- _setImmediate(fn);
- };
-} else if (typeof process === 'object' && typeof process.nextTick === 'function') {
- _delay = process.nextTick;
-} else {
- _delay = function (fn) {
- setTimeout(fn, 0);
- };
-}
-
-export default _delay; \ No newline at end of file
diff --git a/build/modules-es6/internal/withoutIndex.js b/build/modules-es6/internal/withoutIndex.js
deleted file mode 100644
index 9983ef6..0000000
--- a/build/modules-es6/internal/withoutIndex.js
+++ /dev/null
@@ -1,7 +0,0 @@
-'use strict';
-
-export default function _withoutIndex(iterator) {
- return function (value, index, callback) {
- return iterator(value, callback);
- };
-} \ No newline at end of file
diff --git a/build/modules-es6/iterator.js b/build/modules-es6/iterator.js
deleted file mode 100644
index 6b63afb..0000000
--- a/build/modules-es6/iterator.js
+++ /dev/null
@@ -1,17 +0,0 @@
-'use strict';
-
-export default function (tasks) {
- function makeCallback(index) {
- function fn() {
- if (tasks.length) {
- tasks[index].apply(null, arguments);
- }
- return fn.next();
- }
- fn.next = function () {
- return index < tasks.length - 1 ? makeCallback(index + 1) : null;
- };
- return fn;
- }
- return makeCallback(0);
-} \ No newline at end of file
diff --git a/build/modules-es6/log.js b/build/modules-es6/log.js
deleted file mode 100644
index a5fac82..0000000
--- a/build/modules-es6/log.js
+++ /dev/null
@@ -1,5 +0,0 @@
-'use strict';
-
-import consoleFunc from './internal/consoleFunc';
-
-export default consoleFunc('log'); \ No newline at end of file
diff --git a/build/modules-es6/map.js b/build/modules-es6/map.js
deleted file mode 100644
index f76e7ea..0000000
--- a/build/modules-es6/map.js
+++ /dev/null
@@ -1,6 +0,0 @@
-'use strict';
-
-import doParallel from './internal/doParallel';
-import map from './internal/map';
-
-export default doParallel(map); \ No newline at end of file
diff --git a/build/modules-es6/mapLimit.js b/build/modules-es6/mapLimit.js
deleted file mode 100644
index 4dcccb1..0000000
--- a/build/modules-es6/mapLimit.js
+++ /dev/null
@@ -1,6 +0,0 @@
-'use strict';
-
-import doParallelLimit from './internal/doParallelLimit';
-import map from './internal/map';
-
-export default doParallelLimit(map); \ No newline at end of file
diff --git a/build/modules-es6/mapSeries.js b/build/modules-es6/mapSeries.js
deleted file mode 100644
index a4f928e..0000000
--- a/build/modules-es6/mapSeries.js
+++ /dev/null
@@ -1,6 +0,0 @@
-'use strict';
-
-import map from './internal/map';
-import doSeries from './internal/doSeries';
-
-export default doSeries(map); \ No newline at end of file
diff --git a/build/modules-es6/memoize.js b/build/modules-es6/memoize.js
deleted file mode 100644
index 4869ed1..0000000
--- a/build/modules-es6/memoize.js
+++ /dev/null
@@ -1,36 +0,0 @@
-'use strict';
-
-import identity from '../../deps/lodash-es/utility/identity';
-import rest from '../../deps/lodash-es/function/rest';
-
-import setImmediate from './internal/setImmediate';
-
-export default function memoize(fn, hasher) {
- var memo = {};
- var queues = {};
- hasher = hasher || identity;
- var memoized = rest(function memoized(args) {
- var callback = args.pop();
- var key = hasher.apply(null, args);
- if (key in memo) {
- setImmediate(function () {
- callback.apply(null, memo[key]);
- });
- } else if (key in queues) {
- queues[key].push(callback);
- } else {
- queues[key] = [callback];
- fn.apply(null, args.concat([rest(function (args) {
- memo[key] = args;
- var q = queues[key];
- delete queues[key];
- for (var i = 0, l = q.length; i < l; i++) {
- q[i].apply(null, args);
- }
- })]));
- }
- });
- memoized.memo = memo;
- memoized.unmemoized = fn;
- return memoized;
-} \ No newline at end of file
diff --git a/build/modules-es6/nextTick.js b/build/modules-es6/nextTick.js
deleted file mode 100644
index 981b520..0000000
--- a/build/modules-es6/nextTick.js
+++ /dev/null
@@ -1,7 +0,0 @@
-'use strict';
-
-import setImmediate from './internal/setImmediate';
-
-var nexTick = typeof process === 'object' && typeof process.nextTick === 'function' ? process.nextTick : setImmediate;
-
-export default nexTick; \ No newline at end of file
diff --git a/build/modules-es6/parallel.js b/build/modules-es6/parallel.js
deleted file mode 100644
index 795fcbb..0000000
--- a/build/modules-es6/parallel.js
+++ /dev/null
@@ -1,8 +0,0 @@
-'use strict';
-
-import _parallel from './internal/parallel';
-import eachOf from './eachOf';
-
-export default function parallel(tasks, cb) {
- return _parallel(eachOf, tasks, cb);
-} \ No newline at end of file
diff --git a/build/modules-es6/parallelLimit.js b/build/modules-es6/parallelLimit.js
deleted file mode 100644
index d31b809..0000000
--- a/build/modules-es6/parallelLimit.js
+++ /dev/null
@@ -1,8 +0,0 @@
-'use strict';
-
-import eachOfLimit from './internal/eachOfLimit';
-import parallel from './internal/parallel';
-
-export default function parallelLimit(tasks, limit, cb) {
- return parallel(eachOfLimit(limit), tasks, cb);
-} \ No newline at end of file
diff --git a/build/modules-es6/priorityQueue.js b/build/modules-es6/priorityQueue.js
deleted file mode 100644
index b7a8bf0..0000000
--- a/build/modules-es6/priorityQueue.js
+++ /dev/null
@@ -1,72 +0,0 @@
-'use strict';
-
-import arrayEach from '../../deps/lodash-es/internal/arrayEach';
-import isArray from '../../deps/lodash-es/lang/isArray';
-import noop from '../../deps/lodash-es/utility/noop';
-
-import setImmediate from './setImmediate';
-
-import queue from './queue';
-
-export default function (worker, concurrency) {
- function _compareTasks(a, b) {
- return a.priority - b.priority;
- }
-
- function _binarySearch(sequence, item, compare) {
- var beg = -1,
- end = sequence.length - 1;
- while (beg < end) {
- var mid = beg + (end - beg + 1 >>> 1);
- if (compare(item, sequence[mid]) >= 0) {
- beg = mid;
- } else {
- end = mid - 1;
- }
- }
- return beg;
- }
-
- function _insert(q, data, priority, callback) {
- if (callback != null && typeof callback !== 'function') {
- throw new Error('task callback must be a function');
- }
- q.started = true;
- if (!isArray(data)) {
- data = [data];
- }
- if (data.length === 0) {
- // call drain immediately if there are no tasks
- return setImmediate(function () {
- q.drain();
- });
- }
- arrayEach(data, function (task) {
- var item = {
- data: task,
- priority: priority,
- callback: typeof callback === 'function' ? callback : noop
- };
-
- q.tasks.splice(_binarySearch(q.tasks, item, _compareTasks) + 1, 0, item);
-
- if (q.tasks.length === q.concurrency) {
- q.saturated();
- }
- setImmediate(q.process);
- });
- }
-
- // Start with a normal queue
- var q = queue(worker, concurrency);
-
- // Override push to accept second parameter representing priority
- q.push = function (data, priority, callback) {
- _insert(q, data, priority, callback);
- };
-
- // Remove unshift function
- delete q.unshift;
-
- return q;
-} \ No newline at end of file
diff --git a/build/modules-es6/queue.js b/build/modules-es6/queue.js
deleted file mode 100644
index eefd0fc..0000000
--- a/build/modules-es6/queue.js
+++ /dev/null
@@ -1,9 +0,0 @@
-'use strict';
-
-import queue from './internal/queue';
-
-export default function (worker, concurrency) {
- return queue(function (items, cb) {
- worker(items[0], cb);
- }, concurrency, 1);
-} \ No newline at end of file
diff --git a/build/modules-es6/reduce.js b/build/modules-es6/reduce.js
deleted file mode 100644
index 4961aa8..0000000
--- a/build/modules-es6/reduce.js
+++ /dev/null
@@ -1,14 +0,0 @@
-'use strict';
-
-import eachOfSeries from './eachOfSeries';
-
-export default function reduce(arr, memo, iterator, cb) {
- eachOfSeries(arr, function (x, i, cb) {
- iterator(memo, x, function (err, v) {
- memo = v;
- cb(err);
- });
- }, function (err) {
- cb(err, memo);
- });
-} \ No newline at end of file
diff --git a/build/modules-es6/reduceRight.js b/build/modules-es6/reduceRight.js
deleted file mode 100644
index 40c1834..0000000
--- a/build/modules-es6/reduceRight.js
+++ /dev/null
@@ -1,9 +0,0 @@
-'use strict';
-
-import toArray from '../../deps/lodash-es/lang/toArray';
-import reduce from './reduce';
-
-export default function reduceRight(arr, memo, iterator, cb) {
- var reversed = toArray(arr).reverse();
- reduce(reversed, memo, iterator, cb);
-} \ No newline at end of file
diff --git a/build/modules-es6/reject.js b/build/modules-es6/reject.js
deleted file mode 100644
index 983e1e0..0000000
--- a/build/modules-es6/reject.js
+++ /dev/null
@@ -1,6 +0,0 @@
-'use strict';
-
-import reject from './internal/reject';
-import doParallel from './internal/doParallel';
-
-export default doParallel(reject); \ No newline at end of file
diff --git a/build/modules-es6/rejectLimit.js b/build/modules-es6/rejectLimit.js
deleted file mode 100644
index f4a02f8..0000000
--- a/build/modules-es6/rejectLimit.js
+++ /dev/null
@@ -1,6 +0,0 @@
-'use strict';
-
-import reject from './internal/reject';
-import doParallelLimit from './internal/doParallelLimit';
-
-export default doParallelLimit(reject); \ No newline at end of file
diff --git a/build/modules-es6/rejectSeries.js b/build/modules-es6/rejectSeries.js
deleted file mode 100644
index 9052546..0000000
--- a/build/modules-es6/rejectSeries.js
+++ /dev/null
@@ -1,6 +0,0 @@
-'use strict';
-
-import reject from './internal/reject';
-import doSeries from './internal/doSeries';
-
-export default doSeries(reject); \ No newline at end of file
diff --git a/build/modules-es6/retry.js b/build/modules-es6/retry.js
deleted file mode 100644
index 209f71b..0000000
--- a/build/modules-es6/retry.js
+++ /dev/null
@@ -1,77 +0,0 @@
-'use strict';
-
-import series from './series';
-
-export default function retry(times, task, callback) {
- var DEFAULT_TIMES = 5;
- var DEFAULT_INTERVAL = 0;
-
- var attempts = [];
-
- var opts = {
- times: DEFAULT_TIMES,
- interval: DEFAULT_INTERVAL
- };
-
- function parseTimes(acc, t) {
- if (typeof t === 'number') {
- acc.times = parseInt(t, 10) || DEFAULT_TIMES;
- } else if (typeof t === 'object') {
- acc.times = parseInt(t.times, 10) || DEFAULT_TIMES;
- acc.interval = parseInt(t.interval, 10) || DEFAULT_INTERVAL;
- } else {
- throw new Error('Unsupported argument type for \'times\': ' + typeof t);
- }
- }
-
- var length = arguments.length;
- if (length < 1 || length > 3) {
- throw new Error('Invalid arguments - must be either (task), (task, callback), (times, task) or (times, task, callback)');
- } else if (length <= 2 && typeof times === 'function') {
- callback = task;
- task = times;
- }
- if (typeof times !== 'function') {
- parseTimes(opts, times);
- }
- opts.callback = callback;
- opts.task = task;
-
- function wrappedTask(wrappedCallback, wrappedResults) {
- function retryAttempt(task, finalAttempt) {
- return function (seriesCallback) {
- task(function (err, result) {
- seriesCallback(!err || finalAttempt, {
- err: err,
- result: result
- });
- }, wrappedResults);
- };
- }
-
- function retryInterval(interval) {
- return function (seriesCallback) {
- setTimeout(function () {
- seriesCallback(null);
- }, interval);
- };
- }
-
- while (opts.times) {
-
- var finalAttempt = !(opts.times -= 1);
- attempts.push(retryAttempt(opts.task, finalAttempt));
- if (!finalAttempt && opts.interval > 0) {
- attempts.push(retryInterval(opts.interval));
- }
- }
-
- series(attempts, function (done, data) {
- data = data[data.length - 1];
- (wrappedCallback || opts.callback)(data.err, data.result);
- });
- }
-
- // If a callback is passed, run this as a controll flow
- return opts.callback ? wrappedTask() : wrappedTask;
-} \ No newline at end of file
diff --git a/build/modules-es6/seq.js b/build/modules-es6/seq.js
deleted file mode 100644
index ad04d82..0000000
--- a/build/modules-es6/seq.js
+++ /dev/null
@@ -1,27 +0,0 @@
-'use strict';
-
-import noop from '../../deps/lodash-es/utility/noop';
-import reduce from './reduce';
-import rest from '../../deps/lodash-es/function/rest';
-
-export default function seq() /* functions... */{
- var fns = arguments;
- return rest(function (args) {
- var that = this;
-
- var cb = args[args.length - 1];
- if (typeof cb == 'function') {
- args.pop();
- } else {
- cb = noop;
- }
-
- reduce(fns, args, function (newargs, fn, cb) {
- fn.apply(that, newargs.concat([rest(function (err, nextargs) {
- cb(err, nextargs);
- })]));
- }, function (err, results) {
- cb.apply(that, [err].concat(results));
- });
- });
-} \ No newline at end of file
diff --git a/build/modules-es6/series.js b/build/modules-es6/series.js
deleted file mode 100644
index 1c6df91..0000000
--- a/build/modules-es6/series.js
+++ /dev/null
@@ -1,8 +0,0 @@
-'use strict';
-
-import parallel from './internal/parallel';
-import eachOfSeries from './eachOfSeries';
-
-export default function series(tasks, cb) {
- return parallel(eachOfSeries, tasks, cb);
-} \ No newline at end of file
diff --git a/build/modules-es6/setImmediate.js b/build/modules-es6/setImmediate.js
deleted file mode 100644
index e8b192b..0000000
--- a/build/modules-es6/setImmediate.js
+++ /dev/null
@@ -1,5 +0,0 @@
-'use strict';
-
-import setImmediate from './internal/setImmediate';
-
-export default setImmediate; \ No newline at end of file
diff --git a/build/modules-es6/some.js b/build/modules-es6/some.js
deleted file mode 100644
index f783a0c..0000000
--- a/build/modules-es6/some.js
+++ /dev/null
@@ -1,8 +0,0 @@
-'use strict';
-
-import identity from '../../deps/lodash-es/utility/identity';
-
-import createTester from './internal/createTester';
-import eachOf from './eachOf';
-
-export default createTester(eachOf, Boolean, identity); \ No newline at end of file
diff --git a/build/modules-es6/someLimit.js b/build/modules-es6/someLimit.js
deleted file mode 100644
index 445125f..0000000
--- a/build/modules-es6/someLimit.js
+++ /dev/null
@@ -1,7 +0,0 @@
-'use strict';
-
-import createTester from './internal/createTester';
-import eachOfLimit from './eachOfLimit';
-import identity from '../../deps/lodash-es/utility/identity';
-
-export default createTester(eachOfLimit, Boolean, identity); \ No newline at end of file
diff --git a/build/modules-es6/sortBy.js b/build/modules-es6/sortBy.js
deleted file mode 100644
index d491fda..0000000
--- a/build/modules-es6/sortBy.js
+++ /dev/null
@@ -1,24 +0,0 @@
-'use strict';
-
-import arrayMap from '../../deps/lodash-es/internal/arrayMap';
-import property from '../../deps/lodash-es/utility/property';
-
-import map from './map';
-
-export default function sortBy(arr, iterator, cb) {
- map(arr, function (x, cb) {
- iterator(x, function (err, criteria) {
- if (err) return cb(err);
- cb(null, { value: x, criteria: criteria });
- });
- }, function (err, results) {
- if (err) return cb(err);
- cb(null, arrayMap(results.sort(comparator), property('value')));
- });
-
- function comparator(left, right) {
- var a = left.criteria,
- b = right.criteria;
- return a < b ? -1 : a > b ? 1 : 0;
- }
-} \ No newline at end of file
diff --git a/build/modules-es6/times.js b/build/modules-es6/times.js
deleted file mode 100644
index 915c582..0000000
--- a/build/modules-es6/times.js
+++ /dev/null
@@ -1,8 +0,0 @@
-'use strict';
-
-import map from './map';
-import range from '../../deps/lodash-es/utility/range';
-
-export default function (count, iterator, callback) {
- map(range(0, count), iterator, callback);
-} \ No newline at end of file
diff --git a/build/modules-es6/timesLimit.js b/build/modules-es6/timesLimit.js
deleted file mode 100644
index b2d90bb..0000000
--- a/build/modules-es6/timesLimit.js
+++ /dev/null
@@ -1,8 +0,0 @@
-'use strict';
-
-import mapLimit from './mapLimit';
-import range from '../../deps/lodash-es/utility/range';
-
-export default function timeLimit(count, limit, iterator, cb) {
- return mapLimit(range(0, count), limit, iterator, cb);
-} \ No newline at end of file
diff --git a/build/modules-es6/timesSeries.js b/build/modules-es6/timesSeries.js
deleted file mode 100644
index f886f7e..0000000
--- a/build/modules-es6/timesSeries.js
+++ /dev/null
@@ -1,8 +0,0 @@
-'use strict';
-
-import mapSeries from './mapSeries';
-import range from '../../deps/lodash-es/utility/range';
-
-export default function (count, iterator, callback) {
- mapSeries(range(0, count), iterator, callback);
-} \ No newline at end of file
diff --git a/build/modules-es6/transform.js b/build/modules-es6/transform.js
deleted file mode 100644
index a992dd8..0000000
--- a/build/modules-es6/transform.js
+++ /dev/null
@@ -1,19 +0,0 @@
-'use strict';
-
-import isArray from '../../deps/lodash-es/lang/isArray';
-
-import eachOf from './eachOf';
-
-export default function transform(arr, memo, iterator, callback) {
- if (arguments.length === 3) {
- callback = iterator;
- iterator = memo;
- memo = isArray(arr) ? [] : {};
- }
-
- eachOf(arr, function (v, k, cb) {
- iterator(memo, v, k, cb);
- }, function (err) {
- callback(err, memo);
- });
-} \ No newline at end of file
diff --git a/build/modules-es6/unmemoize.js b/build/modules-es6/unmemoize.js
deleted file mode 100644
index cedb31e..0000000
--- a/build/modules-es6/unmemoize.js
+++ /dev/null
@@ -1,7 +0,0 @@
-'use strict';
-
-export default function unmemoize(fn) {
- return function () {
- return (fn.unmemoized || fn).apply(null, arguments);
- };
-} \ No newline at end of file
diff --git a/build/modules-es6/until.js b/build/modules-es6/until.js
deleted file mode 100644
index e6c4461..0000000
--- a/build/modules-es6/until.js
+++ /dev/null
@@ -1,9 +0,0 @@
-'use strict';
-
-import whilst from './whilst';
-
-export default function until(test, iterator, cb) {
- return whilst(function () {
- return !test.apply(this, arguments);
- }, iterator, cb);
-} \ No newline at end of file
diff --git a/build/modules-es6/waterfall.js b/build/modules-es6/waterfall.js
deleted file mode 100644
index 9265a64..0000000
--- a/build/modules-es6/waterfall.js
+++ /dev/null
@@ -1,32 +0,0 @@
-'use strict';
-
-import isArray from '../../deps/lodash-es/lang/isArray';
-import noop from '../../deps/lodash-es/utility/noop';
-import once from '../../deps/lodash-es/function/once';
-import rest from '../../deps/lodash-es/function/rest';
-
-import ensureAsync from './ensureAsync';
-import iterator from './iterator';
-
-export default function (tasks, cb) {
- cb = once(cb || noop);
- if (!isArray(tasks)) return cb(new Error('First argument to waterfall must be an array of functions'));
- if (!tasks.length) return cb();
-
- function wrapIterator(iterator) {
- return rest(function (err, args) {
- if (err) {
- cb.apply(null, [err].concat(args));
- } else {
- var next = iterator.next();
- if (next) {
- args.push(wrapIterator(next));
- } else {
- args.push(cb);
- }
- ensureAsync(iterator).apply(null, args);
- }
- });
- }
- wrapIterator(iterator(tasks))();
-} \ No newline at end of file
diff --git a/build/modules-es6/whilst.js b/build/modules-es6/whilst.js
deleted file mode 100644
index 5995568..0000000
--- a/build/modules-es6/whilst.js
+++ /dev/null
@@ -1,15 +0,0 @@
-'use strict';
-
-import noop from '../../deps/lodash-es/utility/noop';
-import rest from '../../deps/lodash-es/function/rest';
-
-export default function whilst(test, iterator, cb) {
- cb = cb || noop;
- if (!test()) return cb(null);
- var next = rest(function (err, args) {
- if (err) return cb(err);
- if (test.apply(this, args)) return iterator(next);
- cb.apply(null, [null].concat(args));
- });
- iterator(next);
-} \ No newline at end of file
diff --git a/build/modules/apply.js b/build/modules/apply.js
index 4378564..a7c2642 100644
--- a/build/modules/apply.js
+++ b/build/modules/apply.js
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
-var _rest = require('../../deps/lodash-es/function/rest');
+var _rest = require('lodash/function/rest');
var _rest2 = _interopRequireDefault(_rest);
diff --git a/build/modules/asyncify.js b/build/modules/asyncify.js
index c4172ea..863c37b 100644
--- a/build/modules/asyncify.js
+++ b/build/modules/asyncify.js
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", {
});
exports.default = asyncify;
-var _isObject = require('../../deps/lodash-es/lang/isObject');
+var _isObject = require('lodash/lang/isObject');
var _isObject2 = _interopRequireDefault(_isObject);
-var _rest = require('../../deps/lodash-es/function/rest');
+var _rest = require('lodash/function/rest');
var _rest2 = _interopRequireDefault(_rest);
diff --git a/build/modules/auto.js b/build/modules/auto.js
index 5f25271..09e7a64 100644
--- a/build/modules/auto.js
+++ b/build/modules/auto.js
@@ -96,39 +96,39 @@ exports.default = function (tasks, concurrency, callback) {
});
};
-var _arrayEach = require('../../deps/lodash-es/internal/arrayEach');
+var _arrayEach = require('lodash/internal/arrayEach');
var _arrayEach2 = _interopRequireDefault(_arrayEach);
-var _arrayEvery = require('../../deps/lodash-es/internal/arrayEvery');
+var _arrayEvery = require('lodash/internal/arrayEvery');
var _arrayEvery2 = _interopRequireDefault(_arrayEvery);
-var _forOwn = require('../../deps/lodash-es/object/forOwn');
+var _forOwn = require('lodash/object/forOwn');
var _forOwn2 = _interopRequireDefault(_forOwn);
-var _indexOf = require('../../deps/lodash-es/array/indexOf');
+var _indexOf = require('lodash/array/indexOf');
var _indexOf2 = _interopRequireDefault(_indexOf);
-var _isArray = require('../../deps/lodash-es/lang/isArray');
+var _isArray = require('lodash/lang/isArray');
var _isArray2 = _interopRequireDefault(_isArray);
-var _keys = require('../../deps/lodash-es/object/keys');
+var _keys = require('lodash/object/keys');
var _keys2 = _interopRequireDefault(_keys);
-var _noop = require('../../deps/lodash-es/utility/noop');
+var _noop = require('lodash/utility/noop');
var _noop2 = _interopRequireDefault(_noop);
-var _once = require('../../deps/lodash-es/function/once');
+var _once = require('lodash/function/once');
var _once2 = _interopRequireDefault(_once);
-var _rest = require('../../deps/lodash-es/function/rest');
+var _rest = require('lodash/function/rest');
var _rest2 = _interopRequireDefault(_rest);
diff --git a/build/modules/constant.js b/build/modules/constant.js
index 3219466..c0e0bef 100644
--- a/build/modules/constant.js
+++ b/build/modules/constant.js
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
-var _rest = require('../../deps/lodash-es/function/rest');
+var _rest = require('lodash/function/rest');
var _rest2 = _interopRequireDefault(_rest);
diff --git a/build/modules/detect.js b/build/modules/detect.js
index a3a94a9..7cd7471 100644
--- a/build/modules/detect.js
+++ b/build/modules/detect.js
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
-var _identity = require('../../deps/lodash-es/utility/identity');
+var _identity = require('lodash/utility/identity');
var _identity2 = _interopRequireDefault(_identity);
diff --git a/build/modules/detectLimit.js b/build/modules/detectLimit.js
index 855bf0f..99a6946 100644
--- a/build/modules/detectLimit.js
+++ b/build/modules/detectLimit.js
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
-var _identity = require('../../deps/lodash-es/utility/identity');
+var _identity = require('lodash/utility/identity');
var _identity2 = _interopRequireDefault(_identity);
diff --git a/build/modules/detectSeries.js b/build/modules/detectSeries.js
index 4e60840..919386d 100644
--- a/build/modules/detectSeries.js
+++ b/build/modules/detectSeries.js
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
-var _identity = require('../../deps/lodash-es/utility/identity');
+var _identity = require('lodash/utility/identity');
var _identity2 = _interopRequireDefault(_identity);
diff --git a/build/modules/during.js b/build/modules/during.js
index 9e61353..8b7f9ab 100644
--- a/build/modules/during.js
+++ b/build/modules/during.js
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", {
});
exports.default = during;
-var _noop = require('../../deps/lodash-es/utility/noop');
+var _noop = require('lodash/utility/noop');
var _noop2 = _interopRequireDefault(_noop);
-var _rest = require('../../deps/lodash-es/function/rest');
+var _rest = require('lodash/function/rest');
var _rest2 = _interopRequireDefault(_rest);
diff --git a/build/modules/eachOf.js b/build/modules/eachOf.js
index 51da5b1..10c7aee 100644
--- a/build/modules/eachOf.js
+++ b/build/modules/eachOf.js
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", {
});
exports.default = eachOf;
-var _once = require('../../deps/lodash-es/function/once');
+var _once = require('lodash/function/once');
var _once2 = _interopRequireDefault(_once);
-var _noop = require('../../deps/lodash-es/utility/noop');
+var _noop = require('lodash/utility/noop');
var _noop2 = _interopRequireDefault(_noop);
diff --git a/build/modules/eachOfSeries.js b/build/modules/eachOfSeries.js
index 80c9e64..1d31969 100644
--- a/build/modules/eachOfSeries.js
+++ b/build/modules/eachOfSeries.js
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", {
});
exports.default = eachOfSeries;
-var _once = require('../../deps/lodash-es/function/once');
+var _once = require('lodash/function/once');
var _once2 = _interopRequireDefault(_once);
-var _noop = require('../../deps/lodash-es/utility/noop');
+var _noop = require('lodash/utility/noop');
var _noop2 = _interopRequireDefault(_noop);
diff --git a/build/modules/ensureAsync.js b/build/modules/ensureAsync.js
index ab53756..7421922 100644
--- a/build/modules/ensureAsync.js
+++ b/build/modules/ensureAsync.js
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
});
exports.default = ensureAsync;
-var _rest = require('../../deps/lodash-es/function/rest');
+var _rest = require('lodash/function/rest');
var _rest2 = _interopRequireDefault(_rest);
diff --git a/build/modules/forever.js b/build/modules/forever.js
index c1a70a5..e4230d3 100644
--- a/build/modules/forever.js
+++ b/build/modules/forever.js
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
});
exports.default = forever;
-var _noop = require('../../deps/lodash-es/utility/noop');
+var _noop = require('lodash/utility/noop');
var _noop2 = _interopRequireDefault(_noop);
diff --git a/build/modules/internal/applyEach.js b/build/modules/internal/applyEach.js
index b348bff..d085ea1 100644
--- a/build/modules/internal/applyEach.js
+++ b/build/modules/internal/applyEach.js
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
});
exports.default = _applyEach;
-var _rest = require('../../../deps/lodash-es/function/rest');
+var _rest = require('lodash/function/rest');
var _rest2 = _interopRequireDefault(_rest);
diff --git a/build/modules/internal/consoleFunc.js b/build/modules/internal/consoleFunc.js
index 687f2d2..6b14096 100644
--- a/build/modules/internal/consoleFunc.js
+++ b/build/modules/internal/consoleFunc.js
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", {
});
exports.default = consoleFunc;
-var _arrayEach = require('../../../deps/lodash-es/internal/arrayEach');
+var _arrayEach = require('lodash/internal/arrayEach');
var _arrayEach2 = _interopRequireDefault(_arrayEach);
-var _rest = require('../../../deps/lodash-es/function/rest');
+var _rest = require('lodash/function/rest');
var _rest2 = _interopRequireDefault(_rest);
diff --git a/build/modules/internal/eachOfLimit.js b/build/modules/internal/eachOfLimit.js
index 9c848e7..c091922 100644
--- a/build/modules/internal/eachOfLimit.js
+++ b/build/modules/internal/eachOfLimit.js
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", {
});
exports.default = _eachOfLimit;
-var _noop = require('../../../deps/lodash-es/utility/noop');
+var _noop = require('lodash/utility/noop');
var _noop2 = _interopRequireDefault(_noop);
-var _once = require('../../../deps/lodash-es/function/once');
+var _once = require('lodash/function/once');
var _once2 = _interopRequireDefault(_once);
diff --git a/build/modules/internal/filter.js b/build/modules/internal/filter.js
index 0555b62..6af3c01 100644
--- a/build/modules/internal/filter.js
+++ b/build/modules/internal/filter.js
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", {
});
exports.default = _filter;
-var _arrayMap = require('../../../deps/lodash-es/internal/arrayMap');
+var _arrayMap = require('lodash/internal/arrayMap');
var _arrayMap2 = _interopRequireDefault(_arrayMap);
-var _property = require('../../../deps/lodash-es/utility/property');
+var _property = require('lodash/utility/property');
var _property2 = _interopRequireDefault(_property);
diff --git a/build/modules/internal/keyIterator.js b/build/modules/internal/keyIterator.js
index 0cbdf63..d2a91b5 100644
--- a/build/modules/internal/keyIterator.js
+++ b/build/modules/internal/keyIterator.js
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", {
});
exports.default = keyIterator;
-var _isArrayLike = require('../../../deps/lodash-es/lang/isArrayLike');
+var _isArrayLike = require('lodash/lang/isArrayLike');
var _isArrayLike2 = _interopRequireDefault(_isArrayLike);
-var _keys = require('../../../deps/lodash-es/object/keys');
+var _keys = require('lodash/object/keys');
var _keys2 = _interopRequireDefault(_keys);
diff --git a/build/modules/internal/map.js b/build/modules/internal/map.js
index 53ab21a..c9a430e 100644
--- a/build/modules/internal/map.js
+++ b/build/modules/internal/map.js
@@ -5,15 +5,15 @@ Object.defineProperty(exports, "__esModule", {
});
exports.default = _asyncMap;
-var _isArrayLike = require('../../../deps/lodash-es/lang/isArrayLike');
+var _isArrayLike = require('lodash/lang/isArrayLike');
var _isArrayLike2 = _interopRequireDefault(_isArrayLike);
-var _noop = require('../../../deps/lodash-es/utility/noop');
+var _noop = require('lodash/utility/noop');
var _noop2 = _interopRequireDefault(_noop);
-var _once = require('../../../deps/lodash-es/function/once');
+var _once = require('lodash/function/once');
var _once2 = _interopRequireDefault(_once);
diff --git a/build/modules/internal/parallel.js b/build/modules/internal/parallel.js
index 174c613..6c90159 100644
--- a/build/modules/internal/parallel.js
+++ b/build/modules/internal/parallel.js
@@ -5,15 +5,15 @@ Object.defineProperty(exports, "__esModule", {
});
exports.default = _parallel;
-var _noop = require('../../../deps/lodash-es/utility/noop');
+var _noop = require('lodash/utility/noop');
var _noop2 = _interopRequireDefault(_noop);
-var _isArrayLike = require('../../../deps/lodash-es/lang/isArrayLike');
+var _isArrayLike = require('lodash/lang/isArrayLike');
var _isArrayLike2 = _interopRequireDefault(_isArrayLike);
-var _rest = require('../../../deps/lodash-es/function/rest');
+var _rest = require('lodash/function/rest');
var _rest2 = _interopRequireDefault(_rest);
diff --git a/build/modules/internal/queue.js b/build/modules/internal/queue.js
index 26e2d61..1ae7c95 100644
--- a/build/modules/internal/queue.js
+++ b/build/modules/internal/queue.js
@@ -5,23 +5,23 @@ Object.defineProperty(exports, "__esModule", {
});
exports.default = queue;
-var _arrayEach = require('../../../deps/lodash-es/internal/arrayEach');
+var _arrayEach = require('lodash/internal/arrayEach');
var _arrayEach2 = _interopRequireDefault(_arrayEach);
-var _arrayMap = require('../../../deps/lodash-es/internal/arrayMap');
+var _arrayMap = require('lodash/internal/arrayMap');
var _arrayMap2 = _interopRequireDefault(_arrayMap);
-var _isArray = require('../../../deps/lodash-es/lang/isArray');
+var _isArray = require('lodash/lang/isArray');
var _isArray2 = _interopRequireDefault(_isArray);
-var _noop = require('../../../deps/lodash-es/utility/noop');
+var _noop = require('lodash/utility/noop');
var _noop2 = _interopRequireDefault(_noop);
-var _property = require('../../../deps/lodash-es/utility/property');
+var _property = require('lodash/utility/property');
var _property2 = _interopRequireDefault(_property);
diff --git a/build/modules/memoize.js b/build/modules/memoize.js
index 3d719a9..63732f0 100644
--- a/build/modules/memoize.js
+++ b/build/modules/memoize.js
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", {
});
exports.default = memoize;
-var _identity = require('../../deps/lodash-es/utility/identity');
+var _identity = require('lodash/utility/identity');
var _identity2 = _interopRequireDefault(_identity);
-var _rest = require('../../deps/lodash-es/function/rest');
+var _rest = require('lodash/function/rest');
var _rest2 = _interopRequireDefault(_rest);
diff --git a/build/modules/priorityQueue.js b/build/modules/priorityQueue.js
index d1d4fa5..9e9d262 100644
--- a/build/modules/priorityQueue.js
+++ b/build/modules/priorityQueue.js
@@ -67,15 +67,15 @@ exports.default = function (worker, concurrency) {
return q;
};
-var _arrayEach = require('../../deps/lodash-es/internal/arrayEach');
+var _arrayEach = require('lodash/internal/arrayEach');
var _arrayEach2 = _interopRequireDefault(_arrayEach);
-var _isArray = require('../../deps/lodash-es/lang/isArray');
+var _isArray = require('lodash/lang/isArray');
var _isArray2 = _interopRequireDefault(_isArray);
-var _noop = require('../../deps/lodash-es/utility/noop');
+var _noop = require('lodash/utility/noop');
var _noop2 = _interopRequireDefault(_noop);
diff --git a/build/modules/reduceRight.js b/build/modules/reduceRight.js
index 6620625..7970b9a 100644
--- a/build/modules/reduceRight.js
+++ b/build/modules/reduceRight.js
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
});
exports.default = reduceRight;
-var _toArray = require('../../deps/lodash-es/lang/toArray');
+var _toArray = require('lodash/lang/toArray');
var _toArray2 = _interopRequireDefault(_toArray);
diff --git a/build/modules/seq.js b/build/modules/seq.js
index 64bad33..d1c4929 100644
--- a/build/modules/seq.js
+++ b/build/modules/seq.js
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
});
exports.default = seq;
-var _noop = require('../../deps/lodash-es/utility/noop');
+var _noop = require('lodash/utility/noop');
var _noop2 = _interopRequireDefault(_noop);
@@ -13,7 +13,7 @@ var _reduce = require('./reduce');
var _reduce2 = _interopRequireDefault(_reduce);
-var _rest = require('../../deps/lodash-es/function/rest');
+var _rest = require('lodash/function/rest');
var _rest2 = _interopRequireDefault(_rest);
diff --git a/build/modules/some.js b/build/modules/some.js
index 9312413..16408db 100644
--- a/build/modules/some.js
+++ b/build/modules/some.js
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
-var _identity = require('../../deps/lodash-es/utility/identity');
+var _identity = require('lodash/utility/identity');
var _identity2 = _interopRequireDefault(_identity);
diff --git a/build/modules/someLimit.js b/build/modules/someLimit.js
index 346b025..3da5b7a 100644
--- a/build/modules/someLimit.js
+++ b/build/modules/someLimit.js
@@ -12,7 +12,7 @@ var _eachOfLimit = require('./eachOfLimit');
var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
-var _identity = require('../../deps/lodash-es/utility/identity');
+var _identity = require('lodash/utility/identity');
var _identity2 = _interopRequireDefault(_identity);
diff --git a/build/modules/sortBy.js b/build/modules/sortBy.js
index 1d80524..b901f16 100644
--- a/build/modules/sortBy.js
+++ b/build/modules/sortBy.js
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", {
});
exports.default = sortBy;
-var _arrayMap = require('../../deps/lodash-es/internal/arrayMap');
+var _arrayMap = require('lodash/internal/arrayMap');
var _arrayMap2 = _interopRequireDefault(_arrayMap);
-var _property = require('../../deps/lodash-es/utility/property');
+var _property = require('lodash/utility/property');
var _property2 = _interopRequireDefault(_property);
diff --git a/build/modules/times.js b/build/modules/times.js
index b26f11c..d2d72be 100644
--- a/build/modules/times.js
+++ b/build/modules/times.js
@@ -12,7 +12,7 @@ var _map = require('./map');
var _map2 = _interopRequireDefault(_map);
-var _range = require('../../deps/lodash-es/utility/range');
+var _range = require('lodash/utility/range');
var _range2 = _interopRequireDefault(_range);
diff --git a/build/modules/timesLimit.js b/build/modules/timesLimit.js
index 5b58e65..a48e6a4 100644
--- a/build/modules/timesLimit.js
+++ b/build/modules/timesLimit.js
@@ -9,7 +9,7 @@ var _mapLimit = require('./mapLimit');
var _mapLimit2 = _interopRequireDefault(_mapLimit);
-var _range = require('../../deps/lodash-es/utility/range');
+var _range = require('lodash/utility/range');
var _range2 = _interopRequireDefault(_range);
diff --git a/build/modules/timesSeries.js b/build/modules/timesSeries.js
index 67af2be..66d1471 100644
--- a/build/modules/timesSeries.js
+++ b/build/modules/timesSeries.js
@@ -12,7 +12,7 @@ var _mapSeries = require('./mapSeries');
var _mapSeries2 = _interopRequireDefault(_mapSeries);
-var _range = require('../../deps/lodash-es/utility/range');
+var _range = require('lodash/utility/range');
var _range2 = _interopRequireDefault(_range);
diff --git a/build/modules/transform.js b/build/modules/transform.js
index 21c0304..59e3e92 100644
--- a/build/modules/transform.js
+++ b/build/modules/transform.js
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
});
exports.default = transform;
-var _isArray = require('../../deps/lodash-es/lang/isArray');
+var _isArray = require('lodash/lang/isArray');
var _isArray2 = _interopRequireDefault(_isArray);
diff --git a/build/modules/waterfall.js b/build/modules/waterfall.js
index 2b79b48..317add8 100644
--- a/build/modules/waterfall.js
+++ b/build/modules/waterfall.js
@@ -27,19 +27,19 @@ exports.default = function (tasks, cb) {
wrapIterator((0, _iterator2.default)(tasks))();
};
-var _isArray = require('../../deps/lodash-es/lang/isArray');
+var _isArray = require('lodash/lang/isArray');
var _isArray2 = _interopRequireDefault(_isArray);
-var _noop = require('../../deps/lodash-es/utility/noop');
+var _noop = require('lodash/utility/noop');
var _noop2 = _interopRequireDefault(_noop);
-var _once = require('../../deps/lodash-es/function/once');
+var _once = require('lodash/function/once');
var _once2 = _interopRequireDefault(_once);
-var _rest = require('../../deps/lodash-es/function/rest');
+var _rest = require('lodash/function/rest');
var _rest2 = _interopRequireDefault(_rest);
diff --git a/build/modules/whilst.js b/build/modules/whilst.js
index 8251b63..d1a9fc0 100644
--- a/build/modules/whilst.js
+++ b/build/modules/whilst.js
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", {
});
exports.default = whilst;
-var _noop = require('../../deps/lodash-es/utility/noop');
+var _noop = require('lodash/utility/noop');
var _noop2 = _interopRequireDefault(_noop);
-var _rest = require('../../deps/lodash-es/function/rest');
+var _rest = require('lodash/function/rest');
var _rest2 = _interopRequireDefault(_rest);