diff options
Diffstat (limited to 'dist')
-rw-r--r-- | dist/async.js | 3718 | ||||
-rw-r--r-- | dist/async.min.js | 2 | ||||
-rw-r--r-- | dist/async.min.map | 2 |
3 files changed, 2530 insertions, 1192 deletions
diff --git a/dist/async.js b/dist/async.js index 034bf70..0032ce5 100644 --- a/dist/async.js +++ b/dist/async.js @@ -1,1225 +1,2563 @@ -'use strict'; - -/*! - * async - * https://github.com/caolan/async - * - * Copyright 2010-2016 Caolan McMahon - * Released under the MIT license - */ -(function () { - - var async = {}; - function noop() {} - function identity(v) { - return v; +(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'; + + /** + * 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.length; + 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]); } - function toBool(v) { - return !!v; + return func.apply(thisArg, args); + } + + /** + * 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) { + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); + } + + var funcTag = '[object Function]'; + var genTag = '[object GeneratorFunction]'; + /** Used for built-in method references. */ + var objectProto$4 = Object.prototype; + + /** + * 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; + + /** + * 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$2.call(value) : ''; + return tag == funcTag || tag == genTag; + } + + /** Used as references for various `Number` constants. */ + var NAN = 0 / 0; + + /** Used to match leading and trailing whitespace. */ + var reTrim = /^\s+|\s+$/g; + + /** 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 without a dependency on `root`. */ + var freeParseInt = 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 (isObject(value)) { + var other = isFunction(value.valueOf) ? value.valueOf() : value; + value = isObject(other) ? (other + '') : other; } - function notId(v) { - return !v; + if (typeof value != 'string') { + return value === 0 ? value : +value; } - - // global on the server, window in the browser - var previous_async; - - // Establish the root object, `window` (`self`) in the browser, `global` - // on the server, or `this` in some virtual machines. We use `self` - // instead of `window` for `WebWorker` support. - var root = typeof self === 'object' && self.self === self && self || typeof global === 'object' && global.global === global && global || this; - - if (root != null) { - previous_async = root.async; + value = value.replace(reTrim, ''); + var isBinary = reIsBinary.test(value); + return (isBinary || reIsOctal.test(value)) + ? freeParseInt(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; } - - async.noConflict = function () { - root.async = previous_async; - return async; - }; - - function only_once(fn) { - return function () { - if (fn === null) throw new Error("Callback was already called."); - fn.apply(this, arguments); - fn = null; - }; + value = toNumber(value); + if (value === INFINITY || value === -INFINITY) { + var sign = (value < 0 ? -1 : 1); + return sign * MAX_INTEGER; } - - function _once(fn) { - return function () { - if (fn === null) return; - fn.apply(this, arguments); - fn = null; - }; + 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); } - - //// cross-browser compatiblity functions //// - - var _toString = Object.prototype.toString; - - var _isArray = Array.isArray || function (obj) { - return _toString.call(obj) === '[object Array]'; - }; - - // Ported from underscore.js isObject - var _isObject = function (obj) { - var type = typeof obj; - return type === 'function' || type === 'object' && !!obj; + 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 _isArrayLike(arr) { - return _isArray(arr) || - // has a positive integer length property - typeof arr.length === "number" && arr.length >= 0 && arr.length % 1 === 0; + } + + function applyEach$1(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; + } + }); + } + + /** 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); } - - function _arrayEach(arr, iterator) { - var index = -1, - length = arr.length; - - while (++index < length) { - iterator(arr[index], index, arr); - } + 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 Util + * @example + * + * var object = { 'user': 'fred' }; + * + * _.noop(object) === undefined; + * // => true + */ + function noop() { + // No operation performed. + } + + /** + * 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]; + }; + } + + /** + * 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 iteratee 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); } - - function _map(arr, iterator) { - var index = -1, - length = arr.length, - result = Array(length); - - while (++index < length) { - result[index] = iterator(arr[index], index, arr); - } - return result; + return result; + } + + /** + * 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'; + } + + /** + * 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$2 = Object.prototype; + + /** Used to check objects for own properties. */ + var hasOwnProperty$1 = objectProto$2.hasOwnProperty; + + /** + * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ + var objectToString = objectProto$2.toString; + + /** Built-in value references. */ + var propertyIsEnumerable = objectProto$2.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.call(value) == argsTag); + } + + /** + * 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; + + /** `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); + } + + /** + * 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; + if (isLength(length) && + (isArray(object) || isString(object) || isArguments(object))) { + return baseTimes(length, String); } - - function _range(count) { - return _map(Array(count), function (v, i) { - return i; - }); + return 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); } - - function _reduce(arr, iterator, memo) { - _arrayEach(arr, function (x, i, a) { - memo = iterator(memo, x, i, a); - }); - return memo; + 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); + } } - - function _forEachOf(object, iterator) { - _arrayEach(_keys(object), function (key) { - iterator(object[key], 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; + }; + } + + 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); + } + } + } + + var applyEach = applyEach$1(eachOf); + + 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(); + } + + var applyEachSeries = applyEach$1(eachOfSeries); + + var apply = rest(function (fn, args) { + return rest(function (callArgs) { + return fn.apply(null, args.concat(callArgs)); + }); + }); + + 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); + } + }); + } + + /** + * A specialized version of `_.forEach` for arrays without support for + * iteratee 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; + } } - - function _indexOf(arr, item) { - for (var i = 0; i < arr.length; i++) { - if (arr[i] === item) return i; - } - return -1; + return array; + } + + /** + * A specialized version of `_.every` for arrays without support for + * iteratee 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; + } } - - var _keys = Object.keys || function (obj) { - var keys = []; - for (var k in obj) { - if (obj.hasOwnProperty(k)) { - keys.push(k); - } + 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; } - return keys; - }; - - function _keyIterator(coll) { - var i = -1; - var len; - var keys; - if (_isArrayLike(coll)) { - len = coll.length; - return function next() { - i++; - return i < len ? i : null; - }; - } else { - keys = _keys(coll); - len = keys.length; - return function next() { - i++; - return i < len ? keys[i] : null; - }; - } - } - - // Similar to ES6's rest param (http://ariya.ofilabs.com/2013/03/es6-and-rest-parameter.html) - // This accumulates the arguments passed into an array, after a given index. - // From underscore.js (https://github.com/jashkenas/underscore/pull/2140). - function _restParam(func, startIndex) { - startIndex = startIndex == null ? func.length - 1 : +startIndex; - return function () { - var length = Math.max(arguments.length - startIndex, 0); - var rest = Array(length); - for (var index = 0; index < length; index++) { - rest[index] = arguments[index + startIndex]; - } - switch (startIndex) { - case 0: - return func.call(this, rest); - case 1: - return func.call(this, arguments[0], rest); - } - // Currently unused but handle cases outside of the switch statement: - // var args = Array(startIndex + 1); - // for (index = 0; index < startIndex; index++) { - // args[index] = arguments[index]; - // } - // args[startIndex] = rest; - // return func.apply(this, args); - }; - } - - function _withoutIndex(iterator) { - return function (value, index, callback) { - return iterator(value, callback); - }; - } - - //// exported async module functions //// - - //// nextTick implementation with browser-compatible fallback //// - - // capture the global reference to guard against fakeTimer mocks - var _setImmediate = typeof setImmediate === 'function' && setImmediate; - - var _delay = _setImmediate ? function (fn) { - // not a direct alias for IE10 compatibility - _setImmediate(fn); - } : function (fn) { - setTimeout(fn, 0); + } + return object; }; - - if (typeof process === 'object' && typeof process.nextTick === 'function') { - async.nextTick = process.nextTick; - } else { - async.nextTick = _delay; + } + + /** + * 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 iteratee 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); + } + + /** + * This method returns the first argument given to it. + * + * @static + * @memberOf _ + * @category Util + * @param {*} value Any value. + * @returns {*} Returns `value`. + * @example + * + * var object = { 'user': 'fred' }; + * + * _.identity(object) === object; + * // => true + */ + function identity(value) { + return value; + } + + /** + * 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; + } } - async.setImmediate = _setImmediate ? _delay : async.nextTick; - - async.forEach = async.each = function (arr, iterator, callback) { - return async.eachOf(arr, _withoutIndex(iterator), callback); - }; - - async.forEachSeries = async.eachSeries = function (arr, iterator, callback) { - return async.eachOfSeries(arr, _withoutIndex(iterator), callback); - }; - - async.forEachLimit = async.eachLimit = function (arr, limit, iterator, callback) { - return _eachOfLimit(limit)(arr, _withoutIndex(iterator), callback); - }; - - async.forEachOf = async.eachOf = function (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, only_once(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); - } - } - }; - - async.forEachOfSeries = async.eachOfSeries = function (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, only_once(function (err) { - if (err) { - callback(err); - } else { - key = nextKey(); - if (key === null) { - return callback(null); - } else { - if (sync) { - async.setImmediate(iterate); - } else { - iterate(); - } - } - } - })); - sync = false; - } - iterate(); - }; - - async.forEachOfLimit = async.eachOfLimit = function (obj, limit, iterator, callback) { - _eachOfLimit(limit)(obj, iterator, callback); - }; - - 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, only_once(function (err) { - running -= 1; - if (err) { - callback(err); - errored = true; - } else { - replenish(); - } - })); - } - })(); - }; + 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; - function doParallel(fn) { - return function (obj, iterator, callback) { - return fn(async.eachOf, obj, iterator, callback); - }; - } - function doParallelLimit(fn) { - return function (obj, limit, iterator, callback) { - return fn(_eachOfLimit(limit), obj, iterator, callback); - }; + while (++index < length) { + if (array[index] === value) { + return index; + } } - function doSeries(fn) { - return function (obj, iterator, callback) { - return fn(async.eachOfSeries, obj, iterator, callback); - }; + 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`. + * + * @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 + * + * // Search from the `fromIndex`. + * _.indexOf([1, 2, 1, 2], 2, 2); + * // => 3 + */ + function indexOf(array, value, fromIndex) { + var length = array ? array.length : 0; + if (!length) { + return -1; } - - 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); - }); - } - - async.map = doParallel(_asyncMap); - async.mapSeries = doSeries(_asyncMap); - async.mapLimit = doParallelLimit(_asyncMap); - - // reduce only has a series version, as doing reduce in parallel won't - // work in many situations. - async.inject = async.foldl = async.reduce = function (arr, memo, iterator, callback) { - async.eachOfSeries(arr, function (x, i, callback) { - iterator(memo, x, function (err, v) { - memo = v; - callback(err); - }); - }, function (err) { - callback(err, memo); - }); - }; - - async.foldr = async.reduceRight = function (arr, memo, iterator, callback) { - var reversed = _map(arr, identity).reverse(); - async.reduce(reversed, memo, iterator, callback); - }; - - async.transform = function (arr, memo, iterator, callback) { - if (arguments.length === 3) { - callback = iterator; - iterator = memo; - memo = _isArray(arr) ? [] : {}; - } - - async.eachOf(arr, function (v, k, cb) { - iterator(memo, v, k, cb); - }, function (err) { - callback(err, memo); - }); - }; - - 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(_map(results.sort(function (a, b) { - return a.index - b.index; - }), function (x) { - return x.value; - })); - }); + fromIndex = toInteger(fromIndex); + if (fromIndex < 0) { + fromIndex = nativeMax$1(length + fromIndex, 0); } - - async.select = async.filter = doParallel(_filter); - - async.selectLimit = async.filterLimit = doParallelLimit(_filter); - - async.selectSeries = async.filterSeries = doSeries(_filter); - - function _reject(eachfn, arr, iterator, callback) { - _filter(eachfn, arr, function (value, cb) { - iterator(value, function (v) { - cb(!v); - }); - }, callback); + 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 hasError = false; + + 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) { + if (hasError) return; + 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; + hasError = true; + + 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 non-existent dependency in ' + requires.join(', ')); + } + if (isArray(dep) && indexOf(dep, k) >= 0) { + throw new Error('Has cyclic dependencies'); + } + } + function ready() { + return runningTasks < concurrency && !baseHas(results, k) && arrayEvery(requires, function (x) { + return baseHas(results, x); + }); + } + 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); + } + } + }); + } + + /** + * A specialized version of `_.map` for arrays without support for iteratee + * 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); } - async.reject = doParallel(_reject); - async.rejectLimit = doParallelLimit(_reject); - async.rejectSeries = doSeries(_reject); - - 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); - } - }; + return result; + } + + 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, baseProperty('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 cargo(worker, payload) { + return queue$1(worker, 1, payload); + } + + 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 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)); + }); + }); + } + + var reverse = Array.prototype.reverse; + + function compose() /* functions... */{ + return seq.apply(null, reverse.call(arguments)); + } + + 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); + }); + } + + function doParallel(fn) { + return function (obj, iterator, callback) { + return fn(eachOf, obj, iterator, callback); + }; + } + + var concat = doParallel(concat$1); + + function doSeries(fn) { + return function (obj, iterator, callback) { + return fn(eachOfSeries, obj, iterator, callback); + }; + } + + var concatSeries = doSeries(concat$1); + + var constant = rest(function (values) { + var args = [null].concat(values); + return function (cb) { + return cb.apply(this, args); + }; + }); + + function _createTester(eachfn, check, getResult) { + return function (arr, limit, iterator, cb) { + function done(err) { + if (cb) { + if (err) { + cb(err); + } else { + cb(null, getResult(false, void 0)); + } + } + } + function iteratee(x, _, callback) { + if (!cb) return callback(); + iterator(x, function (err, v) { + if (cb) { + if (err) { + cb(err); + cb = iterator = false; + } else if (check(v)) { + cb(null, 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 _findGetResult(v, x) { + return x; + } + + var detect = _createTester(eachOf, identity, _findGetResult); + + 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 eachOfLimit(obj, limit, iterator, cb) { + _eachOfLimit(limit)(obj, iterator, cb); + } + + var detectLimit = _createTester(eachOfLimit, identity, _findGetResult); + + var detectSeries = _createTester(eachOfSeries, identity, _findGetResult); + + 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 dir = consoleFunc('dir'); + + 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 doDuring(iterator, test, cb) { + var calls = 0; + + during(function (next) { + if (calls++ < 1) return next(null, true); + test.apply(this, arguments); + }, iterator, cb); + } + + 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 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 _withoutIndex(iterator) { + return function (value, index, callback) { + return iterator(value, callback); + }; + } + + function each(arr, iterator, cb) { + return eachOf(arr, _withoutIndex(iterator), cb); + } + + 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 ensureAsync(fn) { + return rest(function (args) { + var callback = args.pop(); + var sync = true; + args.push(function () { + var innerArgs = arguments; + if (sync) { + setImmediate$1(function () { + callback.apply(null, innerArgs); + }); + } else { + callback.apply(null, innerArgs); + } + }); + fn.apply(this, args); + sync = false; + }); + } + + function notId(v) { + return !v; + } + + var every = _createTester(eachOf, notId, notId); + + var everyLimit = _createTester(eachOfLimit, notId, notId); + + function _filter(eachfn, arr, iterator, callback) { + var results = []; + eachfn(arr, function (x, index, callback) { + iterator(x, function (err, v) { + if (err) { + callback(err); + } else { + if (v) { + results.push({ index: index, value: x }); + } + callback(); + } + }); + }, function (err) { + if (err) { + callback(err); + } else { + callback(null, arrayMap(results.sort(function (a, b) { + return a.index - b.index; + }), baseProperty('value'))); + } + }); + } + + var filter = doParallel(_filter); + + function doParallelLimit(fn) { + return function (obj, limit, iterator, callback) { + return fn(_eachOfLimit(limit), obj, iterator, callback); + }; + } + + var filterLimit = doParallelLimit(_filter); + + var filterSeries = doSeries(_filter); + + function forever(fn, cb) { + var done = onlyOnce(cb || noop); + var task = ensureAsync(fn); + + function next(err) { + if (err) return done(err); + task(next); + } + next(); + } + + 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); + } + + var log = consoleFunc('log'); + + 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 map = doParallel(_asyncMap); + + var mapLimit = doParallelLimit(_asyncMap); + + var mapSeries = doSeries(_asyncMap); + + /** + * 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')(); + + /** Built-in value references. */ + var Symbol = root.Symbol; + + /** `Object#toString` result references. */ + var symbolTag = '[object Symbol]'; + + /** 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 `Symbol` 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 + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ + function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && objectToString$3.call(value) == symbolTag); + } + + /** Used as references for various `Number` constants. */ + var INFINITY$1 = 1 / 0; + + /** Used to convert symbols to primitives and strings. */ + var symbolProto = Symbol ? Symbol.prototype : undefined; + var symbolToString = Symbol ? symbolProto.toString : undefined; + /** + * 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; } - - async.any = async.some = _createTester(async.eachOf, toBool, identity); - - async.someLimit = _createTester(async.eachOfLimit, toBool, identity); - - async.all = async.every = _createTester(async.eachOf, notId, notId); - - async.everyLimit = _createTester(async.eachOfLimit, notId, notId); - - function _findGetResult(v, x) { - return x; + if (value == null) { + return ''; } - async.detect = _createTester(async.eachOf, identity, _findGetResult); - async.detectSeries = _createTester(async.eachOfSeries, identity, _findGetResult); - async.detectLimit = _createTester(async.eachOfLimit, identity, _findGetResult); - - async.sortBy = function (arr, iterator, callback) { - async.map(arr, function (x, callback) { - iterator(x, function (err, criteria) { - if (err) { - callback(err); - } else { - callback(null, { value: x, criteria: criteria }); - } - }); - }, function (err, results) { - if (err) { - return callback(err); - } else { - callback(null, _map(results.sort(comparator), function (x) { - return x.value; - })); - } - }); - - function comparator(left, right) { - var a = left.criteria, - b = right.criteria; - return a < b ? -1 : a > b ? 1 : 0; - } - }; - - async.auto = 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 = _keys(tasks); - var remainingTasks = keys.length; - if (!remainingTasks) { - return callback(null); - } - if (!concurrency) { - concurrency = remainingTasks; - } - - var results = {}; - var runningTasks = 0; - - var hasError = false; - - 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(0), function (fn) { - fn(); - }); - } - - addListener(function () { - if (!remainingTasks) { - callback(null, results); - } - }); - - _arrayEach(keys, function (k) { - if (hasError) return; - var task = _isArray(tasks[k]) ? tasks[k] : [tasks[k]]; - var taskCallback = _restParam(function (err, args) { - runningTasks--; - if (args.length <= 1) { - args = args[0]; - } - if (err) { - var safeResults = {}; - _forEachOf(results, function (val, rkey) { - safeResults[rkey] = val; - }); - safeResults[k] = args; - hasError = true; - - callback(err, safeResults); - } else { - results[k] = args; - async.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 nonexistent dependency in ' + requires.join(', ')); - } - if (_isArray(dep) && _indexOf(dep, k) >= 0) { - throw new Error('Has cyclic dependencies'); - } - } - function ready() { - return runningTasks < concurrency && _reduce(requires, function (a, x) { - return a && results.hasOwnProperty(x); - }, true) && !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); - } - } - }); - }; - - async.retry = function (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)); - } - } - - async.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; - }; - - async.waterfall = function (tasks, callback) { - callback = _once(callback || noop); - if (!_isArray(tasks)) { - var err = new Error('First argument to waterfall must be an array of functions'); - return callback(err); - } - if (!tasks.length) { - return callback(); - } - function wrapIterator(iterator) { - return _restParam(function (err, args) { - if (err) { - callback.apply(null, [err].concat(args)); - } else { - var next = iterator.next(); - if (next) { - args.push(wrapIterator(next)); - } else { - args.push(callback); - } - ensureAsync(iterator).apply(null, args); - } - }); - } - wrapIterator(async.iterator(tasks))(); - }; - - function _parallel(eachfn, tasks, callback) { - callback = callback || noop; - var results = _isArrayLike(tasks) ? [] : {}; - - eachfn(tasks, function (task, key, callback) { - task(_restParam(function (err, args) { - if (args.length <= 1) { - args = args[0]; - } - results[key] = args; - callback(err); - })); - }, function (err) { - callback(err, results); - }); + if (isSymbol(value)) { + return Symbol ? symbolToString.call(value) : ''; } - - async.parallel = function (tasks, callback) { - _parallel(async.eachOf, tasks, callback); - }; - - async.parallelLimit = function (tasks, limit, callback) { - _parallel(_eachOfLimit(limit), tasks, callback); - }; - - async.series = function (tasks, callback) { - _parallel(async.eachOfSeries, tasks, callback); - }; - - async.iterator = 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); - }; - - async.apply = _restParam(function (fn, args) { - return _restParam(function (callArgs) { - return fn.apply(null, args.concat(callArgs)); - }); + var result = (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)); }); - - 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); - }); + 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; } - async.concat = doParallel(_concat); - async.concatSeries = doSeries(_concat); - - async.whilst = function (test, iterator, callback) { - callback = callback || noop; - if (test()) { - var next = _restParam(function (err, args) { - if (err) { - callback(err); - } else if (test.apply(this, args)) { - iterator(next); - } else { - callback.apply(null, [null].concat(args)); - } - }); - iterator(next); - } else { - callback(null); - } - }; - - async.doWhilst = function (iterator, test, callback) { - var calls = 0; - return async.whilst(function () { - return ++calls <= 1 || test.apply(this, arguments); - }, iterator, callback); - }; - - async.until = function (test, iterator, callback) { - return async.whilst(function () { - return !test.apply(this, arguments); - }, iterator, callback); - }; - - async.doUntil = function (iterator, test, callback) { - return async.doWhilst(iterator, function () { - return !test.apply(this, arguments); - }, callback); - }; - - async.during = function (test, iterator, callback) { - callback = callback || noop; - - var next = _restParam(function (err, args) { - if (err) { - callback(err); - } else { - args.push(check); - test.apply(this, args); - } - }); - - var check = function (err, truth) { - if (err) { - callback(err); - } else if (truth) { - iterator(next); - } else { - callback(null); - } - }; - - test(check); - }; - - async.doDuring = function (iterator, test, callback) { - var calls = 0; - async.during(function (next) { - if (calls++ < 1) { - next(null, true); - } else { - test.apply(this, arguments); - } - }, iterator, callback); - }; - - 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 async.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(); - } - }); - async.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 = _map(tasks, function (task) { - return task.data; - }); - - if (q.tasks.length === 0) { - q.empty(); - } - workers += 1; - workersList.push(tasks[0]); - var cb = only_once(_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++) { - async.setImmediate(q.process); - } - } - }; - return q; + return !isArray(value) && + (reIsPlainProp.test(value) || !reIsDeepProp.test(value) || + (object != null && value in Object(object))); + } + + /** + * Gets the last element of `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @returns {*} Returns the last element of `array`. + * @example + * + * _.last([1, 2, 3]); + * // => 3 + */ + function last(array) { + var length = array ? array.length : 0; + return length ? array[length - 1] : undefined; + } + + /** + * The base implementation of `_.slice` without an iteratee call guard. + * + * @private + * @param {Array} array The array to slice. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the slice of `array`. + */ + function baseSlice(array, start, end) { + var index = -1, + length = array.length; + + if (start < 0) { + start = -start > length ? 0 : (length + start); } - - async.queue = function (worker, concurrency) { - var q = _queue(function (items, cb) { - worker(items[0], cb); - }, concurrency, 1); - - return q; - }; - - async.priorityQueue = 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 async.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(); - } - async.setImmediate(q.process); - }); - } - - // Start with a normal queue - var q = async.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; - }; - - async.cargo = function (worker, payload) { - return _queue(worker, 1, payload); - }; - - function _console_fn(name) { - return _restParam(function (fn, args) { - fn.apply(null, args.concat([_restParam(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); - }); - } - } - })])); - }); + end = end > length ? length : end; + if (end < 0) { + end += length; } - async.log = _console_fn('log'); - async.dir = _console_fn('dir'); - /*async.info = _console_fn('info'); - async.warn = _console_fn('warn'); - async.error = _console_fn('error');*/ - - async.memoize = function (fn, hasher) { - var memo = {}; - var queues = {}; - var has = Object.prototype.hasOwnProperty; - hasher = hasher || identity; - var memoized = _restParam(function memoized(args) { - var callback = args.pop(); - var key = hasher.apply(null, args); - if (has.call(memo, key)) { - async.setImmediate(function () { - callback.apply(null, memo[key]); - }); - } else if (has.call(queues, key)) { - queues[key].push(callback); - } else { - queues[key] = [callback]; - fn.apply(null, args.concat([_restParam(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; - }; - - async.unmemoize = function (fn) { - return function () { - return (fn.unmemoized || fn).apply(null, arguments); - }; - }; + length = start > end ? 0 : ((end - start) >>> 0); + start >>>= 0; - function _times(mapper) { - return function (count, iterator, callback) { - mapper(_range(count), iterator, callback); - }; + var result = Array(length); + while (++index < length) { + result[index] = array[index + start]; } - - async.times = _times(async.map); - async.timesSeries = _times(async.mapSeries); - async.timesLimit = function (count, limit, iterator, callback) { - return async.mapLimit(_range(count), limit, iterator, callback); - }; - - async.seq = function () /* functions... */{ - var fns = arguments; - return _restParam(function (args) { - var that = this; - - var callback = args[args.length - 1]; - if (typeof callback == 'function') { - args.pop(); - } else { - callback = noop; - } - - async.reduce(fns, args, function (newargs, fn, cb) { - fn.apply(that, newargs.concat([_restParam(function (err, nextargs) { - cb(err, nextargs); - })])); - }, function (err, results) { - callback.apply(that, [err].concat(results)); - }); - }); - }; - - async.compose = function () /* functions... */{ - return async.seq.apply(null, Array.prototype.reverse.call(arguments)); - }; - - function _applyEach(eachfn) { - return _restParam(function (fns, args) { - var go = _restParam(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; - } - }); + return result; + } + + /** + * 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++]]; } - - async.applyEach = _applyEach(async.eachOf); - async.applyEachSeries = _applyEach(async.eachOfSeries); - - async.forever = function (fn, callback) { - var done = only_once(callback || noop); - var task = ensureAsync(fn); - function next(err) { - if (err) { - return done(err); - } - task(next); - } - next(); - }; - - function ensureAsync(fn) { - return _restParam(function (args) { - var callback = args.pop(); - args.push(function () { - var innerArgs = arguments; - if (sync) { - async.setImmediate(function () { - callback.apply(null, innerArgs); - }); - } else { - callback.apply(null, innerArgs); - } - }); - var sync = true; - fn.apply(this, args); - sync = false; - }); + return (index && index == length) ? object : undefined; + } + + /** + * Gets the value at `path` of `object`. If the resolved value is + * `undefined` the `defaultValue` is used in its place. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @param {*} [defaultValue] The value returned if the resolved value is `undefined`. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.get(object, 'a[0].b.c'); + * // => 3 + * + * _.get(object, ['a', '0', 'b', 'c']); + * // => 3 + * + * _.get(object, 'a.b.c', 'default'); + * // => 'default' + */ + function get(object, path, defaultValue) { + var result = object == null ? undefined : baseGet(object, path); + return result === undefined ? defaultValue : result; + } + + /** + * Gets the parent value at `path` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Array} path The path to get the parent value of. + * @returns {*} Returns the parent value. + */ + function parent(object, path) { + return path.length == 1 ? object : get(object, baseSlice(path, 0, -1)); + } + + /** + * Checks if `path` exists on `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @param {Function} hasFunc The function to check properties. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + */ + function hasPath(object, path, hasFunc) { + if (object == null) { + return false; } - - async.ensureAsync = ensureAsync; - - async.constant = _restParam(function (values) { - var args = [null].concat(values); - return function (callback) { - return callback.apply(this, args); - }; - }); - - async.wrapSync = async.asyncify = function asyncify(func) { - return _restParam(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); - } - }); - }; - - // Node.js - if (typeof module === 'object' && module.exports) { - module.exports = async; + var result = hasFunc(object, path); + if (!result && !isKey(path)) { + path = baseToPath(path); + object = parent(object, path); + if (object != null) { + path = last(path); + result = hasFunc(object, path); + } } - // AMD / RequireJS - else if (typeof define === 'function' && define.amd) { - define([], function () { - return async; - }); - } - // included directly via <script> tag - else { - root.async = async; - } -})();
\ No newline at end of file + var length = object ? object.length : undefined; + return result || ( + !!length && isLength(length) && isIndex(path, length) && + (isArray(object) || isString(object) || isArguments(object)) + ); + } + + /** + * Checks if `path` is a direct property of `object`. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + * @example + * + * var object = { 'a': { 'b': { 'c': 3 } } }; + * var other = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) }); + * + * _.has(object, 'a'); + * // => true + * + * _.has(object, 'a.b.c'); + * // => true + * + * _.has(object, ['a', 'b', 'c']); + * // => true + * + * _.has(other, 'a'); + * // => false + */ + function has(object, path) { + return hasPath(object, path, baseHas); + } + + function memoize(fn, hasher) { + var memo = Object.create(null); + var queues = Object.create(null); + hasher = hasher || identity; + var memoized = rest(function memoized(args) { + var callback = args.pop(); + var key = hasher.apply(null, args); + if (has(memo, key)) { + setImmediate$1(function () { + callback.apply(null, memo[key]); + }); + } else if (has(queues, key)) { + 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; + } + + var nexTick = typeof process === 'object' && typeof process.nextTick === 'function' ? process.nextTick : setImmediate$1; + + 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 parallel(tasks, cb) { + return _parallel(eachOf, tasks, cb); + } + + function parallelLimit(tasks, limit, cb) { + return _parallel(_eachOfLimit(limit), tasks, cb); + } + + 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; + } + + var slice = Array.prototype.slice; + + function reduceRight(arr, memo, iterator, cb) { + var reversed = slice.call(arr).reverse(); + reduce(reversed, memo, iterator, cb); + } + + function reject$1(eachfn, arr, iterator, callback) { + _filter(eachfn, arr, function (value, cb) { + iterator(value, function (err, v) { + if (err) { + cb(err); + } else { + cb(null, !v); + } + }); + }, callback); + } + + var reject = doParallel(reject$1); + + var rejectLimit = doParallelLimit(reject$1); + + var rejectSeries = doSeries(reject$1); + + function series(tasks, cb) { + return _parallel(eachOfSeries, tasks, cb); + } + + 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; + } + + var some = _createTester(eachOf, Boolean, identity); + + var someLimit = _createTester(eachOfLimit, Boolean, identity); + + 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), baseProperty('value'))); + }); + + function comparator(left, right) { + var a = left.criteria, + b = right.criteria; + return a < b ? -1 : a > b ? 1 : 0; + } + } + + /* Built-in method references for those with the same name as other `lodash` methods. */ + var nativeCeil = Math.ceil; + var nativeMax$2 = Math.max; + /** + * The base implementation of `_.range` and `_.rangeRight` which doesn't + * coerce arguments to numbers. + * + * @private + * @param {number} start The start of the range. + * @param {number} end The end of the range. + * @param {number} step 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) { + 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 times (count, iterator, callback) { + map(baseRange(0, count, 1), iterator, callback); + } + + function timeLimit(count, limit, iterator, cb) { + return mapLimit(baseRange(0, count, 1), limit, iterator, cb); + } + + function timesSeries (count, iterator, callback) { + mapSeries(baseRange(0, count, 1), iterator, callback); + } + + 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 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 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))(); + } + + 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/dist/async.min.js b/dist/async.min.js index 4af1f6b..2915a67 100644 --- a/dist/async.min.js +++ b/dist/async.min.js @@ -1,2 +1,2 @@ -"use strict";!function(){function n(){}function t(n){return n}function e(n){return!!n}function r(n){return!n}function u(n){return function(){if(null===n)throw new Error("Callback was already called.");n.apply(this,arguments),n=null}}function i(n){return function(){null!==n&&(n.apply(this,arguments),n=null)}}function o(n){return M(n)||"number"==typeof n.length&&n.length>=0&&n.length%1===0}function c(n,t){for(var e=-1,r=n.length;++e<r;)t(n[e],e,n)}function a(n,t){for(var e=-1,r=n.length,u=Array(r);++e<r;)u[e]=t(n[e],e,n);return u}function f(n){return a(Array(n),function(n,t){return t})}function l(n,t,e){return c(n,function(n,r,u){e=t(e,n,r,u)}),e}function s(n,t){c(W(n),function(e){t(n[e],e)})}function p(n,t){for(var e=0;e<n.length;e++)if(n[e]===t)return e;return-1}function h(n){var t,e,r=-1;return o(n)?(t=n.length,function(){return r++,t>r?r:null}):(e=W(n),t=e.length,function(){return r++,t>r?e[r]:null})}function m(n,t){return t=null==t?n.length-1:+t,function(){for(var e=Math.max(arguments.length-t,0),r=Array(e),u=0;e>u;u++)r[u]=arguments[u+t];switch(t){case 0:return n.call(this,r);case 1:return n.call(this,arguments[0],r)}}}function y(n){return function(t,e,r){return n(t,r)}}function v(t){return function(e,r,o){o=i(o||n),e=e||[];var c=h(e);if(0>=t)return o(null);var a=!1,f=0,l=!1;!function s(){if(a&&0>=f)return o(null);for(;t>f&&!l;){var n=c();if(null===n)return a=!0,void(0>=f&&o(null));f+=1,r(e[n],n,u(function(n){f-=1,n?(o(n),l=!0):s()}))}}()}}function d(n){return function(t,e,r){return n(P.eachOf,t,e,r)}}function g(n){return function(t,e,r,u){return n(v(e),t,r,u)}}function k(n){return function(t,e,r){return n(P.eachOfSeries,t,e,r)}}function b(t,e,r,u){u=i(u||n),e=e||[];var c=o(e)?[]:{};t(e,function(n,t,e){r(n,function(n,r){c[t]=r,e(n)})},function(n){u(n,c)})}function w(n,t,e,r){var u=[];n(t,function(n,t,r){e(n,function(e){e&&u.push({index:t,value:n}),r()})},function(){r(a(u.sort(function(n,t){return n.index-t.index}),function(n){return n.value}))})}function O(n,t,e,r){w(n,t,function(n,t){e(n,function(n){t(!n)})},r)}function S(n,t,e){return function(r,u,i,o){function c(){o&&o(e(!1,void 0))}function a(n,r,u){return o?void i(n,function(r){o&&t(r)&&(o(e(!0,n)),o=i=!1),u()}):u()}arguments.length>3?n(r,u,a,c):(o=i,i=u,n(r,a,c))}}function E(n,t){return t}function L(t,e,r){r=r||n;var u=o(e)?[]:{};t(e,function(n,t,e){n(m(function(n,r){r.length<=1&&(r=r[0]),u[t]=r,e(n)}))},function(n){r(n,u)})}function j(n,t,e,r){var u=[];n(t,function(n,t,r){e(n,function(n,t){u=u.concat(t||[]),r(n)})},function(n){r(n,u)})}function I(t,e,r){function i(t,e,r,u){if(null!=u&&"function"!=typeof u)throw new Error("task callback must be a function");return t.started=!0,M(e)||(e=[e]),0===e.length&&t.idle()?P.setImmediate(function(){t.drain()}):(c(e,function(e){var i={data:e,callback:u||n};r?t.tasks.unshift(i):t.tasks.push(i),t.tasks.length===t.concurrency&&t.saturated()}),void P.setImmediate(t.process))}function o(n,t){return function(){f-=1;var e=!1,r=arguments;c(t,function(n){c(l,function(t,r){t!==n||e||(l.splice(r,1),e=!0)}),n.callback.apply(n,r)}),n.tasks.length+f===0&&n.drain(),n.process()}}if(null==e)e=1;else if(0===e)throw new Error("Concurrency must not be zero");var f=0,l=[],s={tasks:[],concurrency:e,payload:r,saturated:n,empty:n,drain:n,started:!1,paused:!1,push:function(n,t){i(s,n,!1,t)},kill:function(){s.drain=n,s.tasks=[]},unshift:function(n,t){i(s,n,!0,t)},process:function(){for(;!s.paused&&f<s.concurrency&&s.tasks.length;){var n=s.payload?s.tasks.splice(0,s.payload):s.tasks.splice(0,s.tasks.length),e=a(n,function(n){return n.data});0===s.tasks.length&&s.empty(),f+=1,l.push(n[0]);var r=u(o(s,n));t(e,r)}},length:function(){return s.tasks.length},running:function(){return f},workersList:function(){return l},idle:function(){return s.tasks.length+f===0},pause:function(){s.paused=!0},resume:function(){if(s.paused!==!1){s.paused=!1;for(var n=Math.min(s.concurrency,s.tasks.length),t=1;n>=t;t++)P.setImmediate(s.process)}}};return s}function x(n){return m(function(t,e){t.apply(null,e.concat([m(function(t,e){"object"==typeof console&&(t?console.error&&console.error(t):console[n]&&c(e,function(t){console[n](t)}))})]))})}function A(n){return function(t,e,r){n(f(t),e,r)}}function T(n){return m(function(t,e){var r=m(function(e){var r=this,u=e.pop();return n(t,function(n,t,u){n.apply(r,e.concat([u]))},u)});return e.length?r.apply(this,e):r})}function z(n){return m(function(t){var e=t.pop();t.push(function(){var n=arguments;r?P.setImmediate(function(){e.apply(null,n)}):e.apply(null,n)});var r=!0;n.apply(this,t),r=!1})}var q,P={},C="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||this;null!=C&&(q=C.async),P.noConflict=function(){return C.async=q,P};var H=Object.prototype.toString,M=Array.isArray||function(n){return"[object Array]"===H.call(n)},U=function(n){var t=typeof n;return"function"===t||"object"===t&&!!n},W=Object.keys||function(n){var t=[];for(var e in n)n.hasOwnProperty(e)&&t.push(e);return t},B="function"==typeof setImmediate&&setImmediate,D=B?function(n){B(n)}:function(n){setTimeout(n,0)};"object"==typeof process&&"function"==typeof process.nextTick?P.nextTick=process.nextTick:P.nextTick=D,P.setImmediate=B?D:P.nextTick,P.forEach=P.each=function(n,t,e){return P.eachOf(n,y(t),e)},P.forEachSeries=P.eachSeries=function(n,t,e){return P.eachOfSeries(n,y(t),e)},P.forEachLimit=P.eachLimit=function(n,t,e,r){return v(t)(n,y(e),r)},P.forEachOf=P.eachOf=function(t,e,r){function o(n){f--,n?r(n):null===c&&0>=f&&r(null)}r=i(r||n),t=t||[];for(var c,a=h(t),f=0;null!=(c=a());)f+=1,e(t[c],c,u(o));0===f&&r(null)},P.forEachOfSeries=P.eachOfSeries=function(t,e,r){function o(){var n=!0;return null===a?r(null):(e(t[a],a,u(function(t){if(t)r(t);else{if(a=c(),null===a)return r(null);n?P.setImmediate(o):o()}})),void(n=!1))}r=i(r||n),t=t||[];var c=h(t),a=c();o()},P.forEachOfLimit=P.eachOfLimit=function(n,t,e,r){v(t)(n,e,r)},P.map=d(b),P.mapSeries=k(b),P.mapLimit=g(b),P.inject=P.foldl=P.reduce=function(n,t,e,r){P.eachOfSeries(n,function(n,r,u){e(t,n,function(n,e){t=e,u(n)})},function(n){r(n,t)})},P.foldr=P.reduceRight=function(n,e,r,u){var i=a(n,t).reverse();P.reduce(i,e,r,u)},P.transform=function(n,t,e,r){3===arguments.length&&(r=e,e=t,t=M(n)?[]:{}),P.eachOf(n,function(n,r,u){e(t,n,r,u)},function(n){r(n,t)})},P.select=P.filter=d(w),P.selectLimit=P.filterLimit=g(w),P.selectSeries=P.filterSeries=k(w),P.reject=d(O),P.rejectLimit=g(O),P.rejectSeries=k(O),P.any=P.some=S(P.eachOf,e,t),P.someLimit=S(P.eachOfLimit,e,t),P.all=P.every=S(P.eachOf,r,r),P.everyLimit=S(P.eachOfLimit,r,r),P.detect=S(P.eachOf,t,E),P.detectSeries=S(P.eachOfSeries,t,E),P.detectLimit=S(P.eachOfLimit,t,E),P.sortBy=function(n,t,e){function r(n,t){var e=n.criteria,r=t.criteria;return r>e?-1:e>r?1:0}P.map(n,function(n,e){t(n,function(t,r){t?e(t):e(null,{value:n,criteria:r})})},function(n,t){return n?e(n):void e(null,a(t.sort(r),function(n){return n.value}))})},P.auto=function(t,e,r){function u(n){g.unshift(n)}function o(n){var t=p(g,n);t>=0&&g.splice(t,1)}function a(){h--,c(g.slice(0),function(n){n()})}"function"==typeof arguments[1]&&(r=e,e=null),r=i(r||n);var f=W(t),h=f.length;if(!h)return r(null);e||(e=h);var y={},v=0,d=!1,g=[];u(function(){h||r(null,y)}),c(f,function(n){function i(){return e>v&&l(k,function(n,t){return n&&y.hasOwnProperty(t)},!0)&&!y.hasOwnProperty(n)}function c(){i()&&(v++,o(c),h[h.length-1](g,y))}if(!d){for(var f,h=M(t[n])?t[n]:[t[n]],g=m(function(t,e){if(v--,e.length<=1&&(e=e[0]),t){var u={};s(y,function(n,t){u[t]=n}),u[n]=e,d=!0,r(t,u)}else y[n]=e,P.setImmediate(a)}),k=h.slice(0,h.length-1),b=k.length;b--;){if(!(f=t[k[b]]))throw new Error("Has nonexistent dependency in "+k.join(", "));if(M(f)&&p(f,n)>=0)throw new Error("Has cyclic dependencies")}i()?(v++,h[h.length-1](g,y)):u(c)}})},P.retry=function(n,t,e){function r(n,t){if("number"==typeof t)n.times=parseInt(t,10)||i;else{if("object"!=typeof t)throw new Error("Unsupported argument type for 'times': "+typeof t);n.times=parseInt(t.times,10)||i,n.interval=parseInt(t.interval,10)||o}}function u(n,t){function e(n,e){return function(r){n(function(n,t){r(!n||e,{err:n,result:t})},t)}}function r(n){return function(t){setTimeout(function(){t(null)},n)}}for(;a.times;){var u=!(a.times-=1);c.push(e(a.task,u)),!u&&a.interval>0&&c.push(r(a.interval))}P.series(c,function(t,e){e=e[e.length-1],(n||a.callback)(e.err,e.result)})}var i=5,o=0,c=[],a={times:i,interval:o},f=arguments.length;if(1>f||f>3)throw new Error("Invalid arguments - must be either (task), (task, callback), (times, task) or (times, task, callback)");return 2>=f&&"function"==typeof n&&(e=t,t=n),"function"!=typeof n&&r(a,n),a.callback=e,a.task=t,a.callback?u():u},P.waterfall=function(t,e){function r(n){return m(function(t,u){if(t)e.apply(null,[t].concat(u));else{var i=n.next();i?u.push(r(i)):u.push(e),z(n).apply(null,u)}})}if(e=i(e||n),!M(t)){var u=new Error("First argument to waterfall must be an array of functions");return e(u)}return t.length?void r(P.iterator(t))():e()},P.parallel=function(n,t){L(P.eachOf,n,t)},P.parallelLimit=function(n,t,e){L(v(t),n,e)},P.series=function(n,t){L(P.eachOfSeries,n,t)},P.iterator=function(n){function t(e){function r(){return n.length&&n[e].apply(null,arguments),r.next()}return r.next=function(){return e<n.length-1?t(e+1):null},r}return t(0)},P.apply=m(function(n,t){return m(function(e){return n.apply(null,t.concat(e))})}),P.concat=d(j),P.concatSeries=k(j),P.whilst=function(t,e,r){if(r=r||n,t()){var u=m(function(n,i){n?r(n):t.apply(this,i)?e(u):r.apply(null,[null].concat(i))});e(u)}else r(null)},P.doWhilst=function(n,t,e){var r=0;return P.whilst(function(){return++r<=1||t.apply(this,arguments)},n,e)},P.until=function(n,t,e){return P.whilst(function(){return!n.apply(this,arguments)},t,e)},P.doUntil=function(n,t,e){return P.doWhilst(n,function(){return!t.apply(this,arguments)},e)},P.during=function(t,e,r){r=r||n;var u=m(function(n,e){n?r(n):(e.push(i),t.apply(this,e))}),i=function(n,t){n?r(n):t?e(u):r(null)};t(i)},P.doDuring=function(n,t,e){var r=0;P.during(function(n){r++<1?n(null,!0):t.apply(this,arguments)},n,e)},P.queue=function(n,t){var e=I(function(t,e){n(t[0],e)},t,1);return e},P.priorityQueue=function(t,e){function r(n,t){return n.priority-t.priority}function u(n,t,e){for(var r=-1,u=n.length-1;u>r;){var i=r+(u-r+1>>>1);e(t,n[i])>=0?r=i:u=i-1}return r}function i(t,e,i,o){if(null!=o&&"function"!=typeof o)throw new Error("task callback must be a function");return t.started=!0,M(e)||(e=[e]),0===e.length?P.setImmediate(function(){t.drain()}):void c(e,function(e){var c={data:e,priority:i,callback:"function"==typeof o?o:n};t.tasks.splice(u(t.tasks,c,r)+1,0,c),t.tasks.length===t.concurrency&&t.saturated(),P.setImmediate(t.process)})}var o=P.queue(t,e);return o.push=function(n,t,e){i(o,n,t,e)},delete o.unshift,o},P.cargo=function(n,t){return I(n,1,t)},P.log=x("log"),P.dir=x("dir"),P.memoize=function(n,e){var r={},u={},i=Object.prototype.hasOwnProperty;e=e||t;var o=m(function(t){var o=t.pop(),c=e.apply(null,t);i.call(r,c)?P.setImmediate(function(){o.apply(null,r[c])}):i.call(u,c)?u[c].push(o):(u[c]=[o],n.apply(null,t.concat([m(function(n){r[c]=n;var t=u[c];delete u[c];for(var e=0,i=t.length;i>e;e++)t[e].apply(null,n)})])))});return o.memo=r,o.unmemoized=n,o},P.unmemoize=function(n){return function(){return(n.unmemoized||n).apply(null,arguments)}},P.times=A(P.map),P.timesSeries=A(P.mapSeries),P.timesLimit=function(n,t,e,r){return P.mapLimit(f(n),t,e,r)},P.seq=function(){var t=arguments;return m(function(e){var r=this,u=e[e.length-1];"function"==typeof u?e.pop():u=n,P.reduce(t,e,function(n,t,e){t.apply(r,n.concat([m(function(n,t){e(n,t)})]))},function(n,t){u.apply(r,[n].concat(t))})})},P.compose=function(){return P.seq.apply(null,Array.prototype.reverse.call(arguments))},P.applyEach=T(P.eachOf),P.applyEachSeries=T(P.eachOfSeries),P.forever=function(t,e){function r(n){return n?i(n):void o(r)}var i=u(e||n),o=z(t);r()},P.ensureAsync=z,P.constant=m(function(n){var t=[null].concat(n);return function(n){return n.apply(this,t)}}),P.wrapSync=P.asyncify=function(n){return m(function(t){var e,r=t.pop();try{e=n.apply(this,t)}catch(u){return r(u)}U(e)&&"function"==typeof e.then?e.then(function(n){r(null,n)})["catch"](function(n){r(n.message?n:new Error(n))}):r(null,e)})},"object"==typeof module&&module.exports?module.exports=P:"function"==typeof define&&define.amd?define([],function(){return P}):C.async=P}(); +!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(n.async={})}(this,function(n){"use strict";function t(n,t,r){var e=r.length;switch(e){case 0:return n.call(t);case 1:return n.call(t,r[0]);case 2:return n.call(t,r[0],r[1]);case 3:return n.call(t,r[0],r[1],r[2])}return n.apply(t,r)}function r(n){var t=typeof n;return!!n&&("object"==t||"function"==t)}function e(n){var t=r(n)?nt.call(n):"";return t==Yn||t==Zn}function u(n){if(r(n)){var t=e(n.valueOf)?n.valueOf():n;n=r(t)?t+"":t}if("string"!=typeof n)return 0===n?n:+n;n=n.replace(rt,"");var u=ut.test(n);return u||it.test(n)?ot(n.slice(2),u?2:8):et.test(n)?tt:+n}function i(n){if(!n)return 0===n?n:0;if(n=u(n),n===ct||n===-ct){var t=0>n?-1:1;return t*ft}var r=n%1;return n===n?r?n-r:n:0}function o(n,r){if("function"!=typeof n)throw new TypeError(at);return r=lt(void 0===r?n.length-1:i(r),0),function(){for(var e=arguments,u=-1,i=lt(e.length-r,0),o=Array(i);++u<i;)o[u]=e[r+u];switch(r){case 0:return n.call(this,o);case 1:return n.call(this,e[0],o);case 2:return n.call(this,e[0],e[1],o)}var c=Array(r+1);for(u=-1;++u<r;)c[u]=e[u];return c[r]=o,t(n,this,c)}}function c(n){return o(function(t,r){var e=o(function(r){var e=this,u=r.pop();return n(t,function(n,t,u){n.apply(e,r.concat([u]))},u)});return r.length?e.apply(this,r):e})}function f(n,t){var r;if("function"!=typeof t)throw new TypeError(st);return n=i(n),function(){return--n>0&&(r=t.apply(this,arguments)),1>=n&&(t=void 0),r}}function a(n){return f(2,n)}function l(){}function s(n){return function(t){return null==t?void 0:t[n]}}function p(n){return"number"==typeof n&&n>-1&&n%1==0&&yt>=n}function y(n){return null!=n&&!("function"==typeof n&&e(n))&&p(pt(n))}function h(n,t){return vt.call(n,t)||"object"==typeof n&&t in n&&null===mt(n)}function v(n){return dt(Object(n))}function m(n,t){for(var r=-1,e=Array(n);++r<n;)e[r]=t(r);return e}function d(n){return!!n&&"object"==typeof n}function g(n){return d(n)&&y(n)}function b(n){return g(n)&&kt.call(n,"callee")&&(!jt.call(n,"callee")||wt.call(n)==gt)}function k(n){return"string"==typeof n||!St(n)&&d(n)&&Lt.call(n)==Ot}function w(n){var t=n?n.length:void 0;return p(t)&&(St(n)||k(n)||b(n))?m(t,String):null}function j(n,t){return n="number"==typeof n||At.test(n)?+n:-1,t=null==t?xt:t,n>-1&&n%1==0&&t>n}function S(n){var t=n&&n.constructor,r="function"==typeof t&&t.prototype||Tt;return n===r}function O(n){var t=S(n);if(!t&&!y(n))return v(n);var r=w(n),e=!!r,u=r||[],i=u.length;for(var o in n)!h(n,o)||e&&("length"==o||j(o,i))||t&&"constructor"==o||u.push(o);return u}function E(n){var t,r=-1;if(y(n))return t=n.length,function(){return r++,t>r?r:null};var e=O(n);return t=e.length,function(){return r++,t>r?e[r]:null}}function L(n){return function(){if(null===n)throw new Error("Callback was already called.");n.apply(this,arguments),n=null}}function x(n,t,r){function e(n){o--,n?r(n):null===u&&0>=o&&r(null)}r=a(r||l),n=n||[];for(var u,i=E(n),o=0;null!=(u=i());)o+=1,t(n[u],u,L(e));0===o&&r(null)}function A(n,t,r){function e(){var o=!0;return null===i?r(null):(t(n[i],i,L(function(n){if(n)r(n);else{if(i=u(),null===i)return r(null);o?$t(e):e()}})),void(o=!1))}r=a(r||l),n=n||[];var u=E(n),i=u();e()}function T(n){return o(function(t){var e,u=t.pop();try{e=n.apply(this,t)}catch(i){return u(i)}r(e)&&"function"==typeof e.then?e.then(function(n){u(null,n)})["catch"](function(n){u(n.message?n:new Error(n))}):u(null,e)})}function I(n,t){for(var r=-1,e=n.length;++r<e&&t(n[r],r,n)!==!1;);return n}function z(n,t){for(var r=-1,e=n.length;++r<e;)if(!t(n[r],r,n))return!1;return!0}function $(n){return function(t,r,e){for(var u=-1,i=Object(t),o=e(t),c=o.length;c--;){var f=o[n?c:++u];if(r(i[f],f,i)===!1)break}return t}}function M(n,t){return n&&Bt(n,t,O)}function q(n){return n}function B(n){return"function"==typeof n?n:q}function F(n,t){return n&&M(n,B(t))}function P(n,t,r){for(var e=n.length,u=t+(r?0:-1);r?u--:++u<e;){var i=n[u];if(i!==i)return u}return-1}function U(n,t,r){if(t!==t)return P(n,r);for(var e=r-1,u=n.length;++e<u;)if(n[e]===t)return e;return-1}function C(n,t,r){var e=n?n.length:0;return e?(r=i(r),0>r&&(r=Ft(e+r,0)),U(n,t,r)):-1}function D(n,t,r){function e(n){v.unshift(n)}function u(n){var t=C(v,n);t>=0&&v.splice(t,1)}function i(){f--,I(v.slice(),function(n){n()})}"function"==typeof arguments[1]&&(r=t,t=null),r=a(r||l);var c=O(n),f=c.length;if(!f)return r(null);t||(t=f);var s={},p=0,y=!1,v=[];e(function(){f||r(null,s)}),I(c,function(c){function f(){return t>p&&!h(s,c)&&z(d,function(n){return h(s,n)})}function a(){f()&&(p++,u(a),v[v.length-1](m,s))}if(!y){for(var l,v=St(n[c])?n[c]:[n[c]],m=o(function(n,t){if(p--,t.length<=1&&(t=t[0]),n){var e={};F(s,function(n,t){e[t]=n}),e[c]=t,y=!0,r(n,e)}else s[c]=t,$t(i)}),d=v.slice(0,v.length-1),g=d.length;g--;){if(!(l=n[d[g]]))throw new Error("Has non-existent dependency in "+d.join(", "));if(St(l)&&C(l,c)>=0)throw new Error("Has cyclic dependencies")}f()?(p++,v[v.length-1](m,s)):e(a)}})}function H(n,t){for(var r=-1,e=n.length,u=Array(e);++r<e;)u[r]=t(n[r],r,n);return u}function N(n,t,r){function e(n,t,r,e){if(null!=e&&"function"!=typeof e)throw new Error("task callback must be a function");return n.started=!0,St(t)||(t=[t]),0===t.length&&n.idle()?$t(function(){n.drain()}):(I(t,function(t){var u={data:t,callback:e||l};r?n.tasks.unshift(u):n.tasks.push(u),n.tasks.length===n.concurrency&&n.saturated()}),void $t(n.process))}function u(n,t){return function(){i-=1;var r=!1,e=arguments;I(t,function(n){I(o,function(t,e){t!==n||r||(o.splice(e,1),r=!0)}),n.callback.apply(n,e)}),n.tasks.length+i===0&&n.drain(),n.process()}}if(null==t)t=1;else if(0===t)throw new Error("Concurrency must not be zero");var i=0,o=[],c={tasks:[],concurrency:t,payload:r,saturated:l,empty:l,drain:l,started:!1,paused:!1,push:function(n,t){e(c,n,!1,t)},kill:function(){c.drain=l,c.tasks=[]},unshift:function(n,t){e(c,n,!0,t)},process:function(){for(;!c.paused&&i<c.concurrency&&c.tasks.length;){var t=c.payload?c.tasks.splice(0,c.payload):c.tasks.splice(0,c.tasks.length),r=H(t,s("data"));0===c.tasks.length&&c.empty(),i+=1,o.push(t[0]);var e=L(u(c,t));n(r,e)}},length:function(){return c.tasks.length},running:function(){return i},workersList:function(){return o},idle:function(){return c.tasks.length+i===0},pause:function(){c.paused=!0},resume:function(){if(c.paused!==!1){c.paused=!1;for(var n=Math.min(c.concurrency,c.tasks.length),t=1;n>=t;t++)$t(c.process)}}};return c}function Q(n,t){return N(n,1,t)}function R(n,t,r,e){A(n,function(n,e,u){r(t,n,function(n,r){t=r,u(n)})},function(n){e(n,t)})}function W(){var n=arguments;return o(function(t){var r=this,e=t[t.length-1];"function"==typeof e?t.pop():e=l,R(n,t,function(n,t,e){t.apply(r,n.concat([o(function(n,t){e(n,t)})]))},function(n,t){e.apply(r,[n].concat(t))})})}function G(){return W.apply(null,Pt.call(arguments))}function J(n,t,r,e){var u=[];n(t,function(n,t,e){r(n,function(n,t){u=u.concat(t||[]),e(n)})},function(n){e(n,u)})}function K(n){return function(t,r,e){return n(x,t,r,e)}}function V(n){return function(t,r,e){return n(A,t,r,e)}}function X(n,t,r){return function(e,u,i,o){function c(n){o&&(n?o(n):o(null,r(!1,void 0)))}function f(n,e,u){return o?void i(n,function(e,c){o&&(e?(o(e),o=i=!1):t(c)&&(o(null,r(!0,n)),o=i=!1)),u()}):u()}arguments.length>3?n(e,u,f,c):(o=i,i=u,n(e,f,c))}}function Y(n,t){return t}function Z(n){return function(t,r,e){e=a(e||l),t=t||[];var u=E(t);if(0>=n)return e(null);var i=!1,o=0,c=!1;!function f(){if(i&&0>=o)return e(null);for(;n>o&&!c;){var a=u();if(null===a)return i=!0,void(0>=o&&e(null));o+=1,r(t[a],a,L(function(n){o-=1,n?(e(n),c=!0):f()}))}}()}}function _(n,t,r,e){Z(t)(n,r,e)}function nn(n){return o(function(t,r){t.apply(null,r.concat([o(function(t,r){"object"==typeof console&&(t?console.error&&console.error(t):console[n]&&I(r,function(t){console[n](t)}))})]))})}function tn(n,t,r){r=r||l;var e=o(function(t,e){t?r(t):(e.push(u),n.apply(this,e))}),u=function(n,u){return n?r(n):u?void t(e):r(null)};n(u)}function rn(n,t,r){var e=0;tn(function(n){return e++<1?n(null,!0):void t.apply(this,arguments)},n,r)}function en(n,t,r){if(r=r||l,!n())return r(null);var e=o(function(u,i){return u?r(u):n.apply(this,i)?t(e):void r.apply(null,[null].concat(i))});t(e)}function un(n,t,r){var e=0;return en(function(){return++e<=1||t.apply(this,arguments)},n,r)}function on(n,t,r){return un(n,function(){return!t.apply(this,arguments)},r)}function cn(n){return function(t,r,e){return n(t,e)}}function fn(n,t,r){return x(n,cn(t),r)}function an(n,t,r,e){return Z(t)(n,cn(r),e)}function ln(n,t,r){return A(n,cn(t),r)}function sn(n){return o(function(t){var r=t.pop(),e=!0;t.push(function(){var n=arguments;e?$t(function(){r.apply(null,n)}):r.apply(null,n)}),n.apply(this,t),e=!1})}function pn(n){return!n}function yn(n,t,r,e){var u=[];n(t,function(n,t,e){r(n,function(r,i){r?e(r):(i&&u.push({index:t,value:n}),e())})},function(n){n?e(n):e(null,H(u.sort(function(n,t){return n.index-t.index}),s("value")))})}function hn(n){return function(t,r,e,u){return n(Z(r),t,e,u)}}function vn(n,t){function r(n){return n?e(n):void u(r)}var e=L(t||l),u=sn(n);r()}function mn(n){function t(r){function e(){return n.length&&n[r].apply(null,arguments),e.next()}return e.next=function(){return r<n.length-1?t(r+1):null},e}return t(0)}function dn(n,t,r,e){e=a(e||l),t=t||[];var u=y(t)?[]:{};n(t,function(n,t,e){r(n,function(n,r){u[t]=r,e(n)})},function(n){e(n,u)})}function gn(n){return n&&n.Object===Object?n:null}function bn(n){return"symbol"==typeof n||d(n)&&sr.call(n)==ar}function kn(n){if("string"==typeof n)return n;if(null==n)return"";if(bn(n))return fr?hr.call(n):"";var t=n+"";return"0"==t&&1/n==-pr?"-0":t}function wn(n){var t=[];return kn(n).replace(vr,function(n,r,e,u){t.push(e?u.replace(mr,"$1"):r||n)}),t}function jn(n){return St(n)?n:wn(n)}function Sn(n,t){return"number"==typeof n?!0:!St(n)&&(gr.test(n)||!dr.test(n)||null!=t&&n in Object(t))}function On(n){var t=n?n.length:0;return t?n[t-1]:void 0}function En(n,t,r){var e=-1,u=n.length;0>t&&(t=-t>u?0:u+t),r=r>u?u:r,0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0;for(var i=Array(u);++e<u;)i[e]=n[e+t];return i}function Ln(n,t){t=Sn(t,n)?[t+""]:jn(t);for(var r=0,e=t.length;null!=n&&e>r;)n=n[t[r++]];return r&&r==e?n:void 0}function xn(n,t,r){var e=null==n?void 0:Ln(n,t);return void 0===e?r:e}function An(n,t){return 1==t.length?n:xn(n,En(t,0,-1))}function Tn(n,t,r){if(null==n)return!1;var e=r(n,t);e||Sn(t)||(t=jn(t),n=An(n,t),null!=n&&(t=On(t),e=r(n,t)));var u=n?n.length:void 0;return e||!!u&&p(u)&&j(t,u)&&(St(n)||k(n)||b(n))}function In(n,t){return Tn(n,t,h)}function zn(n,t){var r=Object.create(null),e=Object.create(null);t=t||q;var u=o(function(u){var i=u.pop(),c=t.apply(null,u);In(r,c)?$t(function(){i.apply(null,r[c])}):In(e,c)?e[c].push(i):(e[c]=[i],n.apply(null,u.concat([o(function(n){r[c]=n;var t=e[c];delete e[c];for(var u=0,i=t.length;i>u;u++)t[u].apply(null,n)})])))});return u.memo=r,u.unmemoized=n,u}function $n(n,t,r){r=r||l;var e=y(t)?[]:{};n(t,function(n,t,r){n(o(function(n,u){u.length<=1&&(u=u[0]),e[t]=u,r(n)}))},function(n){r(n,e)})}function Mn(n,t){return $n(x,n,t)}function qn(n,t,r){return $n(Z(t),n,r)}function Bn(n,t){return N(function(t,r){n(t[0],r)},t,1)}function Fn(n,t){function r(n,t){return n.priority-t.priority}function e(n,t,r){for(var e=-1,u=n.length-1;u>e;){var i=e+(u-e+1>>>1);r(t,n[i])>=0?e=i:u=i-1}return e}function u(n,t,u,i){if(null!=i&&"function"!=typeof i)throw new Error("task callback must be a function");return n.started=!0,St(t)||(t=[t]),0===t.length?$t(function(){n.drain()}):void I(t,function(t){var o={data:t,priority:u,callback:"function"==typeof i?i:l};n.tasks.splice(e(n.tasks,o,r)+1,0,o),n.tasks.length===n.concurrency&&n.saturated(),$t(n.process)})}var i=Bn(n,t);return i.push=function(n,t,r){u(i,n,t,r)},delete i.unshift,i}function Pn(n,t,r,e){var u=kr.call(n).reverse();R(u,t,r,e)}function Un(n,t,r,e){yn(n,t,function(n,t){r(n,function(n,r){n?t(n):t(null,!r)})},e)}function Cn(n,t){return $n(A,n,t)}function Dn(n,t,r){function e(n,t){if("number"==typeof t)n.times=parseInt(t,10)||i;else{if("object"!=typeof t)throw new Error("Unsupported argument type for 'times': "+typeof t);n.times=parseInt(t.times,10)||i,n.interval=parseInt(t.interval,10)||o}}function u(n,t){function r(n,r){return function(e){n(function(n,t){e(!n||r,{err:n,result:t})},t)}}function e(n){return function(t){setTimeout(function(){t(null)},n)}}for(;f.times;){var u=!(f.times-=1);c.push(r(f.task,u)),!u&&f.interval>0&&c.push(e(f.interval))}Cn(c,function(t,r){r=r[r.length-1],(n||f.callback)(r.err,r.result)})}var i=5,o=0,c=[],f={times:i,interval:o},a=arguments.length;if(1>a||a>3)throw new Error("Invalid arguments - must be either (task), (task, callback), (times, task) or (times, task, callback)");return 2>=a&&"function"==typeof n&&(r=t,t=n),"function"!=typeof n&&e(f,n),f.callback=r,f.task=t,f.callback?u():u}function Hn(n,t,r){function e(n,t){var r=n.criteria,e=t.criteria;return e>r?-1:r>e?1:0}Yt(n,function(n,r){t(n,function(t,e){return t?r(t):void r(null,{value:n,criteria:e})})},function(n,t){return n?r(n):void r(null,H(t.sort(e),s("value")))})}function Nn(n,t,r,e){for(var u=-1,i=xr(Lr((t-n)/(r||1)),0),o=Array(i);i--;)o[e?i:++u]=n,n+=r;return o}function Qn(n,t,r){Yt(Nn(0,n,1),t,r)}function Rn(n,t,r,e){return Zt(Nn(0,n,1),t,r,e)}function Wn(n,t,r){_t(Nn(0,n,1),t,r)}function Gn(n,t,r,e){3===arguments.length&&(e=r,r=t,t=St(n)?[]:{}),x(n,function(n,e,u){r(t,n,e,u)},function(n){e(n,t)})}function Jn(n){return function(){return(n.unmemoized||n).apply(null,arguments)}}function Kn(n,t,r){return en(function(){return!n.apply(this,arguments)},t,r)}function Vn(n,t){function r(n){return o(function(e,u){if(e)t.apply(null,[e].concat(u));else{var i=n.next();i?u.push(r(i)):u.push(t),sn(n).apply(null,u)}})}return t=a(t||l),St(n)?n.length?void r(mn(n))():t():t(new Error("First argument to waterfall must be an array of functions"))}var Xn,Yn="[object Function]",Zn="[object GeneratorFunction]",_n=Object.prototype,nt=_n.toString,tt=NaN,rt=/^\s+|\s+$/g,et=/^[-+]0x[0-9a-f]+$/i,ut=/^0b[01]+$/i,it=/^0o[0-7]+$/i,ot=parseInt,ct=1/0,ft=1.7976931348623157e308,at="Expected a function",lt=Math.max,st="Expected a function",pt=s("length"),yt=9007199254740991,ht=Object.prototype,vt=ht.hasOwnProperty,mt=Object.getPrototypeOf,dt=Object.keys,gt="[object Arguments]",bt=Object.prototype,kt=bt.hasOwnProperty,wt=bt.toString,jt=bt.propertyIsEnumerable,St=Array.isArray,Ot="[object String]",Et=Object.prototype,Lt=Et.toString,xt=9007199254740991,At=/^(?:0|[1-9]\d*)$/,Tt=Object.prototype,It=c(x),zt="function"==typeof setImmediate&&setImmediate;Xn=zt?function(n){zt(n)}:"object"==typeof process&&"function"==typeof process.nextTick?process.nextTick:function(n){setTimeout(n,0)};var $t=Xn,Mt=c(A),qt=o(function(n,t){return o(function(r){return n.apply(null,t.concat(r))})}),Bt=$(),Ft=Math.max,Pt=Array.prototype.reverse,Ut=K(J),Ct=V(J),Dt=o(function(n){var t=[null].concat(n);return function(n){return n.apply(this,t)}}),Ht=X(x,q,Y),Nt=X(_,q,Y),Qt=X(A,q,Y),Rt=nn("dir"),Wt=X(x,pn,pn),Gt=X(_,pn,pn),Jt=K(yn),Kt=hn(yn),Vt=V(yn),Xt=nn("log"),Yt=K(dn),Zt=hn(dn),_t=V(dn),nr={"function":!0,object:!0},tr=nr[typeof n]&&n&&!n.nodeType?n:null,rr=nr[typeof module]&&module&&!module.nodeType?module:null,er=gn(tr&&rr&&"object"==typeof global&&global),ur=gn(nr[typeof self]&&self),ir=gn(nr[typeof window]&&window),or=gn(nr[typeof this]&&this),cr=er||ir!==(or&&or.window)&&ir||ur||or||Function("return this")(),fr=cr.Symbol,ar="[object Symbol]",lr=Object.prototype,sr=lr.toString,pr=1/0,yr=fr?fr.prototype:void 0,hr=fr?yr.toString:void 0,vr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g,mr=/\\(\\)?/g,dr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,gr=/^\w*$/,br="object"==typeof process&&"function"==typeof process.nextTick?process.nextTick:$t,kr=Array.prototype.slice,wr=K(Un),jr=hn(Un),Sr=V(Un),Or=X(x,Boolean,q),Er=X(_,Boolean,q),Lr=Math.ceil,xr=Math.max,Ar={applyEach:It,applyEachSeries:Mt,apply:qt,asyncify:T,auto:D,cargo:Q,compose:G,concat:Ut,concatSeries:Ct,constant:Dt,detect:Ht,detectLimit:Nt,detectSeries:Qt,dir:Rt,doDuring:rn,doUntil:on,doWhilst:un,during:tn,each:fn,eachLimit:an,eachOf:x,eachOfLimit:_,eachOfSeries:A,eachSeries:ln,ensureAsync:sn,every:Wt,everyLimit:Gt,filter:Jt,filterLimit:Kt,filterSeries:Vt,forever:vn,iterator:mn,log:Xt,map:Yt,mapLimit:Zt,mapSeries:_t,memoize:zn,nextTick:br,parallel:Mn,parallelLimit:qn,priorityQueue:Fn,queue:Bn,reduce:R,reduceRight:Pn,reject:wr,rejectLimit:jr,rejectSeries:Sr,retry:Dn,seq:W,series:Cn,setImmediate:$t,some:Or,someLimit:Er,sortBy:Hn,times:Qn,timesLimit:Rn,timesSeries:Wn,transform:Gn,unmemoize:Jn,until:Kn,waterfall:Vn,whilst:en,all:Wt,any:Or,forEach:fn,forEachSeries:ln,forEachLimit:an,forEachOf:x,forEachOfSeries:A,forEachOfLimit:_,inject:R,foldl:R,foldr:Pn,select:Jt,selectLimit:Kt,selectSeries:Vt,wrapSync:T};n["default"]=Ar,n.applyEach=It,n.applyEachSeries=Mt,n.apply=qt,n.asyncify=T,n.auto=D,n.cargo=Q,n.compose=G,n.concat=Ut,n.concatSeries=Ct,n.constant=Dt,n.detect=Ht,n.detectLimit=Nt,n.detectSeries=Qt,n.dir=Rt,n.doDuring=rn,n.doUntil=on,n.doWhilst=un,n.during=tn,n.each=fn,n.eachLimit=an,n.eachOf=x,n.eachOfLimit=_,n.eachOfSeries=A,n.eachSeries=ln,n.ensureAsync=sn,n.every=Wt,n.everyLimit=Gt,n.filter=Jt,n.filterLimit=Kt,n.filterSeries=Vt,n.forever=vn,n.iterator=mn,n.log=Xt,n.map=Yt,n.mapLimit=Zt,n.mapSeries=_t,n.memoize=zn,n.nextTick=br,n.parallel=Mn,n.parallelLimit=qn,n.priorityQueue=Fn,n.queue=Bn,n.reduce=R,n.reduceRight=Pn,n.reject=wr,n.rejectLimit=jr,n.rejectSeries=Sr,n.retry=Dn,n.seq=W,n.series=Cn,n.setImmediate=$t,n.some=Or,n.someLimit=Er,n.sortBy=Hn,n.times=Qn,n.timesLimit=Rn,n.timesSeries=Wn,n.transform=Gn,n.unmemoize=Jn,n.until=Kn,n.waterfall=Vn,n.whilst=en,n.all=Wt,n.any=Or,n.forEach=fn,n.forEachSeries=ln,n.forEachLimit=an,n.forEachOf=x,n.forEachOfSeries=A,n.forEachOfLimit=_,n.inject=R,n.foldl=R,n.foldr=Pn,n.select=Jt,n.selectLimit=Kt,n.selectSeries=Vt,n.wrapSync=T}); //# sourceMappingURL=dist/async.min.map
\ No newline at end of file diff --git a/dist/async.min.map b/dist/async.min.map index 04d3cda..283bd0e 100644 --- a/dist/async.min.map +++ b/dist/async.min.map @@ -1 +1 @@ -{"version":3,"file":"build/async.min.js","sources":["build/async.js"],"names":["noop","identity","v","toBool","notId","only_once","fn","Error","apply","this","arguments","_once","_isArrayLike","arr","_isArray","length","_arrayEach","iterator","index","_map","result","Array","_range","count","i","_reduce","memo","x","a","_forEachOf","object","_keys","key","_indexOf","item","_keyIterator","coll","len","keys","_restParam","func","startIndex","Math","max","rest","call","_withoutIndex","value","callback","_eachOfLimit","limit","obj","nextKey","done","running","errored","replenish","err","doParallel","async","eachOf","doParallelLimit","doSeries","eachOfSeries","_asyncMap","eachfn","results","_filter","push","sort","b","_reject","cb","_createTester","check","getResult","iteratee","_","_findGetResult","_parallel","tasks","task","args","_concat","y","concat","_queue","worker","concurrency","payload","_insert","q","data","pos","started","idle","setImmediate","drain","unshift","saturated","process","_next","workers","removed","workersList","splice","empty","paused","kill","pause","resume","resumeCount","min","w","_console_fn","name","console","error","_times","mapper","_applyEach","fns","go","that","pop","ensureAsync","innerArgs","sync","previous_async","root","self","global","noConflict","_toString","Object","prototype","toString","isArray","_isObject","type","k","hasOwnProperty","_setImmediate","_delay","setTimeout","nextTick","forEach","each","forEachSeries","eachSeries","forEachLimit","eachLimit","forEachOf","completed","iter","forEachOfSeries","iterate","forEachOfLimit","eachOfLimit","map","mapSeries","mapLimit","inject","foldl","reduce","foldr","reduceRight","reversed","reverse","transform","select","filter","selectLimit","filterLimit","selectSeries","filterSeries","reject","rejectLimit","rejectSeries","any","some","someLimit","all","every","everyLimit","detect","detectSeries","detectLimit","sortBy","comparator","left","right","criteria","auto","addListener","listeners","removeListener","idx","taskComplete","remainingTasks","slice","runningTasks","hasError","ready","requires","listener","taskCallback","dep","safeResults","val","rkey","join","retry","times","parseTimes","acc","t","parseInt","DEFAULT_TIMES","interval","DEFAULT_INTERVAL","wrappedTask","wrappedCallback","wrappedResults","retryAttempt","finalAttempt","seriesCallback","retryInterval","opts","attempts","series","waterfall","wrapIterator","next","parallel","parallelLimit","makeCallback","callArgs","concatSeries","whilst","test","doWhilst","calls","until","doUntil","during","truth","doDuring","queue","items","priorityQueue","_compareTasks","priority","_binarySearch","sequence","compare","beg","end","mid","cargo","log","dir","memoize","hasher","queues","has","memoized","l","unmemoized","unmemoize","timesSeries","timesLimit","seq","newargs","nextargs","compose","applyEach","applyEachSeries","forever","constant","values","wrapSync","asyncify","e","then","message","module","exports","define","amd"],"mappings":"AAAA,cASA,WAGI,QAASA,MACT,QAASC,GAASC,GACd,MAAOA,GAEX,QAASC,GAAOD,GACZ,QAASA,EAEb,QAASE,GAAMF,GACX,OAAQA,EAoBZ,QAASG,GAAUC,GACf,MAAO,YACH,GAAW,OAAPA,EAAa,KAAM,IAAIC,OAAM,+BACjCD,GAAGE,MAAMC,KAAMC,WACfJ,EAAK,MAIb,QAASK,GAAML,GACX,MAAO,YACQ,OAAPA,IACJA,EAAGE,MAAMC,KAAMC,WACfJ,EAAK,OAkBb,QAASM,GAAaC,GAClB,MAAOC,GAASD,IAEM,gBAAfA,GAAIE,QAAuBF,EAAIE,QAAU,GAAKF,EAAIE,OAAS,IAAM,EAG5E,QAASC,GAAWH,EAAKI,GAIrB,IAHA,GAAIC,GAAQ,GACRH,EAASF,EAAIE,SAERG,EAAQH,GACbE,EAASJ,EAAIK,GAAQA,EAAOL,GAIpC,QAASM,GAAKN,EAAKI,GAKf,IAJA,GAAIC,GAAQ,GACRH,EAASF,EAAIE,OACbK,EAASC,MAAMN,KAEVG,EAAQH,GACbK,EAAOF,GAASD,EAASJ,EAAIK,GAAQA,EAAOL,EAEhD,OAAOO,GAGX,QAASE,GAAOC,GACZ,MAAOJ,GAAKE,MAAME,GAAQ,SAAUrB,EAAGsB,GACnC,MAAOA,KAIf,QAASC,GAAQZ,EAAKI,EAAUS,GAI5B,MAHAV,GAAWH,EAAK,SAAUc,EAAGH,EAAGI,GAC5BF,EAAOT,EAASS,EAAMC,EAAGH,EAAGI,KAEzBF,EAGX,QAASG,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],"names":["global","factory","exports","module","define","amd","async","this","apply$1","func","thisArg","args","length","call","apply","isObject","value","type","isFunction","tag","objectToString$2","funcTag","genTag","toNumber","other","valueOf","replace","reTrim","isBinary","reIsBinary","test","reIsOctal","freeParseInt","slice","reIsBadHex","NAN","toInteger","INFINITY","sign","MAX_INTEGER","remainder","rest","start","TypeError","FUNC_ERROR_TEXT","nativeMax","undefined","arguments","index","array","Array","otherArgs","applyEach$1","eachfn","fns","go","that","callback","pop","fn","_","cb","concat","before","n","result","FUNC_ERROR_TEXT$1","once","noop","baseProperty","key","object","isLength","MAX_SAFE_INTEGER$1","isArrayLike","getLength","baseHas","hasOwnProperty","getPrototypeOf","baseKeys","nativeKeys","Object","baseTimes","iteratee","isObjectLike","isArrayLikeObject","isArguments","hasOwnProperty$1","propertyIsEnumerable","objectToString","argsTag","isString","isArray","objectToString$1","stringTag","indexKeys","String","isIndex","reIsUint","MAX_SAFE_INTEGER","isPrototype","Ctor","constructor","proto","prototype","objectProto$1","keys","isProto","indexes","skipIndexes","push","keyIterator","coll","len","i","okeys","onlyOnce","Error","eachOf","iterator","done","err","completed","iter","eachOfSeries","obj","iterate","sync","nextKey","setImmediate$1","asyncify","e","then","message","arrayEach","arrayEvery","predicate","createBaseFor","fromRight","keysFunc","iterable","props","baseForOwn","baseFor","identity","toFunction","forOwn","indexOfNaN","fromIndex","baseIndexOf","indexOf","nativeMax$1","auto","tasks","concurrency","addListener","listeners","unshift","removeListener","idx","splice","taskComplete","remainingTasks","keys$$","results","runningTasks","hasError","k","ready","requires","x","listener","task","taskCallback","dep","safeResults","val","rkey","join","arrayMap","queue$1","worker","payload","_insert","q","data","pos","started","idle","drain","item","saturated","process","_next","workers","removed","workersList","empty","paused","kill","running","pause","resume","resumeCount","Math","min","w","cargo","reduce","arr","memo","v","seq","newargs","nextargs","compose","reverse","concat$1","y","doParallel","doSeries","_createTester","check","getResult","limit","_findGetResult","_eachOfLimit","errored","replenish","eachOfLimit","consoleFunc","name","console","error","during","next","truth","doDuring","calls","whilst","doWhilst","doUntil","_withoutIndex","each","eachLimit","eachSeries","ensureAsync","innerArgs","notId","_filter","sort","a","b","doParallelLimit","forever","makeCallback","_asyncMap","checkGlobal","isSymbol","objectToString$3","symbolTag","toString","Symbol","symbolToString","INFINITY$1","stringToPath","string","rePropName","match","number","quote","reEscapeChar","baseToPath","isKey","reIsPlainProp","reIsDeepProp","last","baseSlice","end","baseGet","path","get","defaultValue","parent","hasPath","hasFunc","has","memoize","hasher","create","queues","memoized","l","unmemoized","_parallel","parallel","parallelLimit","queue","items","priorityQueue","_compareTasks","priority","_binarySearch","sequence","compare","beg","mid","reduceRight","reversed","reject$1","series","retry","times","parseTimes","acc","t","parseInt","DEFAULT_TIMES","interval","DEFAULT_INTERVAL","wrappedTask","wrappedCallback","wrappedResults","retryAttempt","finalAttempt","seriesCallback","retryInterval","setTimeout","opts","attempts","sortBy","comparator","left","right","criteria","map","baseRange","step","nativeMax$2","nativeCeil","count","timeLimit","mapLimit","timesSeries","mapSeries","transform","unmemoize","until","waterfall","wrapIterator","_delay","objectProto$4","max","objectProto","objectProto$2","objectProto$3","applyEach","_setImmediate","setImmediate","nextTick","applyEachSeries","callArgs","concatSeries","constant","values","detect","detectLimit","detectSeries","dir","every","everyLimit","filter","filterLimit","filterSeries","log","objectTypes","function","freeExports","nodeType","freeModule","freeGlobal","freeSelf","self","freeWindow","window","thisGlobal","root","Function","objectProto$5","symbolProto","nexTick","reject","rejectLimit","rejectSeries","some","Boolean","someLimit","ceil","timesLimit","all","any","forEach","forEachSeries","forEachLimit","forEachOf","forEachOfSeries","forEachOfLimit","inject","foldl","foldr","select","selectLimit","selectSeries","wrapSync"],"mappings":"CAAC,SAAUA,EAAQC,GACE,gBAAZC,UAA0C,mBAAXC,QAAyBF,EAAQC,SACrD,kBAAXE,SAAyBA,OAAOC,IAAMD,QAAQ,WAAYH,GAChEA,EAASD,EAAOM,WACjBC,KAAM,SAAUL,GAAW,YAY3B,SAASM,GAAQC,EAAM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