From 176b109ae7ae51d50a4ca986ecfb8028c4edfccd Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 20 Oct 2014 20:10:25 -0700 Subject: [PATCH] Rebuild dist. --- dist/lodash.compat.js | 1063 +++++++++++++++++++++++---------- dist/lodash.compat.min.js | 151 ++--- dist/lodash.js | 1032 +++++++++++++++++++++++--------- dist/lodash.min.js | 142 ++--- dist/lodash.underscore.js | 424 ++++++------- dist/lodash.underscore.min.js | 83 ++- 6 files changed, 1929 insertions(+), 966 deletions(-) diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index 41d710b07..fbcb81dc9 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -32,20 +32,14 @@ var HOT_COUNT = 150, HOT_SPAN = 16; - /** Used as the TypeError message for "Functions" methods */ + /** Used to indicate the type of lazy iteratees */ + var LAZY_FILTER_FLAG = 1, + LAZY_MAP_FLAG = 2, + LAZY_WHILE_FLAG = 3; + + /** Used as the `TypeError` message for "Functions" methods */ var FUNC_ERROR_TEXT = 'Expected a function'; - /** Used as references for the max length and index of an array */ - var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1, - MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1; - - /** - * Used as the maximum length of an array-like value. - * See the [ES6 spec](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength) - * for more details. - */ - var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; - /** Used as the internal argument placeholder */ var PLACEHOLDER = '__lodash_placeholder__'; @@ -206,6 +200,27 @@ 'trailing': false }; + /** Used to map latin-1 supplementary letters to basic latin letters */ + var deburredLetters = { + '\xC0': 'A', '\xC1': 'A', '\xC2': 'A', '\xC3': 'A', '\xC4': 'A', '\xC5': 'A', + '\xE0': 'a', '\xE1': 'a', '\xE2': 'a', '\xE3': 'a', '\xE4': 'a', '\xE5': 'a', + '\xC7': 'C', '\xE7': 'c', + '\xD0': 'D', '\xF0': 'd', + '\xC8': 'E', '\xC9': 'E', '\xCA': 'E', '\xCB': 'E', + '\xE8': 'e', '\xE9': 'e', '\xEA': 'e', '\xEB': 'e', + '\xCC': 'I', '\xCD': 'I', '\xCE': 'I', '\xCF': 'I', + '\xEC': 'i', '\xED': 'i', '\xEE': 'i', '\xEF': 'i', + '\xD1': 'N', '\xF1': 'n', + '\xD2': 'O', '\xD3': 'O', '\xD4': 'O', '\xD5': 'O', '\xD6': 'O', '\xD8': 'O', + '\xF2': 'o', '\xF3': 'o', '\xF4': 'o', '\xF5': 'o', '\xF6': 'o', '\xF8': 'o', + '\xD9': 'U', '\xDA': 'U', '\xDB': 'U', '\xDC': 'U', + '\xF9': 'u', '\xFA': 'u', '\xFB': 'u', '\xFC': 'u', + '\xDD': 'Y', '\xFD': 'y', '\xFF': 'y', + '\xC6': 'Ae', '\xE6': 'ae', + '\xDE': 'Th', '\xFE': 'th', + '\xDF': 'ss' + }; + /** * Used to map characters to HTML entities. * @@ -239,25 +254,11 @@ '`': '`' }; - /** Used to map latin-1 supplementary letters to basic latin letters */ - var deburredLetters = { - '\xC0': 'A', '\xC1': 'A', '\xC2': 'A', '\xC3': 'A', '\xC4': 'A', '\xC5': 'A', - '\xE0': 'a', '\xE1': 'a', '\xE2': 'a', '\xE3': 'a', '\xE4': 'a', '\xE5': 'a', - '\xC7': 'C', '\xE7': 'c', - '\xD0': 'D', '\xF0': 'd', - '\xC8': 'E', '\xC9': 'E', '\xCA': 'E', '\xCB': 'E', - '\xE8': 'e', '\xE9': 'e', '\xEA': 'e', '\xEB': 'e', - '\xCC': 'I', '\xCD': 'I', '\xCE': 'I', '\xCF': 'I', - '\xEC': 'i', '\xED': 'i', '\xEE': 'i', '\xEF': 'i', - '\xD1': 'N', '\xF1': 'n', - '\xD2': 'O', '\xD3': 'O', '\xD4': 'O', '\xD5': 'O', '\xD6': 'O', '\xD8': 'O', - '\xF2': 'o', '\xF3': 'o', '\xF4': 'o', '\xF5': 'o', '\xF6': 'o', '\xF8': 'o', - '\xD9': 'U', '\xDA': 'U', '\xDB': 'U', '\xDC': 'U', - '\xF9': 'u', '\xFA': 'u', '\xFB': 'u', '\xFC': 'u', - '\xDD': 'Y', '\xFD': 'y', '\xFF': 'y', - '\xC6': 'Ae', '\xE6': 'ae', - '\xDE': 'Th', '\xFE': 'th', - '\xDF': 'ss' + /** Used to map iteratee types to lazy methods */ + var lazyIterateeTypes = { + 'filter': LAZY_FILTER_FLAG, + 'map': LAZY_MAP_FLAG, + 'takeWhile': LAZY_WHILE_FLAG }; /** Used to determine if values are of the language type `Object` */ @@ -359,26 +360,6 @@ return true; } - /** - * A specialized version of `_.map` for arrays without support for callback - * shorthands or `this` binding. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the new mapped array. - */ - function arrayMap(array, iteratee) { - var index = -1, - length = array.length, - result = Array(length); - - while (++index < length) { - result[index] = iteratee(array[index], index, array); - } - return result; - } - /** * A specialized version of `_.filter` for arrays without support for callback * shorthands or `this` binding. @@ -403,6 +384,26 @@ return result; } + /** + * A specialized version of `_.map` for arrays without support for callback + * shorthands or `this` binding. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ + function arrayMap(array, iteratee) { + var index = -1, + length = array.length, + result = Array(length); + + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; + } + /** * A specialized version of `_.reduce` for arrays without support for callback * shorthands or `this` binding. @@ -664,7 +665,7 @@ } /** - * Used by `deburr` to convert latin-1 to basic latin letters. + * Used by `_.deburr` to convert latin-1 to basic latin letters. * * @private * @param {string} letter The matched letter to deburr. @@ -758,7 +759,7 @@ } /** - * Used by `_.trimmedLeftIndex` and `_.trimmedRightIndex` to determine if a + * Used by `trimmedLeftIndex` and `trimmedRightIndex` to determine if a * character code is whitespace. * * @private @@ -979,13 +980,28 @@ nativeParseInt = context.parseInt, nativeRandom = Math.random; + /** Used as references for `-Infinity` and `Infinity` */ + var NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY, + POSITIVE_INFINITY = Number.POSITIVE_INFINITY; + + /** Used as references for the max length and index of an array */ + var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1, + MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1; + /** Used as the size, in bytes, of each Float64Array element */ var FLOAT64_BYTES_PER_ELEMENT = Float64Array ? Float64Array.BYTES_PER_ELEMENT : 0; + /** + * Used as the maximum length of an array-like value. + * See the [ES6 spec](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength) + * for more details. + */ + var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; + /** Used to store function metadata */ var metaMap = WeakMap && new WeakMap; - /** Used to lookup a built-in constructor by [[Class]] */ + /** Used to lookup a built-in constructor by `[[Class]]` */ var ctorByClass = {}; ctorByClass[float32Class] = context.Float32Array; ctorByClass[float64Class] = context.Float64Array; @@ -1085,29 +1101,14 @@ */ function lodash(value) { if (value && typeof value == 'object') { - if (value instanceof lodashWrapper) { + if (value instanceof LodashWrapper) { return value; } if (!isArray(value) && hasOwnProperty.call(value, '__wrapped__')) { - return new lodashWrapper(value.__wrapped__, value.__chain__, baseSlice(value.__queue__)); + return new LodashWrapper(value.__wrapped__, value.__chain__, baseSlice(value.__queue__)); } } - return new lodashWrapper(value); - } - - /** - * A fast path for creating `lodash` wrapper objects. - * - * @private - * @param {*} value The value to wrap in a `lodash` instance. - * @param {boolean} [chainAll=false] Enable chaining for all methods. - * @param {Array} [queue=[]] Actions to peform to resolve the unwrapped value. - * @returns {Object} Returns a `lodash` instance. - */ - function lodashWrapper(value, chainAll, queue) { - this.__chain__ = !!chainAll; - this.__queue__ = queue || []; - this.__wrapped__ = value; + return new LodashWrapper(value); } /** @@ -1151,7 +1152,7 @@ * * Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1 * (if the prototype or a property on the prototype has been set) - * incorrectly sets the `[[Enumerable]]` value of a function's `prototype` + * incorrectly set the `[[Enumerable]]` value of a function's `prototype` * property to `true`. * * @memberOf _.support @@ -1207,8 +1208,7 @@ support.nonEnumShadows = !/valueOf/.test(props); /** - * Detect if own properties are iterated after inherited properties - * (IE < 9). + * Detect if own properties are iterated after inherited properties (IE < 9). * * @memberOf _.support * @type boolean @@ -1336,6 +1336,48 @@ /*------------------------------------------------------------------------*/ + /** + * A specialized version of `_.max` for arrays without support for iteratees. + * + * @private + * @param {Array} array The array to iterate over. + * @returns {*} Returns the maximum value. + */ + function arrayMax(array) { + var index = -1, + length = array.length, + result = NEGATIVE_INFINITY; + + while (++index < length) { + var value = array[index]; + if (value > result) { + result = value; + } + } + return result; + } + + /** + * A specialized version of `_.min` for arrays without support for iteratees. + * + * @private + * @param {Array} array The array to iterate over. + * @returns {*} Returns the minimum value. + */ + function arrayMin(array) { + var index = -1, + length = array.length, + result = POSITIVE_INFINITY; + + while (++index < length) { + var value = array[index]; + if (value < result) { + result = value; + } + } + return result; + } + /** * Used by `_.defaults` to customize its `_.assign` use. * @@ -1345,9 +1387,7 @@ * @returns {*} Returns the value to assign to the destination object. */ function assignDefaults(objectValue, sourceValue) { - return typeof objectValue == 'undefined' - ? sourceValue - : objectValue; + return typeof objectValue == 'undefined' ? sourceValue : objectValue; } /** @@ -1369,6 +1409,18 @@ : objectValue; } + /** + * Used by `_.matches` to clone `source` values, letting uncloneable values + * passthu instead of returning empty objects. + * + * @private + * @param {*} value The value to clone. + * @returns {*} Returns the cloned value. + */ + function clonePassthru(value) { + return isCloneable(value) ? undefined : value; + } + /** * The base implementation of `_.assign` without support for argument juggling, * multiple sources, and `this` binding. @@ -1418,7 +1470,7 @@ * "_.pluck" and "_.where" style callbacks. * * @private - * @param {*} [func=identity] The value to convert to a callback. + * @param {*} [func=_.identity] The value to convert to a callback. * @param {*} [thisArg] The `this` binding of the created callback. * @param {number} [argCount] The number of arguments the callback accepts. * @returns {Function} Returns the new function. @@ -1432,6 +1484,7 @@ } var data = getData(func); if (typeof data == 'undefined') { + var support = lodash.support; if (support.funcNames) { data = !func.name; } @@ -1485,12 +1538,17 @@ * @param {*} value The value to clone. * @param {boolean} [isDeep=false] Specify a deep clone. * @param {Function} [customizer] The function to customize cloning values. + * @param {string} [key] The key of `value`. + * @param {Object} [object] The object `value` belongs to. * @param {Array} [stackA=[]] Tracks traversed source objects. * @param {Array} [stackB=[]] Associates clones with source counterparts. * @returns {*} Returns the cloned value. */ - function baseClone(value, isDeep, customizer, stackA, stackB) { - var result = customizer ? customizer(value) : undefined; + function baseClone(value, isDeep, customizer, key, object, stackA, stackB) { + var result; + if (customizer) { + result = object ? customizer(value, key, object) : customizer(value); + } if (typeof result != 'undefined') { return result; } @@ -1500,7 +1558,12 @@ result = initArrayClone(value, isDeep); } else if (isObject(value)) { result = initObjectClone(value, isDeep); - value = (isDeep && toString.call(result) == objectClass) ? value : result; + if (result === null) { + isDeep = false; + result = {}; + } else if (isDeep) { + isDeep = toString.call(result) == objectClass; + } } if (!isDeep || result === value) { return result; @@ -1521,11 +1584,8 @@ stackB.push(result); // recursively populate clone (susceptible to call stack limits) - (isArr ? arrayEach : baseForOwn)(value, function(valValue, key) { - var valClone = customizer ? customizer(valValue, key) : undefined; - result[key] = typeof valClone == 'undefined' - ? baseClone(valValue, isDeep, null, stackA, stackB) - : valClone; + (isArr ? arrayEach : baseForOwn)(value, function(subValue, key) { + result[key] = baseClone(subValue, isDeep, customizer, key, value, stackA, stackB); }); return result; } @@ -1688,8 +1748,8 @@ } /** - * The base implementation of `_.filter` without support for callback shorthands - * or `this` binding. + * The base implementation of `_.filter` without support for callback + * shorthands or `this` binding. * * @private * @param {Array|Object|string} collection The collection to iterate over. @@ -1954,7 +2014,7 @@ return false; } if (valIsErr || valIsObj) { - if (!support.argsClass) { + if (!lodash.support.argsClass) { valIsArg = isArguments(value); othIsArg = isArguments(other); } @@ -2200,6 +2260,7 @@ * @param {Function} func The function to partially apply arguments to. * @param {number} bitmask The bitmask of flags to compose. * @param {Array} args The arguments to be partially applied. + * @param {Array} holders The `args` placeholder indexes. * @param {*} [thisArg] The `this` binding of `func`. * @returns {Function} Returns the new partially applied function. */ @@ -2490,7 +2551,7 @@ * * @private * @param {Array} partialRightArgs The arguments to append to those provided. - * @param {Array} partialHolders The `partialRightArgs` placeholder indexes. + * @param {Array} partialRightHolders The `partialRightArgs` placeholder indexes. * @param {Array|Object} args The provided arguments. * @returns {Array} Returns the new array of composed arguments. */ @@ -2590,7 +2651,7 @@ * @private * @param {Function} func The function to bind. * @param {*} [thisArg] The `this` binding of `func`. - * @returns {Function} Returns the new wrapped function. + * @returns {Function} Returns the new bound function. */ function createBindWrapper(func, thisArg) { var Ctor = createCtorWrapper(func); @@ -2635,7 +2696,7 @@ result = ''; while (++index < length) { - result = callback(result, array[index], index, words); + result = callback(result, array[index], index); } return result; }; @@ -2647,7 +2708,7 @@ * * @private * @param {Function} Ctor The constructor to wrap. - * @returns {Function} Returns the new function. + * @returns {Function} Returns the new wrapped function. */ function createCtorWrapper(Ctor) { return function() { @@ -2673,7 +2734,7 @@ * @param {Array} [partialHolders] The `partialArgs` placeholder indexes. * @param {Array} [partialRightArgs] The arguments to append to those provided to the new function. * @param {Array} [partialRightHolders] The `partialRightArgs` placeholder indexes. - * @returns {Function} Returns the new function. + * @returns {Function} Returns the new wrapped function. */ function createHybridWrapper(func, bitmask, arity, thisArg, partialArgs, partialHolders, partialRightArgs, partialRightHolders) { var isBind = bitmask & BIND_FLAG, @@ -2811,7 +2872,7 @@ * @param {Array} [partialHolders] The `partialArgs` placeholder indexes. * @param {Array} [partialRightArgs] The arguments to append to those provided to the new function. * @param {Array} [partialRightHolders] The `partialRightArgs` placeholder indexes. - * @returns {Function} Returns the new function. + * @returns {Function} Returns the new wrapped function. */ function createWrapper(func, bitmask, arity, thisArg, partialArgs, partialHolders, partialRightArgs, partialRightHolders) { var isBindKey = bitmask & BIND_KEY_FLAG; @@ -2926,9 +2987,9 @@ * Initializes an array clone. * * @private - * @param {*} value The value to clone. + * @param {Array} array The array to clone. * @param {boolean} [isDeep=false] Specify a deep clone. - * @returns {*} Returns the initialized clone value. + * @returns {Array} Returns the initialized array clone. */ function initArrayClone(array, isDeep) { var index = -1, @@ -2952,17 +3013,17 @@ * Initializes an object clone. * * @private - * @param {*} value The value to clone. + * @param {Object} object The object to clone. * @param {boolean} [isDeep=false] Specify a deep clone. - * @returns {*} Returns the initialized clone value. + * @returns {null|Object} Returns the initialized object clone. */ function initObjectClone(object, isDeep) { - var className = toString.call(object); - if (!cloneableClasses[className] || isHostObject(object)) { - return object; + if (!isCloneable(object)) { + return null; } var Ctor = object.constructor, - isArgs = className == argsClass || (!support.argsClass && isArguments(object)), + className = toString.call(object), + isArgs = className == argsClass || (!lodash.support.argsClass && isArguments(object)), isObj = className == objectClass; if (isObj && !(typeof Ctor == 'function' && Ctor instanceof Ctor)) { @@ -3016,6 +3077,17 @@ arrayLikeClasses[toString.call(value)]) || false; } + /** + * Checks if `value` is cloneable. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is cloneable, else `false`. + */ + function isCloneable(value) { + return (value && cloneableClasses[toString.call(value)] && !isHostObject(value)) || false; + } + /** * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. * @@ -3116,7 +3188,7 @@ */ function shimIsPlainObject(value) { var Ctor, - result; + support = lodash.support; // exit early for non `Object` objects if (!(value && typeof value == 'object' && @@ -3129,8 +3201,9 @@ // IE < 9 iterates inherited properties before own properties. If the first // iterated property is an object's own property then there are no inherited // enumerable properties. + var result; if (support.ownLast) { - baseForIn(value, function(value, key, object) { + baseForIn(value, function(subValue, key, object) { result = hasOwnProperty.call(object, key); return false; }); @@ -3139,7 +3212,7 @@ // In most environments an object's own properties are iterated before // its inherited properties. If the last iterated property is an object's // own property then there are no inherited enumerable properties. - baseForIn(value, function(value, key) { + baseForIn(value, function(subValue, key) { result = key; }); return typeof result == 'undefined' || hasOwnProperty.call(value, result); @@ -3154,21 +3227,22 @@ * @returns {Array} Returns the array of property names. */ function shimKeys(object) { - var keyIndex, - index = -1, - props = keysIn(object), + var props = keysIn(object), length = props.length, objLength = length && object.length, - maxIndex = objLength - 1, - result = []; + support = lodash.support; var allowIndexes = typeof objLength == 'number' && objLength > 0 && (isArray(object) || (support.nonEnumStrings && isString(object)) || (support.nonEnumArgs && isArguments(object))); + var keyIndex, + index = -1, + result = []; + while (++index < length) { var key = props[index]; - if ((allowIndexes && (keyIndex = +key, keyIndex > -1 && keyIndex <= maxIndex && keyIndex % 1 == 0)) || + if ((allowIndexes && (keyIndex = +key, keyIndex > -1 && keyIndex < objLength && keyIndex % 1 == 0)) || hasOwnProperty.call(object, key)) { result.push(key); } @@ -3191,7 +3265,7 @@ if (!(typeof length == 'number' && length > -1 && length <= MAX_SAFE_INTEGER)) { return values(value); } - if (support.unindexedChars && isString(value)) { + if (lodash.support.unindexedChars && isString(value)) { return value.split(''); } return isObject(value) ? value : Object(value); @@ -3205,7 +3279,7 @@ * @returns {Object} Returns the object. */ function toObject(value) { - if (support.unindexedChars && isString(value)) { + if (lodash.support.unindexedChars && isString(value)) { var index = -1, length = value.length, result = Object(value); @@ -3286,8 +3360,9 @@ * Creates an array excluding all values of the provided arrays using * `SameValueZero` for equality comparisons. * - * **Note:** `SameValueZero` is like strict equality, e.g. `===`, except that - * `NaN` matches `NaN`. See the [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * **Note:** `SameValueZero` comparisons are like strict equality comparisons, + * e.g. `===`, except that `NaN` matches `NaN`. See the + * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for more details. * * @static @@ -3393,7 +3468,7 @@ * @type Function * @category Array * @param {Array} array The array to query. - * @param {Function|Object|string} [predicate=identity] The function invoked + * @param {Function|Object|string} [predicate=_.identity] The function invoked * per element. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {Array} Returns the slice of `array`. @@ -3442,7 +3517,7 @@ * @type Function * @category Array * @param {Array} array The array to query. - * @param {Function|Object|string} [predicate=identity] The function invoked + * @param {Function|Object|string} [predicate=_.identity] The function invoked * per element. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {Array} Returns the slice of `array`. @@ -3489,7 +3564,7 @@ * @memberOf _ * @category Array * @param {Array} array The array to search. - * @param {Function|Object|string} [predicate=identity] The function invoked + * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. @@ -3543,7 +3618,7 @@ * @memberOf _ * @category Array * @param {Array} array The array to search. - * @param {Function|Object|string} [predicate=identity] The function invoked + * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. @@ -3651,8 +3726,9 @@ * it is used as the offset from the end of the collection. If `array` is * sorted providing `true` for `fromIndex` performs a faster binary search. * - * **Note:** `SameValueZero` is like strict equality, e.g. `===`, except that - * `NaN` matches `NaN`. See the [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * **Note:** `SameValueZero` comparisons are like strict equality comparisons, + * e.g. `===`, except that `NaN` matches `NaN`. See the + * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for more details. * * @static @@ -3684,8 +3760,10 @@ if (typeof fromIndex == 'number') { fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0); } else if (fromIndex) { - var index = sortedIndex(array, value); - return array[index] === value ? index : -1; + var index = sortedIndex(array, value), + other = array[index]; + + return (value === value ? value === other : other !== other) ? index : -1; } return baseIndexOf(array, value, fromIndex); } @@ -3704,16 +3782,16 @@ * // => [1, 2] */ function initial(array) { - var length = array ? array.length : 0; - return slice(array, 0, (length || 1) - 1); + return dropRight(array, 1); } /** * Creates an array of unique values present in all provided arrays using * `SameValueZero` for equality comparisons. * - * **Note:** `SameValueZero` is like strict equality, e.g. `===`, except that - * `NaN` matches `NaN`. See the [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * **Note:** `SameValueZero` comparisons are like strict equality comparisons, + * e.g. `===`, except that `NaN` matches `NaN`. See the + * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for more details. * * @static @@ -3822,7 +3900,8 @@ index = (fromIndex < 0 ? nativeMax(length + fromIndex, 0) : nativeMin(fromIndex || 0, length - 1)) + 1; } else if (fromIndex) { index = sortedLastIndex(array, value) - 1; - return array[index] === value ? index : -1; + var other = array[index]; + return (value === value ? value === other : other !== other) ? index : -1; } if (value !== value) { return indexOfNaN(array, index, true); @@ -3841,8 +3920,9 @@ * * **Notes:** * - Unlike `_.without`, this method mutates `array`. - * - `SameValueZero` is like strict equality, e.g. `===`, except that `NaN` matches `NaN`. - * See the [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * - `SameValueZero` comparisons are like strict equality comparisons, + * e.g. `===`, except that `NaN` matches `NaN`. See the + * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for more details. * * @static @@ -3925,7 +4005,7 @@ * @memberOf _ * @category Array * @param {Array} array The array to modify. - * @param {Function|Object|string} [predicate=identity] The function invoked + * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. @@ -3973,7 +4053,7 @@ * // => [2, 3] */ function rest(array) { - return slice(array, 1); + return drop(array, 1); } /** @@ -4038,7 +4118,7 @@ * @category Array * @param {Array} array The array to inspect. * @param {*} value The value to evaluate. - * @param {Function|Object|string} [iteratee=identity] The function invoked + * @param {Function|Object|string} [iteratee=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. @@ -4079,7 +4159,7 @@ * @category Array * @param {Array} array The array to inspect. * @param {*} value The value to evaluate. - * @param {Function|Object|string} [iteratee=identity] The function invoked + * @param {Function|Object|string} [iteratee=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. @@ -4174,7 +4254,7 @@ * @type Function * @category Array * @param {Array} array The array to query. - * @param {Function|Object|string} [predicate=identity] The function invoked + * @param {Function|Object|string} [predicate=_.identity] The function invoked * per element. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {Array} Returns the slice of `array`. @@ -4223,7 +4303,7 @@ * @type Function * @category Array * @param {Array} array The array to query. - * @param {Function|Object|string} [predicate=identity] The function invoked + * @param {Function|Object|string} [predicate=_.identity] The function invoked * per element. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {Array} Returns the slice of `array`. @@ -4259,8 +4339,9 @@ * Creates an array of unique values, in order, of the provided arrays using * `SameValueZero` for equality comparisons. * - * **Note:** `SameValueZero` is like strict equality, e.g. `===`, except that - * `NaN` matches `NaN`. See the [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * **Note:** `SameValueZero` comparisons are like strict equality comparisons, + * e.g. `===`, except that `NaN` matches `NaN`. See the + * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for more details. * * @static @@ -4292,8 +4373,9 @@ * returns `true` for elements that have the properties of the given object, * else `false`. * - * **Note:** `SameValueZero` is like strict equality, e.g. `===`, except that - * `NaN` matches `NaN`. See the [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * **Note:** `SameValueZero` comparisons are like strict equality comparisons, + * e.g. `===`, except that `NaN` matches `NaN`. See the + * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for more details. * * @static @@ -4376,8 +4458,9 @@ * Creates an array excluding all provided values using `SameValueZero` for * equality comparisons. * - * **Note:** `SameValueZero` is like strict equality, e.g. `===`, except that - * `NaN` matches `NaN`. See the [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * **Note:** `SameValueZero` comparisons are like strict equality comparisons, + * e.g. `===`, except that `NaN` matches `NaN`. See the + * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for more details. * * @static @@ -4463,25 +4546,25 @@ * @alias object * @category Array * @param {Array} props The property names. - * @param {Array} [vals=[]] The property values. + * @param {Array} [values=[]] The property values. * @returns {Object} Returns the new object. * @example * * _.zipObject(['fred', 'barney'], [30, 40]); * // => { 'fred': 30, 'barney': 40 } */ - function zipObject(props, vals) { + function zipObject(props, values) { var index = -1, length = props ? props.length : 0, result = {}; - if (!vals && length && !isArray(props[0])) { - vals = []; + if (!values && length && !isArray(props[0])) { + values = []; } while (++index < length) { var key = props[index]; - if (vals) { - result[key] = vals[index]; + if (values) { + result[key] = values[index]; } else if (key) { result[key[0]] = key[1]; } @@ -4499,7 +4582,7 @@ * @memberOf _ * @category Chain * @param {*} value The value to wrap. - * @returns {Object} Returns the new wrapper object. + * @returns {Object} Returns the new `LodashWrapper` object. * @example * * var users = [ @@ -4569,13 +4652,30 @@ return interceptor.call(thisArg, value); } + /*------------------------------------------------------------------------*/ + + /** + * A fast path for creating `lodash` wrapper objects. + * + * @private + * @param {*} value The value to wrap. + * @param {boolean} [chainAll=false] Enable chaining for all methods. + * @param {Array} [queue=[]] Actions to peform to resolve the unwrapped value. + * @returns {Object} Returns a `LodashWrapper` instance. + */ + function LodashWrapper(value, chainAll, queue) { + this.__chain__ = !!chainAll; + this.__queue__ = queue || []; + this.__wrapped__ = value; + } + /** * Enables explicit method chaining on the wrapper object. * * @name chain * @memberOf _ * @category Chain - * @returns {*} Returns the wrapper object. + * @returns {*} Returns the `LodashWrapper` object. * @example * * var users = [ @@ -4598,6 +4698,32 @@ return chain(this); } + /** + * Reverses the wrapped array so the first element becomes the last, the + * second element becomes the second to last, and so on. + * + * **Note:** This method mutates the wrapped array. + * + * @name chain + * @memberOf _ + * @category Chain + * @returns {Object} Returns the new reversed `LodashWrapper` object. + * @example + * + * var array = [1, 2, 3]; + * + * _(array).reverse().value() + * // => [3, 2, 1] + * + * console.log(array); + * // => [3, 2, 1] + */ + function wrapperReverse() { + return this.thru(function(value) { + return value.reverse(); + }); + } + /** * Produces the result of coercing the unwrapped value to a string. * @@ -4628,24 +4754,152 @@ * // => [1, 2, 3] */ function wrapperValueOf() { + var result = this.__wrapped__; + if (result instanceof LazyWrapper) { + result = result.value(); + } var index = -1, queue = this.__queue__, - length = queue.length, - result = this.__wrapped__; + length = queue.length; while (++index < length) { var args = [result], data = queue[index], - object = data[1]; + object = data.object; - push.apply(args, data[2]); - result = object[data[0]].apply(object, args); + push.apply(args, data.args); + result = object[data.name].apply(object, args); } return result; } /*------------------------------------------------------------------------*/ + /** + * Wraps `value` as a `LazyWrapper` object. + * + * @private + * @param {*} value The value to wrap. + * @returns {Object} Returns a `LazyWrapper` instance. + */ + function LazyWrapper(value) { + this.dir = 1; + this.dropCount = 0; + this.filtered = false; + this.iteratees = []; + this.takeCount = POSITIVE_INFINITY; + this.views = []; + this.wrapped = value; + } + + /** + * Creates a clone of the `LazyWrapper` object. + * + * @private + * @name clone + * @memberOf LazyWrapper + * @returns {Object} Returns the cloned `LazyWrapper` object. + */ + function lazyClone() { + var result = new LazyWrapper(this.wrapped); + result.dir = this.dir; + result.dropCount = this.dropCount; + result.filtered = this.filtered; + result.takeCount = this.takeCount; + push.apply(result.iteratees, this.iteratees); + push.apply(result.views, this.views); + return result; + } + + /** + * Reverses the direction of lazy iteration. + * + * @private + * @name reverse + * @memberOf LazyWrapper + * @returns {Object} Returns the new reversed `LazyWrapper` object. + */ + function lazyReverse() { + var filtered = this.filtered, + result = filtered ? new LazyWrapper(this) : this.clone(); + + result.dir = this.dir * -1; + result.filtered = filtered; + return result; + } + + /** + * Extracts the unwrapped value from its wrapper. + * + * @private + * @name value + * @memberOf LazyWrapper + * @returns {*} Returns the unwrapped value. + */ + function lazyValue() { + var array = this.wrapped.value(), + length = array.length, + start = 0, + end = length, + views = this.views, + viewIndex = -1, + viewsLength = views.length; + + while (++viewIndex < viewsLength) { + var view = views[viewIndex], + size = view.size; + + switch (view.type) { + case 'drop': start += size; break; + case 'dropRight': end -= size; break; + case 'take': end = nativeMin(end, start + size); break; + case 'takeRight': start = nativeMax(start, end - size); break; + } + } + var dir = this.dir, + dropCount = this.dropCount, + droppedCount = 0, + doneDropping = !dropCount, + takeCount = nativeMin(end - start, this.takeCount - dropCount), + isRight = dir < 0, + index = isRight ? end : start - 1, + iteratees = this.iteratees, + iterateesLength = iteratees.length, + resIndex = 0, + result = []; + + outer: + while (length-- && resIndex < takeCount) { + var iterateesIndex = -1, + value = array[index += dir]; + + while (++iterateesIndex < iterateesLength) { + var data = iteratees[iterateesIndex], + iteratee = data.iteratee, + computed = iteratee(value, index, array), + type = data.type; + + if (type == LAZY_MAP_FLAG) { + value = computed; + } else if (!computed) { + if (type == LAZY_FILTER_FLAG) { + continue outer; + } else { + break outer; + } + } + } + if (doneDropping) { + result[resIndex++] = value; + } else { + doneDropping = ++droppedCount >= dropCount; + } + } + return isRight ? result.reverse() : result; + } + + /*------------------------------------------------------------------------*/ + /** * Creates an array of elements corresponding to the specified keys, or indexes, * of the collection. Keys may be specified as individual arguments or as arrays @@ -4676,12 +4930,13 @@ } /** - * Checks if `value` is present in `collection` using `SameValueZero` for + * Checks if `value` is present in `collection` using `SameValueZero` for * equality comparisons. If `fromIndex` is negative, it is used as the offset * from the end of the collection. * - * **Note:** `SameValueZero` is like strict equality, e.g. `===`, except that - * `NaN` matches `NaN`. See the [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * **Note:** `SameValueZero` comparisons are like strict equality comparisons, + * e.g. `===`, except that `NaN` matches `NaN`. See the + * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for more details. * * @static @@ -4744,7 +4999,7 @@ * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [iteratee=identity] The function invoked + * @param {Function|Object|string} [iteratee=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. @@ -4781,7 +5036,7 @@ * @alias all * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=identity] The function invoked + * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. @@ -4830,7 +5085,7 @@ * @alias select * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=identity] The function invoked + * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. @@ -4877,7 +5132,7 @@ * @alias detect * @category Collection * @param {Array|Object|string} collection The collection to search. - * @param {Function|Object|string} [predicate=identity] The function invoked + * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. @@ -4920,7 +5175,7 @@ * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to search. - * @param {Function|Object|string} [predicate=identity] The function invoked + * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. @@ -4978,7 +5233,7 @@ * @alias each * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} [iteratee=identity] The function invoked per iteration. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Array|Object|string} Returns `collection`. * @example @@ -5004,7 +5259,7 @@ * @alias eachRight * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} [iteratee=identity] The function invoked per iteration. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Array|Object|string} Returns `collection`. * @example @@ -5036,7 +5291,7 @@ * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [iteratee=identity] The function invoked + * @param {Function|Object|string} [iteratee=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. @@ -5079,7 +5334,7 @@ * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [iteratee=identity] The function invoked + * @param {Function|Object|string} [iteratee=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. @@ -5147,7 +5402,7 @@ * @alias collect * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [iteratee=identity] The function invoked + * @param {Function|Object|string} [iteratee=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. @@ -5220,38 +5475,30 @@ * // => { 'user': 'fred', 'age': 40 }; */ function max(collection, iteratee, thisArg) { - iteratee = isIterateeCall(collection, iteratee, thisArg) ? null : iteratee; - - var computed = -Infinity, - noIteratee = iteratee == null, + if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { + iteratee = null; + } + var noIteratee = iteratee == null, isArr = noIteratee && isArray(collection), - isStr = !isArr && isString(collection), - result = computed; + isStr = !isArr && isString(collection); if (noIteratee && !isStr) { - var index = -1, - iterable = toIterable(collection), - length = iterable.length; - - while (++index < length) { - var value = iterable[index]; - if (value > result) { - result = value; - } - } - } else { - iteratee = (noIteratee && isStr) - ? charAtCallback - : getCallback(iteratee, thisArg, 3); - - baseEach(collection, function(value, index, collection) { - var current = iteratee(value, index, collection); - if (current > computed || (current === -Infinity && current === result)) { - computed = current; - result = value; - } - }); + return arrayMax(isArr ? collection : toIterable(collection)); } + var computed = NEGATIVE_INFINITY, + result = computed; + + iteratee = (noIteratee && isStr) + ? charAtCallback + : getCallback(iteratee, thisArg, 3); + + baseEach(collection, function(value, index, collection) { + var current = iteratee(value, index, collection); + if (current > computed || (current === NEGATIVE_INFINITY && current === result)) { + computed = current; + result = value; + } + }); return result; } @@ -5299,38 +5546,30 @@ * // => { 'user': 'barney', 'age': 36 }; */ function min(collection, iteratee, thisArg) { - iteratee = isIterateeCall(collection, iteratee, thisArg) ? null : iteratee; - - var computed = Infinity, - noIteratee = iteratee == null, + if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { + iteratee = null; + } + var noIteratee = iteratee == null, isArr = noIteratee && isArray(collection), - isStr = !isArr && isString(collection), - result = computed; + isStr = !isArr && isString(collection); if (noIteratee && !isStr) { - var index = -1, - iterable = toIterable(collection), - length = iterable.length; - - while (++index < length) { - var value = iterable[index]; - if (value < result) { - result = value; - } - } - } else { - iteratee = (noIteratee && isStr) - ? charAtCallback - : getCallback(iteratee, thisArg, 3); - - baseEach(collection, function(value, index, collection) { - var current = iteratee(value, index, collection); - if (current < computed || (current === Infinity && current === result)) { - computed = current; - result = value; - } - }); + return arrayMin(isArr ? collection : toIterable(collection)); } + var computed = POSITIVE_INFINITY, + result = computed; + + iteratee = (noIteratee && isStr) + ? charAtCallback + : getCallback(iteratee, thisArg, 3); + + baseEach(collection, function(value, index, collection) { + var current = iteratee(value, index, collection); + if (current < computed || (current === POSITIVE_INFINITY && current === result)) { + computed = current; + result = value; + } + }); return result; } @@ -5351,7 +5590,7 @@ * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=identity] The function invoked + * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. @@ -5422,7 +5661,7 @@ * @alias foldl, inject * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} [iteratee=identity] The function invoked per iteration. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [accumulator] The initial value. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {*} Returns the accumulated value. @@ -5451,7 +5690,7 @@ * @alias foldr * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} [iteratee=identity] The function invoked per iteration. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [accumulator] The initial value. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {*} Returns the accumulated value. @@ -5481,7 +5720,7 @@ * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=identity] The function invoked + * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. @@ -5619,7 +5858,7 @@ * @alias any * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=identity] The function invoked + * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. @@ -5672,7 +5911,7 @@ * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Array|Function|Object|string} [iteratee=identity] The function + * @param {Array|Function|Object|string} [iteratee=_.identity] The function * invoked per iteration. If property name(s) or an object is provided it * is used to create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. @@ -5701,8 +5940,9 @@ * // = > [['barney', 26], ['barney', 36], ['fred', 30], ['fred', 40]] */ function sortBy(collection, iteratee, thisArg) { - iteratee = isIterateeCall(collection, iteratee, thisArg) ? null : iteratee; - + if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { + iteratee = null; + } var index = -1, length = collection ? collection.length : 0, multi = iteratee && isArray(iteratee), @@ -5752,7 +5992,7 @@ function toArray(collection) { var length = collection ? collection.length : 0; if (typeof length == 'number' && length > -1 && length <= MAX_SAFE_INTEGER) { - return (support.unindexedChars && isString(collection)) + return (lodash.support.unindexedChars && isString(collection)) ? collection.split('') : baseSlice(collection); } @@ -6373,9 +6613,16 @@ * Creates a function that memoizes the result of `func`. If `resolver` is * provided it determines the cache key for storing the result based on the * arguments provided to the memoized function. By default, the first argument - * provided to the memoized function is used as the cache key. The `func` is - * invoked with the `this` binding of the memoized function. The result cache - * is exposed as the `cache` property on the memoized function. + * provided to the memoized function is coerced to a string and used as the + * cache key. The `func` is invoked with the `this` binding of the memoized + * function. + * + * **Note:** The cache is exposed as the `cache` property on the memoized + * function. Its creation may be customized by replacing the `_.memoize.Cache` + * constructor with one whose instances implement the ES6 `Map` method interface + * of `get`, `has`, and `set`. See the + * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-map-prototype-object) + * for more details. * * @static * @memberOf _ @@ -6400,7 +6647,7 @@ * upperCase('fred'); * // => 'FRED' * - * upperCase.cache.fred = 'BARNEY' + * upperCase.cache.set('fred, 'BARNEY'); * upperCase('fred'); * // => 'BARNEY' */ @@ -6409,16 +6656,17 @@ throw new TypeError(FUNC_ERROR_TEXT); } var memoized = function() { - var key = resolver ? resolver.apply(this, arguments) : arguments[0]; - if (key == '__proto__') { - return func.apply(this, arguments); + var cache = memoized.cache, + key = resolver ? resolver.apply(this, arguments) : arguments[0]; + + if (cache.has(key)) { + return cache.get(key); } - var cache = memoized.cache; - return hasOwnProperty.call(cache, key) - ? cache[key] - : (cache[key] = func.apply(this, arguments)); + var result = func.apply(this, arguments); + cache.set(key, result); + return result; }; - memoized.cache = {}; + memoized.cache = new memoize.Cache; return memoized; } @@ -6468,7 +6716,7 @@ * initialize(); * // `initialize` invokes `createApplication` once */ - var once = partial(before, 2); + var once = basePartial(before,PARTIAL_FLAG, [2], []); /** * Creates a function that invokes `func` with `partial` arguments prepended @@ -6620,6 +6868,63 @@ /*------------------------------------------------------------------------*/ + /** + * Creates the cache used by `_.memoize`. + * + * @private + * @static + * @name Cache + * @memberOf _.memoize + */ + function MemCache() { + this.__wrapped__ = {}; + } + + /** + * Gets the value associated with `key`. + * + * @private + * @name get + * @memberOf _.memoize.Cache + * @param {string} key The key of the value to retrieve. + * @returns {*} Returns the cached value. + */ + function memGet(key) { + return this.__wrapped__[key]; + } + + /** + * Checks if an entry for `key` exists. + * + * @private + * @name get + * @memberOf _.memoize.Cache + * @param {string} key The name of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + function memHas(key) { + return key != '__proto__' && hasOwnProperty.call(this.__wrapped__, key); + } + + /** + * Sets the value associated with `key`. + * + * @private + * @name get + * @memberOf _.memoize.Cache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the cache object. + */ + function memSet(key, value) { + if (key != '__proto__') { + this.__wrapped__[key] = value; + } + return this; + } + + /*------------------------------------------------------------------------*/ + /** * Creates a clone of `value`. If `isDeep` is `true` nested objects are cloned, * otherwise they are assigned by reference. If `customizer` is provided it is @@ -6627,10 +6932,11 @@ * cloning is handled by the method instead. The `customizer` is bound to * `thisArg` and invoked with two argument; (value, index|key). * - * **Note:** This method is loosely based on the structured clone algorithm. Functions - * and DOM nodes are **not** cloned. The enumerable properties of `arguments` objects and - * objects created by constructors other than `Object` are cloned to plain `Object` objects. - * See the [HTML5 specification](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm) + * **Note:** This method is loosely based on the structured clone algorithm. + * The enumerable properties of `arguments` objects and objects created by + * constructors other than `Object` are cloned to plain `Object` objects. An + * empty object is returned for uncloneable values such as functions, DOM nodes, + * Maps, Sets, and WeakMaps. See the [HTML5 specification](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm) * for more details. * * @static @@ -6683,10 +6989,11 @@ * is handled by the method instead. The `customizer` is bound to `thisArg` * and invoked with two argument; (value, index|key). * - * **Note:** This method is loosely based on the structured clone algorithm. Functions - * and DOM nodes are **not** cloned. The enumerable properties of `arguments` objects and - * objects created by constructors other than `Object` are cloned to plain `Object` objects. - * See the [HTML5 specification](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm) + * **Note:** This method is loosely based on the structured clone algorithm. + * The enumerable properties of `arguments` objects and objects created by + * constructors other than `Object` are cloned to plain `Object` objects. An + * empty object is returned for uncloneable values such as functions, DOM nodes, + * Maps, Sets, and WeakMaps. See the [HTML5 specification](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm) * for more details. * * @static @@ -6731,7 +7038,7 @@ * @memberOf _ * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * (function() { return _.isArguments(arguments); })(); @@ -6834,7 +7141,7 @@ */ function isElement(value) { return (value && typeof value == 'object' && value.nodeType === 1 && - (support.nodeClass ? toString.call(value).indexOf('Element') > -1 : isHostObject(value))) || false; + (lodash.support.nodeClass ? toString.call(value).indexOf('Element') > -1 : isHostObject(value))) || false; } // fallback for environments without DOM support if (!support.dom) { @@ -7175,7 +7482,7 @@ * // => true */ var isPlainObject = !getPrototypeOf ? shimIsPlainObject : function(value) { - if (!(value && toString.call(value) == objectClass) || (!support.argsClass && isArguments(value))) { + if (!(value && toString.call(value) == objectClass) || (!lodash.support.argsClass && isArguments(value))) { return false; } var valueOf = value.valueOf, @@ -7360,7 +7667,7 @@ * @memberOf _ * @category Object * @param {Object} object The object to search. - * @param {Function|Object|string} [predicate=identity] The function invoked + * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. @@ -7406,7 +7713,7 @@ * @memberOf _ * @category Object * @param {Object} object The object to search. - * @param {Function|Object|string} [predicate=identity] The function invoked + * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. @@ -7447,7 +7754,7 @@ * @memberOf _ * @category Object * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=identity] The function invoked per iteration. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Object} Returns `object`. * @example @@ -7479,7 +7786,7 @@ * @memberOf _ * @category Object * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=identity] The function invoked per iteration. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Object} Returns `object`. * @example @@ -7511,7 +7818,7 @@ * @memberOf _ * @category Object * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=identity] The function invoked per iteration. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Object} Returns `object`. * @example @@ -7536,7 +7843,7 @@ * @memberOf _ * @category Object * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=identity] The function invoked per iteration. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Object} Returns `object`. * @example @@ -7579,7 +7886,7 @@ * @category Object * @param {Object} object The object to inspect. * @param {string} key The name of the property to check. - * @returns {boolean} Returns `true` if key is a direct property, else `false`. + * @returns {boolean} Returns `true` if `key` is a direct property, else `false`. * @example * * _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); @@ -7668,7 +7975,7 @@ } if ((typeof Ctor == 'function' && Ctor.prototype === object) || (typeof length == 'number' && length > 0) || - (support.enumPrototypes && typeof object == 'function')) { + (lodash.support.enumPrototypes && typeof object == 'function')) { return shimKeys(object); } return isObject(object) ? nativeKeys(object) : []; @@ -7701,7 +8008,9 @@ if (!isObject(object)) { object = Object(object); } - var length = object.length; + var length = object.length, + support = lodash.support; + length = (typeof length == 'number' && length > 0 && (isArray(object) || (support.nonEnumStrings && isString(object)) || (support.nonEnumArgs && isArguments(object))) && length) || 0; @@ -7710,7 +8019,6 @@ Ctor = object.constructor, index = -1, isProto = typeof Ctor == 'function' && Ctor.prototype === object, - maxIndex = length - 1, result = Array(length), skipIndexes = length > 0, skipErrorProps = support.enumErrorProps && (object === errorProto || object instanceof Error), @@ -7727,7 +8035,7 @@ if (!(isProto && key == 'constructor') && !(skipProto && key == 'prototype') && !(skipErrorProps && (key == 'message' || key == 'name')) && - !(skipIndexes && (keyIndex = +key, keyIndex > -1 && keyIndex <= maxIndex && keyIndex % 1 == 0))) { + !(skipIndexes && (keyIndex = +key, keyIndex > -1 && keyIndex < length && keyIndex % 1 == 0))) { result.push(key); } } @@ -7766,7 +8074,7 @@ * @memberOf _ * @category Object * @param {Object} object The object to iterate over. - * @param {Function|Object|string} [iteratee=identity] The function invoked + * @param {Function|Object|string} [iteratee=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. @@ -7958,7 +8266,7 @@ * @memberOf _ * @category Object * @param {Array|Object} object The object to iterate over. - * @param {Function} [iteratee=identity] The function invoked per iteration. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [accumulator] The custom accumulator value. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {*} Returns the accumulated value. @@ -8100,7 +8408,7 @@ * @memberOf _ * @category String * @param {string} [string=''] The string to deburr. - * @returns {string} Returns the beburred string. + * @returns {string} Returns the deburred string. * @example * * _.deburr('déjà vu'); @@ -8509,7 +8817,7 @@ // https://github.com/olado/doT var settings = lodash.templateSettings; - if (isIterateeCall(string, options, otherOptions)) { + if (otherOptions && isIterateeCall(string, options, otherOptions)) { options = otherOptions = null; } string = String(string == null ? '' : string); @@ -8535,8 +8843,8 @@ // use a sourceURL for easier debugging // http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl - var sourceURL = options.sourceURL || ('/lodash/template/source[' + (++templateCounter) + ']'); - sourceURL = sourceURL ? ('\n/*\n//# sourceURL=' + sourceURL + '\n*/') : ''; + var sourceURL = 'sourceURL' in options ? options.sourceURL : ('/lodash/template/source[' + (++templateCounter) + ']'); + sourceURL = sourceURL ? ('\n//# sourceURL=' + sourceURL) : ''; string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) { interpolateValue || (interpolateValue = esTemplateValue); @@ -8869,7 +9177,7 @@ * @memberOf _ * @alias iteratee * @category Utility - * @param {*} [func=identity] The value to convert to a callback. + * @param {*} [func=_.identity] The value to convert to a callback. * @param {*} [thisArg] The `this` binding of the created callback. * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. * @returns {Function} Returns the new function. @@ -8977,15 +9285,15 @@ } } var index = length, - flags = Array(length), - vals = Array(length); + values = Array(length), + strictCompareFlags = Array(length); while (index--) { value = source[props[index]]; var isStrict = isStrictComparable(value); - flags[index] = isStrict; - vals[index] = isStrict ? value : baseClone(value); + values[index] = isStrict ? value : baseClone(value, true, clonePassthru); + strictCompareFlags[index] = isStrict; } return function(object) { index = length; @@ -8993,13 +9301,19 @@ return !index; } while (index--) { - if (flags[index] ? vals[index] !== object[props[index]] : !hasOwnProperty.call(object, props[index])) { + if (strictCompareFlags[index] + ? values[index] !== object[props[index]] + : !hasOwnProperty.call(object, props[index]) + ) { return false; } } index = length; while (index--) { - if (flags[index] ? !hasOwnProperty.call(object, props[index]) : !baseIsEqual(vals[index], object[props[index]], null, true)) { + if (strictCompareFlags[index] + ? !hasOwnProperty.call(object, props[index]) + : !baseIsEqual(values[index], object[props[index]], null, true) + ) { return false; } } @@ -9071,10 +9385,11 @@ if (isFunc) { object.prototype[methodName] = (function(methodName) { return function() { - if (chain || this.__chain__) { + var chainAll = this.__chain__; + if (chain || chainAll) { var result = object(this.__wrapped__); - result.__chain__ = this.__chain__; - (result.__queue__ = baseSlice(this.__queue__)).push([methodName, object, arguments]); + result.__chain__ = chainAll; + (result.__queue__ = baseSlice(this.__queue__)).push({ 'args': arguments, 'object': object, 'name': methodName }); return result; } var args = [this.value()]; @@ -9265,7 +9580,7 @@ /** * Creates an array of numbers (positive and/or negative) progressing from - * `start` up to but not including `end`. If `start` is less than `stop` a + * `start` up to but not including `end`. If `start` is less than `end` a * zero-length range is created unless a negative `step` is specified. * * @static @@ -9371,7 +9686,7 @@ * @memberOf _ * @category Utility * @param {number} n The number of times to invoke `iteratee`. - * @param {Function} [iteratee=identity] The function invoked per iteration. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Array} Returns the array of results. * @example @@ -9425,6 +9740,17 @@ /*------------------------------------------------------------------------*/ + // ensure `new LodashWrapper` is an instance of `lodash` + LodashWrapper.prototype = lodash.prototype; + + // add functions to the memoize cache + MemCache.prototype.get = memGet; + MemCache.prototype.has = memHas; + MemCache.prototype.set = memSet; + + // assign cache to `_.memoize` + memoize.Cache = MemCache; + // add functions that return wrapped values when chaining lodash.after = after; lodash.assign = assign; @@ -9658,25 +9984,143 @@ */ lodash.VERSION = VERSION; - // ensure `new lodashWrapper` is an instance of `lodash` - lodashWrapper.prototype = lodash.prototype; - - // add "Chaining" functions to the wrapper - lodash.prototype.chain = wrapperChain; - lodash.prototype.toString = wrapperToString; - lodash.prototype.toJSON = lodash.prototype.value = lodash.prototype.valueOf = wrapperValueOf; - // assign default placeholders arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) { lodash[methodName].placeholder = lodash; }); - // add `Array.prototype` functions - arrayEach(['concat', 'join', 'pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(methodName) { + // add `LazyWrapper` methods that accept an `iteratee` value + arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) { + var isFilter = !index; + + LazyWrapper.prototype[methodName] = function(iteratee, thisArg) { + iteratee = getCallback(iteratee, thisArg, 3); + + var result = this.clone(); + result.filtered = isFilter || result.filtered; + result.iteratees.push({ 'iteratee': iteratee, 'type': lazyIterateeTypes[methodName] }); + return result; + }; + }); + + // add `LazyWrapper` methods for `_.drop` and `_.take` variants + arrayEach(['drop', 'take'], function(methodName) { + var countName = methodName + 'Count', + whileName = methodName + 'While'; + + LazyWrapper.prototype[methodName] = function(n) { + n = n == null ? 1 : nativeMax(+n || 0, 0); + + var result = this.clone(); + if (this.filtered) { + result[countName] = n; + return result; + } + result.views.push({ + 'size': n, + 'type': methodName + (result.dir < 0 ? 'Right' : '') + }); + return result; + }; + + LazyWrapper.prototype[methodName + 'Right'] = function(n) { + return this.reverse()[methodName](n).reverse(); + }; + + LazyWrapper.prototype[methodName + 'RightWhile'] = function(predicate, thisArg) { + var result = this.reverse()[whileName](predicate, thisArg); + result.filtered = true; + return result.reverse(); + }; + }); + + // add `LazyWrapper` methods for `_.first` and `_.last` + arrayEach(['first', 'last'], function(methodName, index) { + var takeName = 'take' + (index ? 'Right': ''); + + LazyWrapper.prototype[methodName] = function() { + return this[takeName](1).value()[0]; + }; + }); + + // add `LazyWrapper` methods for `_.initial` and `_.rest` + arrayEach(['initial', 'rest'], function(methodName, index) { + var dropName = 'drop' + (index ? '' : 'Right'); + + LazyWrapper.prototype[methodName] = function() { + return this[dropName](1); + }; + }); + + LazyWrapper.prototype.dropWhile = function(iteratee, thisArg) { + iteratee = getCallback(iteratee, thisArg, 3); + + var done, + lastIndex, + isRight = this.dir < 0; + + return this.filter(function(value, index, array) { + done = done && (isRight ? index < lastIndex : index > lastIndex); + lastIndex = index; + return done || (done = !iteratee(value, index, array)); + }); + }; + + LazyWrapper.prototype.reject = function(iteratee, thisArg) { + iteratee = getCallback(iteratee, thisArg, 3); + + return this.filter(function(value, index, array) { + return !iteratee(value, index, array); + }); + }; + + LazyWrapper.prototype.slice = function(start, end) { + start = start == null ? 0 : (+start || 0); + var result = start < 0 ? this.takeRight(-start) : this.drop(start); + + if (typeof end != 'undefined') { + end = (+end || 0); + result = end < 0 ? result.dropRight(-end) : result.take(end - start); + } + return result; + }; + + // add `LazyWrapper` methods to `LodashWrapper` + baseForOwn(LazyWrapper.prototype, function(func, methodName) { + var retUnwrapped = /^(?:first|last)$/.test(methodName); + + lodash.prototype[methodName] = function() { + var args = arguments, + chainAll = this.__chain__, + value = this.__wrapped__, + isLazy = value instanceof LazyWrapper; + + if (retUnwrapped && !chainAll) { + if (isLazy) { + return func.apply(value, args); + } + var otherArgs = [this.value()]; + push.apply(otherArgs, args); + return lodash[methodName].apply(lodash, otherArgs); + } + if (isLazy || isArray(value)) { + var result = func.apply(isLazy ? value : new LazyWrapper(this), args); + return new LodashWrapper(result, chainAll); + } + return this.thru(function(value) { + var otherArgs = [value]; + push.apply(otherArgs, args); + return lodash[methodName].apply(lodash, otherArgs); + }); + }; + }); + + // add `Array.prototype` functions to `LodashWrapper` + arrayEach(['concat', 'join', 'pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) { var arrayFunc = arrayProto[methodName], - retUnwrapped = /^(?:join|pop|shift)$/.test(methodName), - chainName = /^(?:push|reverse|sort|unshift)$/.test(methodName) ? 'tap' : 'thru', - fixObjects = !support.spliceObjects && /^(?:pop|shift|splice)$/.test(methodName); + chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru', + fixObjects = !support.spliceObjects && /^(?:pop|shift|splice)$/.test(methodName), + retUnwrapped = /^(?:join|pop|shift)$/.test(methodName); // avoid array-like object bugs with `Array#shift` and `Array#splice` in // IE < 9, Firefox < 10, Narwhal, and RingoJS @@ -9699,6 +10143,23 @@ }; }); + // add functions to the lazy wrapper + LazyWrapper.prototype.clone = lazyClone; + LazyWrapper.prototype.reverse = lazyReverse; + LazyWrapper.prototype.value = lazyValue; + + // add chaining functions to the lodash wrapper + lodash.prototype.chain = wrapperChain; + lodash.prototype.reverse = wrapperReverse; + lodash.prototype.toString = wrapperToString; + lodash.prototype.toJSON = lodash.prototype.value = lodash.prototype.valueOf = wrapperValueOf; + + // add function aliases to the lodash wrapper + lodash.prototype.collect = lodash.prototype.map; + lodash.prototype.head = lodash.prototype.first; + lodash.prototype.select = lodash.prototype.filter; + lodash.prototype.tail = lodash.prototype.rest; + return lodash; } diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index 802f0e7ca..5099529ac 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -3,75 +3,82 @@ * Lo-Dash 3.0.0-pre (Custom Build) lodash.com/license | Underscore.js 1.7.0 underscorejs.org/LICENSE * Build: `lodash -o ./dist/lodash.compat.js` */ -;(function(){function n(n,t){for(var r=-1,e=n.length;++rt||!r||typeof n=="undefined"&&e)return 1;if(n=n&&9<=n&&13>=n||32==n||160==n||5760==n||6158==n||8192<=n&&(8202>=n||8232==n||8233==n||8239==n||8287==n||12288==n||65279==n)}function j(n,t){for(var r=-1,e=n.length,u=-1,o=[];++ru(t,i)&&f.push(i);return f}function Gt(n,t){var r=n?n.length:0;if(typeof r!="number"||-1>=r||r>z)return ir(n,t);for(var e=-1,u=Mr(n);++e=r||r>z)return fr(n,t);for(var e=Mr(n);r--&&false!==t(e[r],r,e););return n -}function Qt(n,t){var r=true;return Gt(n,function(n,e,u){return r=!!t(n,e,u)}),r}function nr(n,t){var r=[];return Gt(n,function(n,e,u){t(n,e,u)&&r.push(n)}),r}function tr(n,t,r,e){var u;return r(n,function(n,r,o){return t(n,r,o)?(u=e?r:n,false):void 0}),u}function rr(n,t,r,e){e=(e||0)-1;for(var u=n.length,o=-1,i=[];++ec))return false}else{var g=p&&cu.call(n,"__wrapped__"),h=h&&cu.call(t,"__wrapped__");if(g||h)return lr(g?n.value():n,h?t.value():t,r,e,u,o);if(!s)return false;if(!f&&!p){switch(l){case dt:case mt:return+n==+t;case xt:return n!=+n?t!=+t:0==n?1/n==1/t:n==+t; -case jt:case At:return n==ru(t)}return false}if(Bu.argsClass||(c=je(n),i=je(t)),g=c?nu:n.constructor,l=i?nu:t.constructor,f){if(g.prototype.name!=l.prototype.name)return false}else if(p=!c&&cu.call(n,"constructor"),h=!i&&cu.call(t,"constructor"),p!=h||!p&&g!=l&&"constructor"in n&&"constructor"in t&&!(typeof g=="function"&&g instanceof g&&typeof l=="function"&&l instanceof l))return false;if(g=f?["message","name"]:ro(n),l=f?g:ro(t),c&&g.push("length"),i&&l.push("length"),c=g.length,p=l.length,c!=p&&!e)return false -}for(u||(u=[]),o||(o=[]),l=u.length;l--;)if(u[l]==n)return o[l]==t;if(u.push(n),o.push(t),i=true,a)for(;i&&++le(a,p)&&((t||i)&&a.push(p),f.push(c))}return f}function br(n,t){for(var r=-1,e=t(n),u=e.length,o=Ye(u);++rt||null==r)return r;if(3r?Ru(e+r,0):r||0;else if(r)return r=Jr(n,t),n[r]===t?r:-1;return l(n,t,r)}function Vr(n){return Yr(n,1)}function Yr(n,t,r){var e=-1,u=n?n.length:0,o=typeof r;if(r&&"number"!=o&&x(n,t,r)&&(t=0,r=u),t=null==t?0:+t||0,0>t&&(t=-t>u?0:u+t),r="undefined"==o||r>u?u:+r||0,0>r&&(r+=u),r&&r==u&&!t)return c(n);for(u=t>r?0:r-t,r=Ye(u);++er?Ru(e+r,0):r||0:0,typeof n=="string"||!Hu(n)&&De(n)?ri&&(i=o);else t=u&&o?p:Rr(t,r,3),Gt(n,function(n,r,u){r=t(n,r,u),(r>e||-1/0===r&&r===i)&&(e=r,i=n) -});return i}function le(n,t){return fe(n,Ve(t))}function ce(n,t,r,e){return(Hu(n)?u:vr)(n,Rr(t,e,4),r,3>arguments.length,Gt)}function se(n,t,r,e){return(Hu(n)?o:vr)(n,Rr(t,e,4),r,3>arguments.length,Ht)}function pe(n){n=Br(n);for(var t=-1,r=n.length,e=Ye(r);++targuments.length)return Dr(n,S,null,t);var r=Yr(arguments,2),e=j(r,ve.placeholder);return hr(n,S|T,r,e,t)}function ye(n,t){var r=S|D;if(2=r||r>t?(f&&du(f),r=p,f=s=p=C,r&&(h=fo(),a=n.apply(c,i),s||f||(i=c=null))):s=ju(e,r)}function u(){s&&du(s),f=s=p=C,(v||g!==t)&&(h=fo(),a=n.apply(c,i),s||f||(i=c=null))}function o(){if(i=arguments,l=fo(),c=this,p=v&&(s||!y),false===g)var r=y&&!s;else{f||y||(h=l);var o=g-(l-h),d=0>=o||o>g;d?(f&&(f=du(f)),h=l,a=n.apply(c,i)):f||(f=ju(u,o))}return d&&s?s=du(s):s||t===g||(s=ju(e,t)),r&&(d=true,a=n.apply(c,i)),!d||s||f||(i=c=null),a}var i,f,a,l,c,s,p,h=0,g=false,v=true;if(!Oe(n))throw new eu(P);if(t=0>t?0:t,true===r)var y=true,v=false; -else Ie(r)&&(y=r.leading,g="maxWait"in r&&Ru(+r.maxWait||0,t),v="trailing"in r?r.trailing:v);return o.cancel=function(){s&&du(s),f&&du(f),f=s=p=C},o}function _e(){var n=arguments,r=n.length-1;if(0>r)return function(){};if(!t(n,Oe))throw new eu(P);return function(){for(var t=r,e=n[t].apply(this,arguments);t--;)e=n[t].call(this,e);return e}}function xe(n){var t=Yr(arguments,1),r=j(t,xe.placeholder);return hr(n,T,t,r)}function we(n){var t=Yr(arguments,1),r=j(t,we.placeholder);return hr(n,W,t,r)}function je(n){var t=n&&typeof n=="object"?n.length:C; -return typeof t=="number"&&-1t||null==n||!Su(t))return r; -n=ru(n);do t%2&&(r+=n),t=mu(t/2),n+=n;while(t);return r}function Ne(n,t,r){return(n=null==n?"":ru(n))?r||null==t?n.slice(A(n),E(n)+1):(t=ru(t),n.slice(h(n,t),g(n,t)+1)):n}function $e(n,t,r){return(n=null!=n&&ru(n))&&n.match((r?null:t)||st)||[]}function qe(n){try{return n()}catch(t){return Ee(t)?t:Xe(t)}}function Pe(n,t,r){return zt(n,r?C:t)}function Be(n){return n}function Me(n){var t=ro(n),r=t.length;if(1==r){var e=t[0],u=n[e];if(Lr(u))return function(n){return null!=n&&u===n[e]&&cu.call(n,e)}}for(var o=r,i=Ye(r),f=Ye(r);o--;){var u=n[t[o]],a=Lr(u); -i[o]=a,f[o]=a?u:Kt(u)}return function(n){if(o=r,null==n)return!o;for(;o--;)if(i[o]?f[o]!==n[t[o]]:!cu.call(n,t[o]))return false;for(o=r;o--;)if(i[o]?!cu.call(n,t[o]):!lr(f[o],n[t[o]],null,true))return false;return true}}function ze(n,t,r){var e=true,u=Ie(t),o=null==r,i=o&&u&&ro(t),f=i&&ar(t,i);(i&&i.length&&!f.length||o&&!u)&&(o&&(r=t),f=false,t=n,n=this),f||(f=ar(t,ro(t))),false===r?e=false:Ie(r)&&"chain"in r&&(e=r.chain),r=-1,u=Oe(n);for(o=f.length;++r=$)return r}else n=0;return Mu(r,e)}}(),Vu=jr(function(n,t,r){cu.call(n,r)?++n[r]:n[r]=1}),Yu=jr(function(n,t,r){cu.call(n,r)?n[r].push(t):n[r]=[t]}),Ju=jr(function(n,t,r){n[r]=t}),Xu=jr(function(n,t,r){n[r?0:1].push(t) -},function(){return[[],[]]}),Gu=xe(ge,2);Bu.argsClass||(je=function(n){var t=n&&typeof n=="object"?n.length:C;return typeof t=="number"&&-1--n?t.apply(this,arguments):void 0}},Nt.assign=to,Nt.at=function(n){var t=n?n.length:0;return typeof t=="number"&&-1t?0:t)},Nt.dropRight=function(n,t,r){var e=n?n.length:0; -return t=e-((r||null==t?1:t)||0),Yr(n,0,0>t?0:t)},Nt.dropRightWhile=function(n,t,r){var e=n?n.length:0;for(t=Rr(t,r,3);e--&&t(n[e],e,n););return Yr(n,0,e+1)},Nt.dropWhile=function(n,t,r){var e=-1,u=n?n.length:0;for(t=Rr(t,r,3);++e(p?s(p,i):u(c,i))){for(t=r;--t;){var h=e[t];if(0>(h?s(h,i):u(n[t],i)))continue n}p&&p.push(i),c.push(i)}return c},Nt.invert=function(n,t,r){t=r?null:t,r=-1;for(var e=ro(n),u=e.length,o={};++rt?0:t) -},Nt.takeRight=function(n,t,r){var e=n?n.length:0;return t=e-((r||null==t?1:t)||0),Yr(n,0>t?0:t)},Nt.takeRightWhile=function(n,t,r){var e=n?n.length:0;for(t=Rr(t,r,3);e--&&t(n[e],e,n););return Yr(n,e+1)},Nt.takeWhile=function(n,t,r){var e=-1,u=n?n.length:0;for(t=Rr(t,r,3);++er?0:+r||0,e))-t.length,0<=r&&n.indexOf(t,r)==r},Nt.escape=function(n){return(n=null==n?"":ru(n))&&(G.lastIndex=0,G.test(n))?n.replace(G,m):n},Nt.escapeRegExp=We,Nt.every=re,Nt.find=ue,Nt.findIndex=zr,Nt.findKey=function(n,t,r){return t=Rr(t,r,3),tr(n,t,ir,true)},Nt.findLast=function(n,t,r){return t=Rr(t,r,3),tr(n,t,Ht)},Nt.findLastIndex=function(n,t,r){var e=n?n.length:0; -for(t=Rr(t,r,3);e--;)if(t(n[e],e,n))return e;return-1},Nt.findLastKey=function(n,t,r){return t=Rr(t,r,3),tr(n,t,fr,true)},Nt.findWhere=function(n,t){return ue(n,Me(t))},Nt.first=Kr,Nt.has=function(n,t){return n?cu.call(n,t):false},Nt.identity=Be,Nt.indexOf=Zr,Nt.isArguments=je,Nt.isArray=Hu,Nt.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&pu.call(n)==dt||false},Nt.isDate=function(n){return n&&typeof n=="object"&&pu.call(n)==mt||false},Nt.isElement=Ae,Nt.isEmpty=function(n){if(null==n)return true; -var t=n.length;return typeof t=="number"&&-1r?Ru(e+r,0):ku(r||0,e-1))+1;else if(r)return u=Xr(n,t)-1,n[u]===t?u:-1;if(t!==t)return _(n,u,true);for(;u--;)if(n[u]===t)return u;return-1},Nt.max=ae,Nt.min=function(n,t,r){t=x(n,t,r)?null:t;var e=1/0,u=null==t,o=!(u&&Hu(n))&&De(n),i=e;if(u&&!o)for(r=-1,n=Br(n),u=n.length;++rr?0:+r||0,n.length),n.lastIndexOf(t,r)==r},Nt.template=function(n,t,r){var e=Nt.templateSettings;x(n,t,r)&&(t=r=null),n=ru(null==n?"":n),t=to({},r||t,e,Pt),r=to({},t.imports,e.imports,Pt); -var u,o,i=ro(r),f=Ue(r),a=0;r=t.interpolate||ft;var l="__p+='";if(r=tu((t.escape||ft).source+"|"+r.source+"|"+(r===nt?tt:ft).source+"|"+(t.evaluate||ft).source+"|$","g"),n.replace(r,function(t,r,e,i,f,c){return e||(e=i),l+=n.slice(a,c).replace(ct,b),r&&(u=true,l+="'+__e("+r+")+'"),f&&(o=true,l+="';"+f+";\n__p+='"),e&&(l+="'+((__t=("+e+"))==null?'':__t)+'"),a=c+t.length,t}),l+="';",(t=t.variable)||(l="with(obj){"+l+"}"),l=(o?l.replace(V,""):l).replace(Y,"$1").replace(J,"$1;"),l="function("+(t||"obj")+"){"+(t?"":"obj||(obj={});")+"var __t,__p=''"+(u?",__e=_.escape":"")+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}",t=qe(function(){return Ge(i,"return "+l).apply(C,f) -}),t.source=l,Ee(t))throw t;return t},Nt.trim=Ne,Nt.trimLeft=function(n,t,r){return(n=null==n?"":ru(n))?r||null==t?n.slice(A(n)):(t=ru(t),n.slice(h(n,t))):n},Nt.trimRight=function(n,t,r){return(n=null==n?"":ru(n))?r||null==t?n.slice(0,E(n)+1):(t=ru(t),n.slice(0,g(n,t)+1)):n},Nt.trunc=function(n,t,r){t=r?null:t;var e=L;if(r=N,Ie(t)){var u="separator"in t?t.separator:u,e="length"in t?+t.length||0:e;r="omission"in t?ru(t.omission):r}else null!=t&&(e=+t||0);if(n=null==n?"":ru(n),e>=n.length)return n; -if(e-=r.length,1>e)return r;if(t=n.slice(0,e),null==u)return t+r;if(Se(u)){if(n.slice(e).search(u)){var o,i=n.slice(0,e);for(u.global||(u=tu(u.source,(rt.exec(u)||"")+"g")),u.lastIndex=0;n=u.exec(i);)o=n.index;t=t.slice(0,null==o?e:o)}}else n.indexOf(u,e)!=e&&(u=t.lastIndexOf(u),-1t?0:+t||0,n.length),n)},Nt.prototype.sample=function(n,t){return n=t?null:n,this.__chain__||null!=n?this.thru(function(t){return Nt.sample(t,n)}):Nt.sample(this.value())},Nt.VERSION=F,$t.prototype=Nt.prototype,Nt.prototype.chain=function(){return ne(this)},Nt.prototype.toString=function(){return ru(this.value())},Nt.prototype.toJSON=Nt.prototype.value=Nt.prototype.valueOf=function(){for(var n=-1,t=this.__queue__,r=t.length,e=this.__wrapped__;++n"'`]/g,H=/<%-([\s\S]+?)%>/g,Q=/<%([\s\S]+?)%>/g,nt=/<%=([\s\S]+?)%>/g,tt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,rt=/\w*$/,et=/^\s*function[ \n\r\t]+\w/,ut=/^0[xX]/,ot=/^\[object .+?Constructor\]$/,it=/[\xC0-\xD6\xD8-\xDE\xDF-\xF6\xF8-\xFF]/g,ft=/($^)/,at=/[.*+?^${}()|[\]\/\\]/g,lt=/\bthis\b/,ct=/['\n\r\u2028\u2029\\]/g,st=RegExp("[A-Z\\xC0-\\xD6\\xD8-\\xDE]{2,}(?=[A-Z\\xC0-\\xD6\\xD8-\\xDE][a-z\\xDF-\\xF6\\xF8-\\xFF]+)|[A-Z\\xC0-\\xD6\\xD8-\\xDE]?[a-z\\xDF-\\xF6\\xF8-\\xFF]+|[A-Z\\xC0-\\xD6\\xD8-\\xDE]+|[0-9]+","g"),pt=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",ht="Array ArrayBuffer Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Math Number Object RegExp Set String _ clearTimeout document isFinite parseInt setTimeout TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap window WinRTError".split(" "),gt="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),vt="[object Arguments]",yt="[object Array]",dt="[object Boolean]",mt="[object Date]",bt="[object Error]",_t="[object Function]",xt="[object Number]",wt="[object Object]",jt="[object RegExp]",At="[object String]",Et="[object ArrayBuffer]",Ot="[object Float32Array]",It="[object Float64Array]",Ct="[object Int8Array]",Ft="[object Int16Array]",St="[object Int32Array]",Dt="[object Uint8Array]",Rt="[object Uint8ClampedArray]",kt="[object Uint16Array]",Ut="[object Uint32Array]",Tt={}; -Tt[vt]=Tt[yt]=Tt[Ot]=Tt[It]=Tt[Ct]=Tt[Ft]=Tt[St]=Tt[Dt]=Tt[Rt]=Tt[kt]=Tt[Ut]=true,Tt[Et]=Tt[dt]=Tt[mt]=Tt[bt]=Tt[_t]=Tt["[object Map]"]=Tt[xt]=Tt[wt]=Tt[jt]=Tt["[object Set]"]=Tt[At]=Tt["[object WeakMap]"]=false;var Wt={};Wt[vt]=Wt[yt]=Wt[Et]=Wt[dt]=Wt[mt]=Wt[Ot]=Wt[It]=Wt[Ct]=Wt[Ft]=Wt[St]=Wt[xt]=Wt[wt]=Wt[jt]=Wt[At]=Wt[Dt]=Wt[Rt]=Wt[kt]=Wt[Ut]=true,Wt[bt]=Wt[_t]=Wt["[object Map]"]=Wt["[object Set]"]=Wt["[object WeakMap]"]=false;var Lt={leading:false,maxWait:0,trailing:false},Nt={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},$t={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},qt={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss"},Pt={"function":true,object:true},Bt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Mt=Pt[typeof window]&&window||this,zt=Pt[typeof exports]&&exports&&!exports.nodeType&&exports,Kt=Pt[typeof module]&&module&&!module.nodeType&&module,Zt=zt&&Kt&&typeof global=="object"&&global; -!Zt||Zt.global!==Zt&&Zt.window!==Zt&&Zt.self!==Zt||(Mt=Zt);var Vt=Kt&&Kt.exports===zt&&zt,Yt=function(){try{({toString:0}+"")}catch(n){return function(){return false}}return function(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}}(),Jt=I();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Mt._=Jt, define(function(){return Jt})):zt&&Kt?Vt?(Kt.exports=Jt)._=Jt:zt._=Jt:Mt._=Jt}).call(this); \ No newline at end of file +;(function(){function n(n,t){for(var r=-1,e=n.length;++rt||!r||typeof n=="undefined"&&e)return 1;if(n=n&&9<=n&&13>=n||32==n||160==n||5760==n||6158==n||8192<=n&&(8202>=n||8232==n||8233==n||8239==n||8287==n||12288==n||65279==n)}function j(n,t){for(var r=-1,e=n.length,u=-1,o=[];++re&&(e=u)}return e}function $t(n){for(var t=-1,r=n.length,e=Zu;++tu(t,i)&&a.push(i); +return a}function Qt(n,t){var r=n?n.length:0;if(typeof r!="number"||-1>=r||r>Hu)return fr(n,t);for(var e=-1,u=Vr(n);++e=r||r>Hu)return lr(n,t);for(var e=Vr(n);r--&&false!==t(e[r],r,e););return n}function tr(n,t){var r=true;return Qt(n,function(n,e,u){return r=!!t(n,e,u)}),r}function rr(n,t){var r=[];return Qt(n,function(n,e,u){t(n,e,u)&&r.push(n)}),r}function er(n,t,r,e){var u;return r(n,function(n,r,o){return t(n,r,o)?(u=e?r:n,false):void 0 +}),u}function ur(n,t,r,e){e=(e||0)-1;for(var u=n.length,o=-1,i=[];++ec))return false}else{var g=p&&_u.call(n,"__wrapped__"),h=h&&_u.call(t,"__wrapped__");if(g||h)return sr(g?n.value():n,h?t.value():t,r,e,u,o);if(!s)return false;if(!a&&!p){switch(l){case yt:case dt:return+n==+t;case bt:return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case xt:case jt:return n==su(t)}return false}if(Ut.support.argsClass||(c=Se(n),i=Se(t)),g=c?lu:n.constructor,l=i?lu:t.constructor,a){if(g.prototype.name!=l.prototype.name)return false}else if(p=!c&&_u.call(n,"constructor"),h=!i&&_u.call(t,"constructor"),p!=h||!p&&g!=l&&"constructor"in n&&"constructor"in t&&!(typeof g=="function"&&g instanceof g&&typeof l=="function"&&l instanceof l))return false; +if(g=a?["message","name"]:yo(n),l=a?g:yo(t),c&&g.push("length"),i&&l.push("length"),c=g.length,p=l.length,c!=p&&!e)return false}for(u||(u=[]),o||(o=[]),l=u.length;l--;)if(u[l]==n)return o[l]==t;if(u.push(n),o.push(t),i=true,f)for(;i&&++le(f,p)&&((t||i)&&f.push(p),a.push(c))}return a}function wr(n,t){for(var r=-1,e=t(n),u=e.length,o=eu(u);++rt||null==r)return r; +if(3t?0:t)}function Zr(n,t,r){var e=n?n.length:0;return t=e-((r||null==t?1:t)||0),Qr(n,0,0>t?0:t)}function Gr(n,t,r){var e=-1,u=n?n.length:0;for(t=Tr(t,r,3);++er?Pu(e+r,0):r||0;else if(r)return r=ne(n,t),n=n[r],(t===t?t===n:n!==n)?r:-1;return l(n,t,r)}function Hr(n){return Yr(n,1)}function Qr(n,t,r){var e=-1,u=n?n.length:0,o=typeof r;if(r&&"number"!=o&&w(n,t,r)&&(t=0,r=u),t=null==t?0:+t||0,0>t&&(t=-t>u?0:u+t),r="undefined"==o||r>u?u:+r||0,0>r&&(r+=u),r&&r==u&&!t)return c(n);for(u=t>r?0:r-t,r=eu(u);++er?Pu(e+r,0):r||0:0,typeof n=="string"||!po(n)&&qe(n)?ri||r===Yu&&r===a)&&(i=r,a=n)}),a}function ye(n,t){return ge(n,ru(t))}function de(n,t,r,e){return(po(n)?u:dr)(n,Tr(t,e,4),r,3>arguments.length,Qt)}function me(n,t,r,e){return(po(n)?o:dr)(n,Tr(t,e,4),r,3>arguments.length,nr)}function _e(n){n=Kr(n);for(var t=-1,r=n.length,e=eu(r);++targuments.length)return Dr(n,F,null,t);var r=Qr(arguments,2),e=j(r,xe.placeholder);return vr(n,F|W,r,e,t)}function je(n,t){var r=F|R;if(2=r||r>t?(a&&Iu(a),r=p,a=s=p=O,r&&(h=xo(),f=n.apply(c,i),s||a||(i=c=null))):s=Su(e,r)}function u(){s&&Iu(s),a=s=p=O,(v||g!==t)&&(h=xo(),f=n.apply(c,i),s||a||(i=c=null))}function o(){if(i=arguments,l=xo(),c=this,p=v&&(s||!y),false===g)var r=y&&!s;else{a||y||(h=l);var o=g-(l-h),d=0>=o||o>g;d?(a&&(a=Iu(a)),h=l,f=n.apply(c,i)):a||(a=Su(u,o)) +}return d&&s?s=Iu(s):s||t===g||(s=Su(e,t)),r&&(d=true,f=n.apply(c,i)),!d||s||a||(i=c=null),f}var i,a,f,l,c,s,p,h=0,g=false,v=true;if(!We(n))throw new pu(B);if(t=0>t?0:t,true===r)var y=true,v=false;else Ne(r)&&(y=r.leading,g="maxWait"in r&&Pu(+r.maxWait||0,t),v="trailing"in r?r.trailing:v);return o.cancel=function(){s&&Iu(s),a&&Iu(a),a=s=p=O},o}function Ce(){var n=arguments,r=n.length-1;if(0>r)return function(){};if(!t(n,We))throw new pu(B);return function(){for(var t=r,e=n[t].apply(this,arguments);t--;)e=n[t].call(this,e); +return e}}function Oe(n,t){function r(){var e=r.cache,u=t?t.apply(this,arguments):arguments[0];if(e.has(u))return e.get(u);var o=n.apply(this,arguments);return e.set(u,o),o}if(!We(n)||t&&!We(t))throw new pu(B);return r.cache=new Oe.Cache,r}function ke(n){var t=Qr(arguments,1),r=j(t,ke.placeholder);return vr(n,W,t,r)}function Fe(n){var t=Qr(arguments,1),r=j(t,Fe.placeholder);return vr(n,N,t,r)}function Re(){this.__wrapped__={}}function Se(n){var t=n&&typeof n=="object"?n.length:O;return typeof t=="number"&&-1t||null==n||!$u(t))return r;n=su(n);do t%2&&(r+=n),t=Cu(t/2),n+=n;while(t);return r}function Ye(n,t,r){return(n=null==n?"":su(n))?r||null==t?n.slice(A(n),E(n)+1):(t=su(t),n.slice(h(n,t),g(n,t)+1)):n +}function Ze(n,t,r){return(n=null!=n&&su(n))&&n.match((r?null:t)||ct)||[]}function Ge(n){try{return n()}catch(t){return Te(t)?t:ou(t)}}function Je(n,t,r){return Vt(n,r?O:t)}function Xe(n){return n}function He(n){var t=yo(n),r=t.length;if(1==r){var e=t[0],u=n[e];if(qr(u))return function(n){return null!=n&&u===n[e]&&_u.call(n,e)}}for(var o=r,i=eu(r),a=eu(r);o--;){var u=n[t[o]],f=qr(u);i[o]=f?u:Yt(u,true,Mt),a[o]=f}return function(n){if(o=r,null==n)return!o;for(;o--;)if(a[o]?i[o]!==n[t[o]]:!_u.call(n,t[o]))return false; +for(o=r;o--;)if(a[o]?!_u.call(n,t[o]):!sr(i[o],n[t[o]],null,true))return false;return true}}function Qe(n,t,r){var e=true,u=Ne(t),o=null==r,i=o&&u&&yo(t),a=i&&cr(t,i);(i&&i.length&&!a.length||o&&!u)&&(o&&(r=t),a=false,t=n,n=this),a||(a=cr(t,yo(t))),false===r?e=false:Ne(r)&&"chain"in r&&(e=r.chain),r=-1,u=We(n);for(o=a.length;++r=$)return r}else n=0;return eo(r,e)}}(),ao=Er(function(n,t,r){_u.call(n,r)?++n[r]:n[r]=1}),fo=Er(function(n,t,r){_u.call(n,r)?n[r].push(t):n[r]=[t]}),lo=Er(function(n,t,r){n[r]=t}),co=Er(function(n,t,r){n[r?0:1].push(t) +},function(){return[[],[]]}),so=vr(we,W,[2],[]);ro.argsClass||(Se=function(n){var t=n&&typeof n=="object"?n.length:O;return typeof t=="number"&&-1--n?t.apply(this,arguments):void 0}},Ut.assign=vo,Ut.at=function(n){var t=n?n.length:0;return typeof t=="number"&&-1(p?s(p,i):u(c,i))){for(t=r;--t;){var h=e[t];if(0>(h?s(h,i):u(n[t],i)))continue n}p&&p.push(i),c.push(i) +}return c},Ut.invert=function(n,t,r){t=r?null:t,r=-1;for(var e=yo(n),u=e.length,o={};++rt?0:t)},Ut.takeRight=function(n,t,r){var e=n?n.length:0;return t=e-((r||null==t?1:t)||0),Qr(n,0>t?0:t)},Ut.takeRightWhile=function(n,t,r){var e=n?n.length:0;for(t=Tr(t,r,3);e--&&t(n[e],e,n););return Qr(n,e+1)},Ut.takeWhile=function(n,t,r){var e=-1,u=n?n.length:0;for(t=Tr(t,r,3);++er?0:+r||0,e))-t.length,0<=r&&n.indexOf(t,r)==r},Ut.escape=function(n){return(n=null==n?"":su(n))&&(J.lastIndex=0,J.test(n))?n.replace(J,m):n},Ut.escapeRegExp=Ke,Ut.every=le,Ut.find=se,Ut.findIndex=Gr,Ut.findKey=function(n,t,r){return t=Tr(t,r,3),er(n,t,fr,true)},Ut.findLast=function(n,t,r){return t=Tr(t,r,3),er(n,t,nr) +},Ut.findLastIndex=function(n,t,r){var e=n?n.length:0;for(t=Tr(t,r,3);e--;)if(t(n[e],e,n))return e;return-1},Ut.findLastKey=function(n,t,r){return t=Tr(t,r,3),er(n,t,lr,true)},Ut.findWhere=function(n,t){return se(n,He(t))},Ut.first=Jr,Ut.has=function(n,t){return n?_u.call(n,t):false},Ut.identity=Xe,Ut.indexOf=Xr,Ut.isArguments=Se,Ut.isArray=po,Ut.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&wu.call(n)==yt||false},Ut.isDate=function(n){return n&&typeof n=="object"&&wu.call(n)==dt||false +},Ut.isElement=De,Ut.isEmpty=function(n){if(null==n)return true;var t=n.length;return typeof t=="number"&&-1r?Pu(e+r,0):zu(r||0,e-1))+1;else if(r)return u=te(n,t)-1,n=n[u],(t===t?t===n:n!==n)?u:-1;if(t!==t)return b(n,u,true);for(;u--;)if(n[u]===t)return u;return-1},Ut.max=ve,Ut.min=function(n,t,r){r&&w(n,t,r)&&(t=null);var e=null==t,u=e&&po(n),o=!u&&qe(n);if(e&&!o)return $t(u?n:Kr(n));var i=Zu,a=i;return t=e&&o?p:Tr(t,r,3),Qt(n,function(n,r,e){r=t(n,r,e),(rr?0:+r||0,n.length),n.lastIndexOf(t,r)==r},Ut.template=function(n,t,r){var e=Ut.templateSettings; +r&&w(n,t,r)&&(t=r=null),n=su(null==n?"":n),t=vo({},r||t,e,zt),r=vo({},t.imports,e.imports,zt);var u,o,i=yo(r),a=Be(r),f=0;r=t.interpolate||it;var l="__p+='";if(r=cu((t.escape||it).source+"|"+r.source+"|"+(r===Q?nt:it).source+"|"+(t.evaluate||it).source+"|$","g"),n.replace(r,function(t,r,e,i,a,c){return e||(e=i),l+=n.slice(f,c).replace(lt,_),r&&(u=true,l+="'+__e("+r+")+'"),a&&(o=true,l+="';"+a+";\n__p+='"),e&&(l+="'+((__t=("+e+"))==null?'':__t)+'"),f=c+t.length,t}),l+="';",(t=t.variable)||(l="with(obj){"+l+"}"),l=(o?l.replace(V,""):l).replace(Y,"$1").replace(Z,"$1;"),l="function("+(t||"obj")+"){"+(t?"":"obj||(obj={});")+"var __t,__p=''"+(u?",__e=_.escape":"")+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}",t=Ge(function(){return iu(i,"return "+l).apply(O,a) +}),t.source=l,Te(t))throw t;return t},Ut.trim=Ye,Ut.trimLeft=function(n,t,r){return(n=null==n?"":su(n))?r||null==t?n.slice(A(n)):(t=su(t),n.slice(h(n,t))):n},Ut.trimRight=function(n,t,r){return(n=null==n?"":su(n))?r||null==t?n.slice(0,E(n)+1):(t=su(t),n.slice(0,g(n,t)+1)):n},Ut.trunc=function(n,t,r){t=r?null:t;var e=U;if(r=L,Ne(t)){var u="separator"in t?t.separator:u,e="length"in t?+t.length||0:e;r="omission"in t?su(t.omission):r}else null!=t&&(e=+t||0);if(n=null==n?"":su(n),e>=n.length)return n; +if(e-=r.length,1>e)return r;if(t=n.slice(0,e),null==u)return t+r;if($e(u)){if(n.slice(e).search(u)){var o,i=n.slice(0,e);for(u.global||(u=cu(u.source,(tt.exec(u)||"")+"g")),u.lastIndex=0;n=u.exec(i);)o=n.index;t=t.slice(0,null==o?e:o)}}else n.indexOf(u,e)!=e&&(u=t.lastIndexOf(u),-1t?0:+t||0,n.length),n)},Ut.prototype.sample=function(n,t){return n=t?null:n,this.__chain__||null!=n?this.thru(function(t){return Ut.sample(t,n)}):Ut.sample(this.value())},Ut.VERSION=k,n("bind bindKey curry curryRight partial partialRight".split(" "),function(n){Ut[n].placeholder=Ut}),n(["filter","map","takeWhile"],function(n,t){var r=!t; +ae.prototype[n]=function(t,e){t=Tr(t,e,3);var u=this.clone();return u.filtered=r||u.filtered,u.iteratees.push({iteratee:t,type:qt[n]}),u}}),n(["drop","take"],function(n){var t=n+"Count",r=n+"While";ae.prototype[n]=function(r){r=null==r?1:Pu(+r||0,0);var e=this.clone();return this.filtered?(e[t]=r,e):(e.views.push({size:r,type:n+(0>e.dir?"Right":"")}),e)},ae.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()},ae.prototype[n+"RightWhile"]=function(n,t){var e=this.reverse()[r](n,t); +return e.filtered=true,e.reverse()}}),n(["first","last"],function(n,t){var r="take"+(t?"Right":"");ae.prototype[n]=function(){return this[r](1).value()[0]}}),n(["initial","rest"],function(n,t){var r="drop"+(t?"":"Right");ae.prototype[n]=function(){return this[r](1)}}),ae.prototype.dropWhile=function(n,t){n=Tr(n,t,3);var r,e,u=0>this.dir;return this.filter(function(t,o,i){return r=r&&(u?oe),e=o,r||(r=!n(t,o,i))})},ae.prototype.reject=function(n,t){return n=Tr(n,t,3),this.filter(function(t,r,e){return!n(t,r,e) +})},ae.prototype.slice=function(n,t){n=null==n?0:+n||0;var r=0>n?this.takeRight(-n):this.drop(n);return typeof t!="undefined"&&(t=+t||0,r=0>t?r.dropRight(-t):r.take(t-n)),r},fr(ae.prototype,function(n,t){var r=/^(?:first|last)$/.test(t);Ut.prototype[t]=function(){var e=arguments,u=this.__chain__,o=this.__wrapped__,i=o instanceof ae;return r&&!u?i?n.apply(o,e):(u=[this.value()],ku.apply(u,e),Ut[t].apply(Ut,u)):i||po(o)?(o=n.apply(i?o:new ae(this),e),new ie(o,u)):this.thru(function(n){return n=[n],ku.apply(n,e),Ut[t].apply(Ut,n) +})}}),n("concat join pop push shift sort splice unshift".split(" "),function(n){var t=hu[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:join|pop|shift)$/.test(n),u=ro.spliceObjects||!/^(?:pop|shift|splice)$/.test(n)?t:function(){var n=t.apply(this,arguments);return 0===this.length&&delete this[0],n};Ut.prototype[n]=function(){var n=arguments;return e&&!this.__chain__?u.apply(this.value(),n):this[r](function(t){return u.apply(t,n)})}}),ae.prototype.clone=function(){var n=new ae(this.wrapped); +return n.dir=this.dir,n.dropCount=this.dropCount,n.filtered=this.filtered,n.takeCount=this.takeCount,ku.apply(n.iteratees,this.iteratees),ku.apply(n.views,this.views),n},ae.prototype.reverse=function(){var n=this.filtered,t=n?new ae(this):this.clone();return t.dir=-1*this.dir,t.filtered=n,t},ae.prototype.value=function(){for(var n=this.wrapped.value(),t=n.length,r=0,e=t,u=this.views,o=-1,i=u.length;++ou,r=l?e:r-1,e=this.iteratees,c=e.length,s=0,p=[];n:for(;t--&&s=o}return l?p.reverse():p},Ut.prototype.chain=function(){return oe(this)},Ut.prototype.reverse=function(){return this.thru(function(n){return n.reverse()})},Ut.prototype.toString=function(){return su(this.value()) +},Ut.prototype.toJSON=Ut.prototype.value=Ut.prototype.valueOf=function(){var n=this.__wrapped__;n instanceof ae&&(n=n.value());for(var t=-1,r=this.__queue__,e=r.length;++t"'`]/g,X=/<%-([\s\S]+?)%>/g,H=/<%([\s\S]+?)%>/g,Q=/<%=([\s\S]+?)%>/g,nt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,tt=/\w*$/,rt=/^\s*function[ \n\r\t]+\w/,et=/^0[xX]/,ut=/^\[object .+?Constructor\]$/,ot=/[\xC0-\xD6\xD8-\xDE\xDF-\xF6\xF8-\xFF]/g,it=/($^)/,at=/[.*+?^${}()|[\]\/\\]/g,ft=/\bthis\b/,lt=/['\n\r\u2028\u2029\\]/g,ct=RegExp("[A-Z\\xC0-\\xD6\\xD8-\\xDE]{2,}(?=[A-Z\\xC0-\\xD6\\xD8-\\xDE][a-z\\xDF-\\xF6\\xF8-\\xFF]+)|[A-Z\\xC0-\\xD6\\xD8-\\xDE]?[a-z\\xDF-\\xF6\\xF8-\\xFF]+|[A-Z\\xC0-\\xD6\\xD8-\\xDE]+|[0-9]+","g"),st=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",pt="Array ArrayBuffer Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Math Number Object RegExp Set String _ clearTimeout document isFinite parseInt setTimeout TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap window WinRTError".split(" "),ht="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),gt="[object Arguments]",vt="[object Array]",yt="[object Boolean]",dt="[object Date]",mt="[object Error]",_t="[object Function]",bt="[object Number]",wt="[object Object]",xt="[object RegExp]",jt="[object String]",At="[object ArrayBuffer]",Et="[object Float32Array]",It="[object Float64Array]",Ct="[object Int8Array]",Ot="[object Int16Array]",kt="[object Int32Array]",Ft="[object Uint8Array]",Rt="[object Uint8ClampedArray]",St="[object Uint16Array]",Dt="[object Uint32Array]",Tt={}; +Tt[gt]=Tt[vt]=Tt[Et]=Tt[It]=Tt[Ct]=Tt[Ot]=Tt[kt]=Tt[Ft]=Tt[Rt]=Tt[St]=Tt[Dt]=true,Tt[At]=Tt[yt]=Tt[dt]=Tt[mt]=Tt[_t]=Tt["[object Map]"]=Tt[bt]=Tt[wt]=Tt[xt]=Tt["[object Set]"]=Tt[jt]=Tt["[object WeakMap]"]=false;var Wt={};Wt[gt]=Wt[vt]=Wt[At]=Wt[yt]=Wt[dt]=Wt[Et]=Wt[It]=Wt[Ct]=Wt[Ot]=Wt[kt]=Wt[bt]=Wt[wt]=Wt[xt]=Wt[jt]=Wt[Ft]=Wt[Rt]=Wt[St]=Wt[Dt]=true,Wt[mt]=Wt[_t]=Wt["[object Map]"]=Wt["[object Set]"]=Wt["[object WeakMap]"]=false;var Nt={leading:false,maxWait:0,trailing:false},Ut={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss"},Lt={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},$t={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},qt={filter:P,map:z,takeWhile:3},Pt={"function":true,object:true},zt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Bt=Pt[typeof window]&&window||this,Mt=Pt[typeof exports]&&exports&&!exports.nodeType&&exports,Kt=Pt[typeof module]&&module&&!module.nodeType&&module,Vt=Mt&&Kt&&typeof global=="object"&&global; +!Vt||Vt.global!==Vt&&Vt.window!==Vt&&Vt.self!==Vt||(Bt=Vt);var Yt=Kt&&Kt.exports===Mt&&Mt,Zt=function(){try{({toString:0}+"")}catch(n){return function(){return false}}return function(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}}(),Gt=C();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Bt._=Gt, define(function(){return Gt})):Mt&&Kt?Yt?(Kt.exports=Gt)._=Gt:Mt._=Gt:Bt._=Gt}).call(this); \ No newline at end of file diff --git a/dist/lodash.js b/dist/lodash.js index 047ea0f70..fc16c7f70 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -32,20 +32,14 @@ var HOT_COUNT = 150, HOT_SPAN = 16; - /** Used as the TypeError message for "Functions" methods */ + /** Used to indicate the type of lazy iteratees */ + var LAZY_FILTER_FLAG = 1, + LAZY_MAP_FLAG = 2, + LAZY_WHILE_FLAG = 3; + + /** Used as the `TypeError` message for "Functions" methods */ var FUNC_ERROR_TEXT = 'Expected a function'; - /** Used as references for the max length and index of an array */ - var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1, - MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1; - - /** - * Used as the maximum length of an array-like value. - * See the [ES6 spec](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength) - * for more details. - */ - var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; - /** Used as the internal argument placeholder */ var PLACEHOLDER = '__lodash_placeholder__'; @@ -200,6 +194,27 @@ 'trailing': false }; + /** Used to map latin-1 supplementary letters to basic latin letters */ + var deburredLetters = { + '\xC0': 'A', '\xC1': 'A', '\xC2': 'A', '\xC3': 'A', '\xC4': 'A', '\xC5': 'A', + '\xE0': 'a', '\xE1': 'a', '\xE2': 'a', '\xE3': 'a', '\xE4': 'a', '\xE5': 'a', + '\xC7': 'C', '\xE7': 'c', + '\xD0': 'D', '\xF0': 'd', + '\xC8': 'E', '\xC9': 'E', '\xCA': 'E', '\xCB': 'E', + '\xE8': 'e', '\xE9': 'e', '\xEA': 'e', '\xEB': 'e', + '\xCC': 'I', '\xCD': 'I', '\xCE': 'I', '\xCF': 'I', + '\xEC': 'i', '\xED': 'i', '\xEE': 'i', '\xEF': 'i', + '\xD1': 'N', '\xF1': 'n', + '\xD2': 'O', '\xD3': 'O', '\xD4': 'O', '\xD5': 'O', '\xD6': 'O', '\xD8': 'O', + '\xF2': 'o', '\xF3': 'o', '\xF4': 'o', '\xF5': 'o', '\xF6': 'o', '\xF8': 'o', + '\xD9': 'U', '\xDA': 'U', '\xDB': 'U', '\xDC': 'U', + '\xF9': 'u', '\xFA': 'u', '\xFB': 'u', '\xFC': 'u', + '\xDD': 'Y', '\xFD': 'y', '\xFF': 'y', + '\xC6': 'Ae', '\xE6': 'ae', + '\xDE': 'Th', '\xFE': 'th', + '\xDF': 'ss' + }; + /** * Used to map characters to HTML entities. * @@ -233,25 +248,11 @@ '`': '`' }; - /** Used to map latin-1 supplementary letters to basic latin letters */ - var deburredLetters = { - '\xC0': 'A', '\xC1': 'A', '\xC2': 'A', '\xC3': 'A', '\xC4': 'A', '\xC5': 'A', - '\xE0': 'a', '\xE1': 'a', '\xE2': 'a', '\xE3': 'a', '\xE4': 'a', '\xE5': 'a', - '\xC7': 'C', '\xE7': 'c', - '\xD0': 'D', '\xF0': 'd', - '\xC8': 'E', '\xC9': 'E', '\xCA': 'E', '\xCB': 'E', - '\xE8': 'e', '\xE9': 'e', '\xEA': 'e', '\xEB': 'e', - '\xCC': 'I', '\xCD': 'I', '\xCE': 'I', '\xCF': 'I', - '\xEC': 'i', '\xED': 'i', '\xEE': 'i', '\xEF': 'i', - '\xD1': 'N', '\xF1': 'n', - '\xD2': 'O', '\xD3': 'O', '\xD4': 'O', '\xD5': 'O', '\xD6': 'O', '\xD8': 'O', - '\xF2': 'o', '\xF3': 'o', '\xF4': 'o', '\xF5': 'o', '\xF6': 'o', '\xF8': 'o', - '\xD9': 'U', '\xDA': 'U', '\xDB': 'U', '\xDC': 'U', - '\xF9': 'u', '\xFA': 'u', '\xFB': 'u', '\xFC': 'u', - '\xDD': 'Y', '\xFD': 'y', '\xFF': 'y', - '\xC6': 'Ae', '\xE6': 'ae', - '\xDE': 'Th', '\xFE': 'th', - '\xDF': 'ss' + /** Used to map iteratee types to lazy methods */ + var lazyIterateeTypes = { + 'filter': LAZY_FILTER_FLAG, + 'map': LAZY_MAP_FLAG, + 'takeWhile': LAZY_WHILE_FLAG }; /** Used to determine if values are of the language type `Object` */ @@ -353,26 +354,6 @@ return true; } - /** - * A specialized version of `_.map` for arrays without support for callback - * shorthands or `this` binding. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the new mapped array. - */ - function arrayMap(array, iteratee) { - var index = -1, - length = array.length, - result = Array(length); - - while (++index < length) { - result[index] = iteratee(array[index], index, array); - } - return result; - } - /** * A specialized version of `_.filter` for arrays without support for callback * shorthands or `this` binding. @@ -397,6 +378,26 @@ return result; } + /** + * A specialized version of `_.map` for arrays without support for callback + * shorthands or `this` binding. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ + function arrayMap(array, iteratee) { + var index = -1, + length = array.length, + result = Array(length); + + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; + } + /** * A specialized version of `_.reduce` for arrays without support for callback * shorthands or `this` binding. @@ -658,7 +659,7 @@ } /** - * Used by `deburr` to convert latin-1 to basic latin letters. + * Used by `_.deburr` to convert latin-1 to basic latin letters. * * @private * @param {string} letter The matched letter to deburr. @@ -732,7 +733,7 @@ } /** - * Used by `_.trimmedLeftIndex` and `_.trimmedRightIndex` to determine if a + * Used by `trimmedLeftIndex` and `trimmedRightIndex` to determine if a * character code is whitespace. * * @private @@ -951,9 +952,24 @@ nativeParseInt = context.parseInt, nativeRandom = Math.random; + /** Used as references for `-Infinity` and `Infinity` */ + var NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY, + POSITIVE_INFINITY = Number.POSITIVE_INFINITY; + + /** Used as references for the max length and index of an array */ + var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1, + MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1; + /** Used as the size, in bytes, of each Float64Array element */ var FLOAT64_BYTES_PER_ELEMENT = Float64Array ? Float64Array.BYTES_PER_ELEMENT : 0; + /** + * Used as the maximum length of an array-like value. + * See the [ES6 spec](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength) + * for more details. + */ + var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; + /** Used to store function metadata */ var metaMap = WeakMap && new WeakMap; @@ -1029,29 +1045,14 @@ */ function lodash(value) { if (value && typeof value == 'object') { - if (value instanceof lodashWrapper) { + if (value instanceof LodashWrapper) { return value; } if (!isArray(value) && hasOwnProperty.call(value, '__wrapped__')) { - return new lodashWrapper(value.__wrapped__, value.__chain__, baseSlice(value.__queue__)); + return new LodashWrapper(value.__wrapped__, value.__chain__, baseSlice(value.__queue__)); } } - return new lodashWrapper(value); - } - - /** - * A fast path for creating `lodash` wrapper objects. - * - * @private - * @param {*} value The value to wrap in a `lodash` instance. - * @param {boolean} [chainAll=false] Enable chaining for all methods. - * @param {Array} [queue=[]] Actions to peform to resolve the unwrapped value. - * @returns {Object} Returns a `lodash` instance. - */ - function lodashWrapper(value, chainAll, queue) { - this.__chain__ = !!chainAll; - this.__queue__ = queue || []; - this.__wrapped__ = value; + return new LodashWrapper(value); } /** @@ -1177,6 +1178,48 @@ /*------------------------------------------------------------------------*/ + /** + * A specialized version of `_.max` for arrays without support for iteratees. + * + * @private + * @param {Array} array The array to iterate over. + * @returns {*} Returns the maximum value. + */ + function arrayMax(array) { + var index = -1, + length = array.length, + result = NEGATIVE_INFINITY; + + while (++index < length) { + var value = array[index]; + if (value > result) { + result = value; + } + } + return result; + } + + /** + * A specialized version of `_.min` for arrays without support for iteratees. + * + * @private + * @param {Array} array The array to iterate over. + * @returns {*} Returns the minimum value. + */ + function arrayMin(array) { + var index = -1, + length = array.length, + result = POSITIVE_INFINITY; + + while (++index < length) { + var value = array[index]; + if (value < result) { + result = value; + } + } + return result; + } + /** * Used by `_.defaults` to customize its `_.assign` use. * @@ -1186,9 +1229,7 @@ * @returns {*} Returns the value to assign to the destination object. */ function assignDefaults(objectValue, sourceValue) { - return typeof objectValue == 'undefined' - ? sourceValue - : objectValue; + return typeof objectValue == 'undefined' ? sourceValue : objectValue; } /** @@ -1210,6 +1251,18 @@ : objectValue; } + /** + * Used by `_.matches` to clone `source` values, letting uncloneable values + * passthu instead of returning empty objects. + * + * @private + * @param {*} value The value to clone. + * @returns {*} Returns the cloned value. + */ + function clonePassthru(value) { + return isCloneable(value) ? undefined : value; + } + /** * The base implementation of `_.assign` without support for argument juggling, * multiple sources, and `this` binding. @@ -1259,7 +1312,7 @@ * "_.pluck" and "_.where" style callbacks. * * @private - * @param {*} [func=identity] The value to convert to a callback. + * @param {*} [func=_.identity] The value to convert to a callback. * @param {*} [thisArg] The `this` binding of the created callback. * @param {number} [argCount] The number of arguments the callback accepts. * @returns {Function} Returns the new function. @@ -1273,6 +1326,7 @@ } var data = getData(func); if (typeof data == 'undefined') { + var support = lodash.support; if (support.funcNames) { data = !func.name; } @@ -1326,12 +1380,17 @@ * @param {*} value The value to clone. * @param {boolean} [isDeep=false] Specify a deep clone. * @param {Function} [customizer] The function to customize cloning values. + * @param {string} [key] The key of `value`. + * @param {Object} [object] The object `value` belongs to. * @param {Array} [stackA=[]] Tracks traversed source objects. * @param {Array} [stackB=[]] Associates clones with source counterparts. * @returns {*} Returns the cloned value. */ - function baseClone(value, isDeep, customizer, stackA, stackB) { - var result = customizer ? customizer(value) : undefined; + function baseClone(value, isDeep, customizer, key, object, stackA, stackB) { + var result; + if (customizer) { + result = object ? customizer(value, key, object) : customizer(value); + } if (typeof result != 'undefined') { return result; } @@ -1341,7 +1400,12 @@ result = initArrayClone(value, isDeep); } else if (isObject(value)) { result = initObjectClone(value, isDeep); - value = (isDeep && toString.call(result) == objectClass) ? value : result; + if (result === null) { + isDeep = false; + result = {}; + } else if (isDeep) { + isDeep = toString.call(result) == objectClass; + } } if (!isDeep || result === value) { return result; @@ -1362,11 +1426,8 @@ stackB.push(result); // recursively populate clone (susceptible to call stack limits) - (isArr ? arrayEach : baseForOwn)(value, function(valValue, key) { - var valClone = customizer ? customizer(valValue, key) : undefined; - result[key] = typeof valClone == 'undefined' - ? baseClone(valValue, isDeep, null, stackA, stackB) - : valClone; + (isArr ? arrayEach : baseForOwn)(value, function(subValue, key) { + result[key] = baseClone(subValue, isDeep, customizer, key, value, stackA, stackB); }); return result; } @@ -1529,8 +1590,8 @@ } /** - * The base implementation of `_.filter` without support for callback shorthands - * or `this` binding. + * The base implementation of `_.filter` without support for callback + * shorthands or `this` binding. * * @private * @param {Array|Object|string} collection The collection to iterate over. @@ -2037,6 +2098,7 @@ * @param {Function} func The function to partially apply arguments to. * @param {number} bitmask The bitmask of flags to compose. * @param {Array} args The arguments to be partially applied. + * @param {Array} holders The `args` placeholder indexes. * @param {*} [thisArg] The `this` binding of `func`. * @returns {Function} Returns the new partially applied function. */ @@ -2327,7 +2389,7 @@ * * @private * @param {Array} partialRightArgs The arguments to append to those provided. - * @param {Array} partialHolders The `partialRightArgs` placeholder indexes. + * @param {Array} partialRightHolders The `partialRightArgs` placeholder indexes. * @param {Array|Object} args The provided arguments. * @returns {Array} Returns the new array of composed arguments. */ @@ -2427,7 +2489,7 @@ * @private * @param {Function} func The function to bind. * @param {*} [thisArg] The `this` binding of `func`. - * @returns {Function} Returns the new wrapped function. + * @returns {Function} Returns the new bound function. */ function createBindWrapper(func, thisArg) { var Ctor = createCtorWrapper(func); @@ -2472,7 +2534,7 @@ result = ''; while (++index < length) { - result = callback(result, array[index], index, words); + result = callback(result, array[index], index); } return result; }; @@ -2484,7 +2546,7 @@ * * @private * @param {Function} Ctor The constructor to wrap. - * @returns {Function} Returns the new function. + * @returns {Function} Returns the new wrapped function. */ function createCtorWrapper(Ctor) { return function() { @@ -2510,7 +2572,7 @@ * @param {Array} [partialHolders] The `partialArgs` placeholder indexes. * @param {Array} [partialRightArgs] The arguments to append to those provided to the new function. * @param {Array} [partialRightHolders] The `partialRightArgs` placeholder indexes. - * @returns {Function} Returns the new function. + * @returns {Function} Returns the new wrapped function. */ function createHybridWrapper(func, bitmask, arity, thisArg, partialArgs, partialHolders, partialRightArgs, partialRightHolders) { var isBind = bitmask & BIND_FLAG, @@ -2648,7 +2710,7 @@ * @param {Array} [partialHolders] The `partialArgs` placeholder indexes. * @param {Array} [partialRightArgs] The arguments to append to those provided to the new function. * @param {Array} [partialRightHolders] The `partialRightArgs` placeholder indexes. - * @returns {Function} Returns the new function. + * @returns {Function} Returns the new wrapped function. */ function createWrapper(func, bitmask, arity, thisArg, partialArgs, partialHolders, partialRightArgs, partialRightHolders) { var isBindKey = bitmask & BIND_KEY_FLAG; @@ -2763,9 +2825,9 @@ * Initializes an array clone. * * @private - * @param {*} value The value to clone. + * @param {Array} array The array to clone. * @param {boolean} [isDeep=false] Specify a deep clone. - * @returns {*} Returns the initialized clone value. + * @returns {Array} Returns the initialized array clone. */ function initArrayClone(array, isDeep) { var index = -1, @@ -2789,16 +2851,16 @@ * Initializes an object clone. * * @private - * @param {*} value The value to clone. + * @param {Object} object The object to clone. * @param {boolean} [isDeep=false] Specify a deep clone. - * @returns {*} Returns the initialized clone value. + * @returns {null|Object} Returns the initialized object clone. */ function initObjectClone(object, isDeep) { - var className = toString.call(object); - if (!cloneableClasses[className]) { - return object; + if (!isCloneable(object)) { + return null; } var Ctor = object.constructor, + className = toString.call(object), isArgs = className == argsClass, isObj = className == objectClass; @@ -2849,6 +2911,17 @@ arrayLikeClasses[toString.call(value)]) || false; } + /** + * Checks if `value` is cloneable. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is cloneable, else `false`. + */ + function isCloneable(value) { + return (value && cloneableClasses[toString.call(value)]) || false; + } + /** * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. * @@ -2949,7 +3022,7 @@ */ function shimIsPlainObject(value) { var Ctor, - result; + support = lodash.support; // exit early for non `Object` objects if (!(value && typeof value == 'object' && @@ -2958,10 +3031,14 @@ (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor)))) { return false; } + // IE < 9 iterates inherited properties before own properties. If the first + // iterated property is an object's own property then there are no inherited + // enumerable properties. + var result; // In most environments an object's own properties are iterated before // its inherited properties. If the last iterated property is an object's // own property then there are no inherited enumerable properties. - baseForIn(value, function(value, key) { + baseForIn(value, function(subValue, key) { result = key; }); return typeof result == 'undefined' || hasOwnProperty.call(value, result); @@ -2976,20 +3053,21 @@ * @returns {Array} Returns the array of property names. */ function shimKeys(object) { - var keyIndex, - index = -1, - props = keysIn(object), + var props = keysIn(object), length = props.length, objLength = length && object.length, - maxIndex = objLength - 1, - result = []; + support = lodash.support; var allowIndexes = typeof objLength == 'number' && objLength > 0 && (isArray(object) || (support.nonEnumArgs && isArguments(object))); + var keyIndex, + index = -1, + result = []; + while (++index < length) { var key = props[index]; - if ((allowIndexes && (keyIndex = +key, keyIndex > -1 && keyIndex <= maxIndex && keyIndex % 1 == 0)) || + if ((allowIndexes && (keyIndex = +key, keyIndex > -1 && keyIndex < objLength && keyIndex % 1 == 0)) || hasOwnProperty.call(object, key)) { result.push(key); } @@ -3094,8 +3172,9 @@ * Creates an array excluding all values of the provided arrays using * `SameValueZero` for equality comparisons. * - * **Note:** `SameValueZero` is like strict equality, e.g. `===`, except that - * `NaN` matches `NaN`. See the [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * **Note:** `SameValueZero` comparisons are like strict equality comparisons, + * e.g. `===`, except that `NaN` matches `NaN`. See the + * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for more details. * * @static @@ -3201,7 +3280,7 @@ * @type Function * @category Array * @param {Array} array The array to query. - * @param {Function|Object|string} [predicate=identity] The function invoked + * @param {Function|Object|string} [predicate=_.identity] The function invoked * per element. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {Array} Returns the slice of `array`. @@ -3250,7 +3329,7 @@ * @type Function * @category Array * @param {Array} array The array to query. - * @param {Function|Object|string} [predicate=identity] The function invoked + * @param {Function|Object|string} [predicate=_.identity] The function invoked * per element. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {Array} Returns the slice of `array`. @@ -3297,7 +3376,7 @@ * @memberOf _ * @category Array * @param {Array} array The array to search. - * @param {Function|Object|string} [predicate=identity] The function invoked + * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. @@ -3351,7 +3430,7 @@ * @memberOf _ * @category Array * @param {Array} array The array to search. - * @param {Function|Object|string} [predicate=identity] The function invoked + * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. @@ -3459,8 +3538,9 @@ * it is used as the offset from the end of the collection. If `array` is * sorted providing `true` for `fromIndex` performs a faster binary search. * - * **Note:** `SameValueZero` is like strict equality, e.g. `===`, except that - * `NaN` matches `NaN`. See the [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * **Note:** `SameValueZero` comparisons are like strict equality comparisons, + * e.g. `===`, except that `NaN` matches `NaN`. See the + * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for more details. * * @static @@ -3492,8 +3572,10 @@ if (typeof fromIndex == 'number') { fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0); } else if (fromIndex) { - var index = sortedIndex(array, value); - return array[index] === value ? index : -1; + var index = sortedIndex(array, value), + other = array[index]; + + return (value === value ? value === other : other !== other) ? index : -1; } return baseIndexOf(array, value, fromIndex); } @@ -3512,16 +3594,16 @@ * // => [1, 2] */ function initial(array) { - var length = array ? array.length : 0; - return slice(array, 0, (length || 1) - 1); + return dropRight(array, 1); } /** * Creates an array of unique values present in all provided arrays using * `SameValueZero` for equality comparisons. * - * **Note:** `SameValueZero` is like strict equality, e.g. `===`, except that - * `NaN` matches `NaN`. See the [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * **Note:** `SameValueZero` comparisons are like strict equality comparisons, + * e.g. `===`, except that `NaN` matches `NaN`. See the + * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for more details. * * @static @@ -3630,7 +3712,8 @@ index = (fromIndex < 0 ? nativeMax(length + fromIndex, 0) : nativeMin(fromIndex || 0, length - 1)) + 1; } else if (fromIndex) { index = sortedLastIndex(array, value) - 1; - return array[index] === value ? index : -1; + var other = array[index]; + return (value === value ? value === other : other !== other) ? index : -1; } if (value !== value) { return indexOfNaN(array, index, true); @@ -3649,8 +3732,9 @@ * * **Notes:** * - Unlike `_.without`, this method mutates `array`. - * - `SameValueZero` is like strict equality, e.g. `===`, except that `NaN` matches `NaN`. - * See the [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * - `SameValueZero` comparisons are like strict equality comparisons, + * e.g. `===`, except that `NaN` matches `NaN`. See the + * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for more details. * * @static @@ -3733,7 +3817,7 @@ * @memberOf _ * @category Array * @param {Array} array The array to modify. - * @param {Function|Object|string} [predicate=identity] The function invoked + * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. @@ -3781,7 +3865,7 @@ * // => [2, 3] */ function rest(array) { - return slice(array, 1); + return drop(array, 1); } /** @@ -3846,7 +3930,7 @@ * @category Array * @param {Array} array The array to inspect. * @param {*} value The value to evaluate. - * @param {Function|Object|string} [iteratee=identity] The function invoked + * @param {Function|Object|string} [iteratee=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. @@ -3887,7 +3971,7 @@ * @category Array * @param {Array} array The array to inspect. * @param {*} value The value to evaluate. - * @param {Function|Object|string} [iteratee=identity] The function invoked + * @param {Function|Object|string} [iteratee=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. @@ -3982,7 +4066,7 @@ * @type Function * @category Array * @param {Array} array The array to query. - * @param {Function|Object|string} [predicate=identity] The function invoked + * @param {Function|Object|string} [predicate=_.identity] The function invoked * per element. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {Array} Returns the slice of `array`. @@ -4031,7 +4115,7 @@ * @type Function * @category Array * @param {Array} array The array to query. - * @param {Function|Object|string} [predicate=identity] The function invoked + * @param {Function|Object|string} [predicate=_.identity] The function invoked * per element. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {Array} Returns the slice of `array`. @@ -4067,8 +4151,9 @@ * Creates an array of unique values, in order, of the provided arrays using * `SameValueZero` for equality comparisons. * - * **Note:** `SameValueZero` is like strict equality, e.g. `===`, except that - * `NaN` matches `NaN`. See the [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * **Note:** `SameValueZero` comparisons are like strict equality comparisons, + * e.g. `===`, except that `NaN` matches `NaN`. See the + * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for more details. * * @static @@ -4100,8 +4185,9 @@ * returns `true` for elements that have the properties of the given object, * else `false`. * - * **Note:** `SameValueZero` is like strict equality, e.g. `===`, except that - * `NaN` matches `NaN`. See the [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * **Note:** `SameValueZero` comparisons are like strict equality comparisons, + * e.g. `===`, except that `NaN` matches `NaN`. See the + * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for more details. * * @static @@ -4184,8 +4270,9 @@ * Creates an array excluding all provided values using `SameValueZero` for * equality comparisons. * - * **Note:** `SameValueZero` is like strict equality, e.g. `===`, except that - * `NaN` matches `NaN`. See the [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * **Note:** `SameValueZero` comparisons are like strict equality comparisons, + * e.g. `===`, except that `NaN` matches `NaN`. See the + * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for more details. * * @static @@ -4271,25 +4358,25 @@ * @alias object * @category Array * @param {Array} props The property names. - * @param {Array} [vals=[]] The property values. + * @param {Array} [values=[]] The property values. * @returns {Object} Returns the new object. * @example * * _.zipObject(['fred', 'barney'], [30, 40]); * // => { 'fred': 30, 'barney': 40 } */ - function zipObject(props, vals) { + function zipObject(props, values) { var index = -1, length = props ? props.length : 0, result = {}; - if (!vals && length && !isArray(props[0])) { - vals = []; + if (!values && length && !isArray(props[0])) { + values = []; } while (++index < length) { var key = props[index]; - if (vals) { - result[key] = vals[index]; + if (values) { + result[key] = values[index]; } else if (key) { result[key[0]] = key[1]; } @@ -4307,7 +4394,7 @@ * @memberOf _ * @category Chain * @param {*} value The value to wrap. - * @returns {Object} Returns the new wrapper object. + * @returns {Object} Returns the new `LodashWrapper` object. * @example * * var users = [ @@ -4377,13 +4464,30 @@ return interceptor.call(thisArg, value); } + /*------------------------------------------------------------------------*/ + + /** + * A fast path for creating `lodash` wrapper objects. + * + * @private + * @param {*} value The value to wrap. + * @param {boolean} [chainAll=false] Enable chaining for all methods. + * @param {Array} [queue=[]] Actions to peform to resolve the unwrapped value. + * @returns {Object} Returns a `LodashWrapper` instance. + */ + function LodashWrapper(value, chainAll, queue) { + this.__chain__ = !!chainAll; + this.__queue__ = queue || []; + this.__wrapped__ = value; + } + /** * Enables explicit method chaining on the wrapper object. * * @name chain * @memberOf _ * @category Chain - * @returns {*} Returns the wrapper object. + * @returns {*} Returns the `LodashWrapper` object. * @example * * var users = [ @@ -4406,6 +4510,32 @@ return chain(this); } + /** + * Reverses the wrapped array so the first element becomes the last, the + * second element becomes the second to last, and so on. + * + * **Note:** This method mutates the wrapped array. + * + * @name chain + * @memberOf _ + * @category Chain + * @returns {Object} Returns the new reversed `LodashWrapper` object. + * @example + * + * var array = [1, 2, 3]; + * + * _(array).reverse().value() + * // => [3, 2, 1] + * + * console.log(array); + * // => [3, 2, 1] + */ + function wrapperReverse() { + return this.thru(function(value) { + return value.reverse(); + }); + } + /** * Produces the result of coercing the unwrapped value to a string. * @@ -4436,24 +4566,152 @@ * // => [1, 2, 3] */ function wrapperValueOf() { + var result = this.__wrapped__; + if (result instanceof LazyWrapper) { + result = result.value(); + } var index = -1, queue = this.__queue__, - length = queue.length, - result = this.__wrapped__; + length = queue.length; while (++index < length) { var args = [result], data = queue[index], - object = data[1]; + object = data.object; - push.apply(args, data[2]); - result = object[data[0]].apply(object, args); + push.apply(args, data.args); + result = object[data.name].apply(object, args); } return result; } /*------------------------------------------------------------------------*/ + /** + * Wraps `value` as a `LazyWrapper` object. + * + * @private + * @param {*} value The value to wrap. + * @returns {Object} Returns a `LazyWrapper` instance. + */ + function LazyWrapper(value) { + this.dir = 1; + this.dropCount = 0; + this.filtered = false; + this.iteratees = []; + this.takeCount = POSITIVE_INFINITY; + this.views = []; + this.wrapped = value; + } + + /** + * Creates a clone of the `LazyWrapper` object. + * + * @private + * @name clone + * @memberOf LazyWrapper + * @returns {Object} Returns the cloned `LazyWrapper` object. + */ + function lazyClone() { + var result = new LazyWrapper(this.wrapped); + result.dir = this.dir; + result.dropCount = this.dropCount; + result.filtered = this.filtered; + result.takeCount = this.takeCount; + push.apply(result.iteratees, this.iteratees); + push.apply(result.views, this.views); + return result; + } + + /** + * Reverses the direction of lazy iteration. + * + * @private + * @name reverse + * @memberOf LazyWrapper + * @returns {Object} Returns the new reversed `LazyWrapper` object. + */ + function lazyReverse() { + var filtered = this.filtered, + result = filtered ? new LazyWrapper(this) : this.clone(); + + result.dir = this.dir * -1; + result.filtered = filtered; + return result; + } + + /** + * Extracts the unwrapped value from its wrapper. + * + * @private + * @name value + * @memberOf LazyWrapper + * @returns {*} Returns the unwrapped value. + */ + function lazyValue() { + var array = this.wrapped.value(), + length = array.length, + start = 0, + end = length, + views = this.views, + viewIndex = -1, + viewsLength = views.length; + + while (++viewIndex < viewsLength) { + var view = views[viewIndex], + size = view.size; + + switch (view.type) { + case 'drop': start += size; break; + case 'dropRight': end -= size; break; + case 'take': end = nativeMin(end, start + size); break; + case 'takeRight': start = nativeMax(start, end - size); break; + } + } + var dir = this.dir, + dropCount = this.dropCount, + droppedCount = 0, + doneDropping = !dropCount, + takeCount = nativeMin(end - start, this.takeCount - dropCount), + isRight = dir < 0, + index = isRight ? end : start - 1, + iteratees = this.iteratees, + iterateesLength = iteratees.length, + resIndex = 0, + result = []; + + outer: + while (length-- && resIndex < takeCount) { + var iterateesIndex = -1, + value = array[index += dir]; + + while (++iterateesIndex < iterateesLength) { + var data = iteratees[iterateesIndex], + iteratee = data.iteratee, + computed = iteratee(value, index, array), + type = data.type; + + if (type == LAZY_MAP_FLAG) { + value = computed; + } else if (!computed) { + if (type == LAZY_FILTER_FLAG) { + continue outer; + } else { + break outer; + } + } + } + if (doneDropping) { + result[resIndex++] = value; + } else { + doneDropping = ++droppedCount >= dropCount; + } + } + return isRight ? result.reverse() : result; + } + + /*------------------------------------------------------------------------*/ + /** * Creates an array of elements corresponding to the specified keys, or indexes, * of the collection. Keys may be specified as individual arguments or as arrays @@ -4484,12 +4742,13 @@ } /** - * Checks if `value` is present in `collection` using `SameValueZero` for + * Checks if `value` is present in `collection` using `SameValueZero` for * equality comparisons. If `fromIndex` is negative, it is used as the offset * from the end of the collection. * - * **Note:** `SameValueZero` is like strict equality, e.g. `===`, except that - * `NaN` matches `NaN`. See the [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * **Note:** `SameValueZero` comparisons are like strict equality comparisons, + * e.g. `===`, except that `NaN` matches `NaN`. See the + * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for more details. * * @static @@ -4552,7 +4811,7 @@ * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [iteratee=identity] The function invoked + * @param {Function|Object|string} [iteratee=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. @@ -4589,7 +4848,7 @@ * @alias all * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=identity] The function invoked + * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. @@ -4638,7 +4897,7 @@ * @alias select * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=identity] The function invoked + * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. @@ -4685,7 +4944,7 @@ * @alias detect * @category Collection * @param {Array|Object|string} collection The collection to search. - * @param {Function|Object|string} [predicate=identity] The function invoked + * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. @@ -4728,7 +4987,7 @@ * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to search. - * @param {Function|Object|string} [predicate=identity] The function invoked + * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. @@ -4786,7 +5045,7 @@ * @alias each * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} [iteratee=identity] The function invoked per iteration. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Array|Object|string} Returns `collection`. * @example @@ -4812,7 +5071,7 @@ * @alias eachRight * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} [iteratee=identity] The function invoked per iteration. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Array|Object|string} Returns `collection`. * @example @@ -4844,7 +5103,7 @@ * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [iteratee=identity] The function invoked + * @param {Function|Object|string} [iteratee=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. @@ -4887,7 +5146,7 @@ * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [iteratee=identity] The function invoked + * @param {Function|Object|string} [iteratee=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. @@ -4955,7 +5214,7 @@ * @alias collect * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [iteratee=identity] The function invoked + * @param {Function|Object|string} [iteratee=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. @@ -5028,38 +5287,30 @@ * // => { 'user': 'fred', 'age': 40 }; */ function max(collection, iteratee, thisArg) { - iteratee = isIterateeCall(collection, iteratee, thisArg) ? null : iteratee; - - var computed = -Infinity, - noIteratee = iteratee == null, + if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { + iteratee = null; + } + var noIteratee = iteratee == null, isArr = noIteratee && isArray(collection), - isStr = !isArr && isString(collection), - result = computed; + isStr = !isArr && isString(collection); if (noIteratee && !isStr) { - var index = -1, - iterable = toIterable(collection), - length = iterable.length; - - while (++index < length) { - var value = iterable[index]; - if (value > result) { - result = value; - } - } - } else { - iteratee = (noIteratee && isStr) - ? charAtCallback - : getCallback(iteratee, thisArg, 3); - - baseEach(collection, function(value, index, collection) { - var current = iteratee(value, index, collection); - if (current > computed || (current === -Infinity && current === result)) { - computed = current; - result = value; - } - }); + return arrayMax(isArr ? collection : toIterable(collection)); } + var computed = NEGATIVE_INFINITY, + result = computed; + + iteratee = (noIteratee && isStr) + ? charAtCallback + : getCallback(iteratee, thisArg, 3); + + baseEach(collection, function(value, index, collection) { + var current = iteratee(value, index, collection); + if (current > computed || (current === NEGATIVE_INFINITY && current === result)) { + computed = current; + result = value; + } + }); return result; } @@ -5107,38 +5358,30 @@ * // => { 'user': 'barney', 'age': 36 }; */ function min(collection, iteratee, thisArg) { - iteratee = isIterateeCall(collection, iteratee, thisArg) ? null : iteratee; - - var computed = Infinity, - noIteratee = iteratee == null, + if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { + iteratee = null; + } + var noIteratee = iteratee == null, isArr = noIteratee && isArray(collection), - isStr = !isArr && isString(collection), - result = computed; + isStr = !isArr && isString(collection); if (noIteratee && !isStr) { - var index = -1, - iterable = toIterable(collection), - length = iterable.length; - - while (++index < length) { - var value = iterable[index]; - if (value < result) { - result = value; - } - } - } else { - iteratee = (noIteratee && isStr) - ? charAtCallback - : getCallback(iteratee, thisArg, 3); - - baseEach(collection, function(value, index, collection) { - var current = iteratee(value, index, collection); - if (current < computed || (current === Infinity && current === result)) { - computed = current; - result = value; - } - }); + return arrayMin(isArr ? collection : toIterable(collection)); } + var computed = POSITIVE_INFINITY, + result = computed; + + iteratee = (noIteratee && isStr) + ? charAtCallback + : getCallback(iteratee, thisArg, 3); + + baseEach(collection, function(value, index, collection) { + var current = iteratee(value, index, collection); + if (current < computed || (current === POSITIVE_INFINITY && current === result)) { + computed = current; + result = value; + } + }); return result; } @@ -5159,7 +5402,7 @@ * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=identity] The function invoked + * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. @@ -5230,7 +5473,7 @@ * @alias foldl, inject * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} [iteratee=identity] The function invoked per iteration. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [accumulator] The initial value. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {*} Returns the accumulated value. @@ -5259,7 +5502,7 @@ * @alias foldr * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} [iteratee=identity] The function invoked per iteration. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [accumulator] The initial value. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {*} Returns the accumulated value. @@ -5289,7 +5532,7 @@ * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=identity] The function invoked + * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. @@ -5427,7 +5670,7 @@ * @alias any * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=identity] The function invoked + * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. @@ -5480,7 +5723,7 @@ * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Array|Function|Object|string} [iteratee=identity] The function + * @param {Array|Function|Object|string} [iteratee=_.identity] The function * invoked per iteration. If property name(s) or an object is provided it * is used to create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. @@ -5509,8 +5752,9 @@ * // = > [['barney', 26], ['barney', 36], ['fred', 30], ['fred', 40]] */ function sortBy(collection, iteratee, thisArg) { - iteratee = isIterateeCall(collection, iteratee, thisArg) ? null : iteratee; - + if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { + iteratee = null; + } var index = -1, length = collection ? collection.length : 0, multi = iteratee && isArray(iteratee), @@ -6179,9 +6423,16 @@ * Creates a function that memoizes the result of `func`. If `resolver` is * provided it determines the cache key for storing the result based on the * arguments provided to the memoized function. By default, the first argument - * provided to the memoized function is used as the cache key. The `func` is - * invoked with the `this` binding of the memoized function. The result cache - * is exposed as the `cache` property on the memoized function. + * provided to the memoized function is coerced to a string and used as the + * cache key. The `func` is invoked with the `this` binding of the memoized + * function. + * + * **Note:** The cache is exposed as the `cache` property on the memoized + * function. Its creation may be customized by replacing the `_.memoize.Cache` + * constructor with one whose instances implement the ES6 `Map` method interface + * of `get`, `has`, and `set`. See the + * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-map-prototype-object) + * for more details. * * @static * @memberOf _ @@ -6206,7 +6457,7 @@ * upperCase('fred'); * // => 'FRED' * - * upperCase.cache.fred = 'BARNEY' + * upperCase.cache.set('fred, 'BARNEY'); * upperCase('fred'); * // => 'BARNEY' */ @@ -6215,16 +6466,17 @@ throw new TypeError(FUNC_ERROR_TEXT); } var memoized = function() { - var key = resolver ? resolver.apply(this, arguments) : arguments[0]; - if (key == '__proto__') { - return func.apply(this, arguments); + var cache = memoized.cache, + key = resolver ? resolver.apply(this, arguments) : arguments[0]; + + if (cache.has(key)) { + return cache.get(key); } - var cache = memoized.cache; - return hasOwnProperty.call(cache, key) - ? cache[key] - : (cache[key] = func.apply(this, arguments)); + var result = func.apply(this, arguments); + cache.set(key, result); + return result; }; - memoized.cache = {}; + memoized.cache = new memoize.Cache; return memoized; } @@ -6274,7 +6526,7 @@ * initialize(); * // `initialize` invokes `createApplication` once */ - var once = partial(before, 2); + var once = basePartial(before,PARTIAL_FLAG, [2], []); /** * Creates a function that invokes `func` with `partial` arguments prepended @@ -6426,6 +6678,63 @@ /*------------------------------------------------------------------------*/ + /** + * Creates the cache used by `_.memoize`. + * + * @private + * @static + * @name Cache + * @memberOf _.memoize + */ + function MemCache() { + this.__wrapped__ = {}; + } + + /** + * Gets the value associated with `key`. + * + * @private + * @name get + * @memberOf _.memoize.Cache + * @param {string} key The key of the value to retrieve. + * @returns {*} Returns the cached value. + */ + function memGet(key) { + return this.__wrapped__[key]; + } + + /** + * Checks if an entry for `key` exists. + * + * @private + * @name get + * @memberOf _.memoize.Cache + * @param {string} key The name of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + function memHas(key) { + return key != '__proto__' && hasOwnProperty.call(this.__wrapped__, key); + } + + /** + * Sets the value associated with `key`. + * + * @private + * @name get + * @memberOf _.memoize.Cache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the cache object. + */ + function memSet(key, value) { + if (key != '__proto__') { + this.__wrapped__[key] = value; + } + return this; + } + + /*------------------------------------------------------------------------*/ + /** * Creates a clone of `value`. If `isDeep` is `true` nested objects are cloned, * otherwise they are assigned by reference. If `customizer` is provided it is @@ -6433,10 +6742,11 @@ * cloning is handled by the method instead. The `customizer` is bound to * `thisArg` and invoked with two argument; (value, index|key). * - * **Note:** This method is loosely based on the structured clone algorithm. Functions - * and DOM nodes are **not** cloned. The enumerable properties of `arguments` objects and - * objects created by constructors other than `Object` are cloned to plain `Object` objects. - * See the [HTML5 specification](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm) + * **Note:** This method is loosely based on the structured clone algorithm. + * The enumerable properties of `arguments` objects and objects created by + * constructors other than `Object` are cloned to plain `Object` objects. An + * empty object is returned for uncloneable values such as functions, DOM nodes, + * Maps, Sets, and WeakMaps. See the [HTML5 specification](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm) * for more details. * * @static @@ -6489,10 +6799,11 @@ * is handled by the method instead. The `customizer` is bound to `thisArg` * and invoked with two argument; (value, index|key). * - * **Note:** This method is loosely based on the structured clone algorithm. Functions - * and DOM nodes are **not** cloned. The enumerable properties of `arguments` objects and - * objects created by constructors other than `Object` are cloned to plain `Object` objects. - * See the [HTML5 specification](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm) + * **Note:** This method is loosely based on the structured clone algorithm. + * The enumerable properties of `arguments` objects and objects created by + * constructors other than `Object` are cloned to plain `Object` objects. An + * empty object is returned for uncloneable values such as functions, DOM nodes, + * Maps, Sets, and WeakMaps. See the [HTML5 specification](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm) * for more details. * * @static @@ -6537,7 +6848,7 @@ * @memberOf _ * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * (function() { return _.isArguments(arguments); })(); @@ -7151,7 +7462,7 @@ * @memberOf _ * @category Object * @param {Object} object The object to search. - * @param {Function|Object|string} [predicate=identity] The function invoked + * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. @@ -7197,7 +7508,7 @@ * @memberOf _ * @category Object * @param {Object} object The object to search. - * @param {Function|Object|string} [predicate=identity] The function invoked + * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. @@ -7238,7 +7549,7 @@ * @memberOf _ * @category Object * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=identity] The function invoked per iteration. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Object} Returns `object`. * @example @@ -7270,7 +7581,7 @@ * @memberOf _ * @category Object * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=identity] The function invoked per iteration. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Object} Returns `object`. * @example @@ -7302,7 +7613,7 @@ * @memberOf _ * @category Object * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=identity] The function invoked per iteration. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Object} Returns `object`. * @example @@ -7327,7 +7638,7 @@ * @memberOf _ * @category Object * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=identity] The function invoked per iteration. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Object} Returns `object`. * @example @@ -7370,7 +7681,7 @@ * @category Object * @param {Object} object The object to inspect. * @param {string} key The name of the property to check. - * @returns {boolean} Returns `true` if key is a direct property, else `false`. + * @returns {boolean} Returns `true` if `key` is a direct property, else `false`. * @example * * _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); @@ -7532,7 +7843,7 @@ * @memberOf _ * @category Object * @param {Object} object The object to iterate over. - * @param {Function|Object|string} [iteratee=identity] The function invoked + * @param {Function|Object|string} [iteratee=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. @@ -7724,7 +8035,7 @@ * @memberOf _ * @category Object * @param {Array|Object} object The object to iterate over. - * @param {Function} [iteratee=identity] The function invoked per iteration. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [accumulator] The custom accumulator value. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {*} Returns the accumulated value. @@ -7866,7 +8177,7 @@ * @memberOf _ * @category String * @param {string} [string=''] The string to deburr. - * @returns {string} Returns the beburred string. + * @returns {string} Returns the deburred string. * @example * * _.deburr('déjà vu'); @@ -8275,7 +8586,7 @@ // https://github.com/olado/doT var settings = lodash.templateSettings; - if (isIterateeCall(string, options, otherOptions)) { + if (otherOptions && isIterateeCall(string, options, otherOptions)) { options = otherOptions = null; } string = String(string == null ? '' : string); @@ -8301,8 +8612,8 @@ // use a sourceURL for easier debugging // http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl - var sourceURL = options.sourceURL || ('/lodash/template/source[' + (++templateCounter) + ']'); - sourceURL = sourceURL ? ('\n/*\n//# sourceURL=' + sourceURL + '\n*/') : ''; + var sourceURL = 'sourceURL' in options ? options.sourceURL : ('/lodash/template/source[' + (++templateCounter) + ']'); + sourceURL = sourceURL ? ('\n//# sourceURL=' + sourceURL) : ''; string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) { interpolateValue || (interpolateValue = esTemplateValue); @@ -8635,7 +8946,7 @@ * @memberOf _ * @alias iteratee * @category Utility - * @param {*} [func=identity] The value to convert to a callback. + * @param {*} [func=_.identity] The value to convert to a callback. * @param {*} [thisArg] The `this` binding of the created callback. * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. * @returns {Function} Returns the new function. @@ -8743,15 +9054,15 @@ } } var index = length, - flags = Array(length), - vals = Array(length); + values = Array(length), + strictCompareFlags = Array(length); while (index--) { value = source[props[index]]; var isStrict = isStrictComparable(value); - flags[index] = isStrict; - vals[index] = isStrict ? value : baseClone(value); + values[index] = isStrict ? value : baseClone(value, true, clonePassthru); + strictCompareFlags[index] = isStrict; } return function(object) { index = length; @@ -8759,13 +9070,19 @@ return !index; } while (index--) { - if (flags[index] ? vals[index] !== object[props[index]] : !hasOwnProperty.call(object, props[index])) { + if (strictCompareFlags[index] + ? values[index] !== object[props[index]] + : !hasOwnProperty.call(object, props[index]) + ) { return false; } } index = length; while (index--) { - if (flags[index] ? !hasOwnProperty.call(object, props[index]) : !baseIsEqual(vals[index], object[props[index]], null, true)) { + if (strictCompareFlags[index] + ? !hasOwnProperty.call(object, props[index]) + : !baseIsEqual(values[index], object[props[index]], null, true) + ) { return false; } } @@ -8837,10 +9154,11 @@ if (isFunc) { object.prototype[methodName] = (function(methodName) { return function() { - if (chain || this.__chain__) { + var chainAll = this.__chain__; + if (chain || chainAll) { var result = object(this.__wrapped__); - result.__chain__ = this.__chain__; - (result.__queue__ = baseSlice(this.__queue__)).push([methodName, object, arguments]); + result.__chain__ = chainAll; + (result.__queue__ = baseSlice(this.__queue__)).push({ 'args': arguments, 'object': object, 'name': methodName }); return result; } var args = [this.value()]; @@ -9031,7 +9349,7 @@ /** * Creates an array of numbers (positive and/or negative) progressing from - * `start` up to but not including `end`. If `start` is less than `stop` a + * `start` up to but not including `end`. If `start` is less than `end` a * zero-length range is created unless a negative `step` is specified. * * @static @@ -9137,7 +9455,7 @@ * @memberOf _ * @category Utility * @param {number} n The number of times to invoke `iteratee`. - * @param {Function} [iteratee=identity] The function invoked per iteration. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Array} Returns the array of results. * @example @@ -9191,6 +9509,17 @@ /*------------------------------------------------------------------------*/ + // ensure `new LodashWrapper` is an instance of `lodash` + LodashWrapper.prototype = lodash.prototype; + + // add functions to the memoize cache + MemCache.prototype.get = memGet; + MemCache.prototype.has = memHas; + MemCache.prototype.set = memSet; + + // assign cache to `_.memoize` + memoize.Cache = MemCache; + // add functions that return wrapped values when chaining lodash.after = after; lodash.assign = assign; @@ -9424,24 +9753,142 @@ */ lodash.VERSION = VERSION; - // ensure `new lodashWrapper` is an instance of `lodash` - lodashWrapper.prototype = lodash.prototype; - - // add "Chaining" functions to the wrapper - lodash.prototype.chain = wrapperChain; - lodash.prototype.toString = wrapperToString; - lodash.prototype.toJSON = lodash.prototype.value = lodash.prototype.valueOf = wrapperValueOf; - // assign default placeholders arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) { lodash[methodName].placeholder = lodash; }); - // add `Array.prototype` functions - arrayEach(['concat', 'join', 'pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(methodName) { + // add `LazyWrapper` methods that accept an `iteratee` value + arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) { + var isFilter = !index; + + LazyWrapper.prototype[methodName] = function(iteratee, thisArg) { + iteratee = getCallback(iteratee, thisArg, 3); + + var result = this.clone(); + result.filtered = isFilter || result.filtered; + result.iteratees.push({ 'iteratee': iteratee, 'type': lazyIterateeTypes[methodName] }); + return result; + }; + }); + + // add `LazyWrapper` methods for `_.drop` and `_.take` variants + arrayEach(['drop', 'take'], function(methodName) { + var countName = methodName + 'Count', + whileName = methodName + 'While'; + + LazyWrapper.prototype[methodName] = function(n) { + n = n == null ? 1 : nativeMax(+n || 0, 0); + + var result = this.clone(); + if (this.filtered) { + result[countName] = n; + return result; + } + result.views.push({ + 'size': n, + 'type': methodName + (result.dir < 0 ? 'Right' : '') + }); + return result; + }; + + LazyWrapper.prototype[methodName + 'Right'] = function(n) { + return this.reverse()[methodName](n).reverse(); + }; + + LazyWrapper.prototype[methodName + 'RightWhile'] = function(predicate, thisArg) { + var result = this.reverse()[whileName](predicate, thisArg); + result.filtered = true; + return result.reverse(); + }; + }); + + // add `LazyWrapper` methods for `_.first` and `_.last` + arrayEach(['first', 'last'], function(methodName, index) { + var takeName = 'take' + (index ? 'Right': ''); + + LazyWrapper.prototype[methodName] = function() { + return this[takeName](1).value()[0]; + }; + }); + + // add `LazyWrapper` methods for `_.initial` and `_.rest` + arrayEach(['initial', 'rest'], function(methodName, index) { + var dropName = 'drop' + (index ? '' : 'Right'); + + LazyWrapper.prototype[methodName] = function() { + return this[dropName](1); + }; + }); + + LazyWrapper.prototype.dropWhile = function(iteratee, thisArg) { + iteratee = getCallback(iteratee, thisArg, 3); + + var done, + lastIndex, + isRight = this.dir < 0; + + return this.filter(function(value, index, array) { + done = done && (isRight ? index < lastIndex : index > lastIndex); + lastIndex = index; + return done || (done = !iteratee(value, index, array)); + }); + }; + + LazyWrapper.prototype.reject = function(iteratee, thisArg) { + iteratee = getCallback(iteratee, thisArg, 3); + + return this.filter(function(value, index, array) { + return !iteratee(value, index, array); + }); + }; + + LazyWrapper.prototype.slice = function(start, end) { + start = start == null ? 0 : (+start || 0); + var result = start < 0 ? this.takeRight(-start) : this.drop(start); + + if (typeof end != 'undefined') { + end = (+end || 0); + result = end < 0 ? result.dropRight(-end) : result.take(end - start); + } + return result; + }; + + // add `LazyWrapper` methods to `LodashWrapper` + baseForOwn(LazyWrapper.prototype, function(func, methodName) { + var retUnwrapped = /^(?:first|last)$/.test(methodName); + + lodash.prototype[methodName] = function() { + var args = arguments, + chainAll = this.__chain__, + value = this.__wrapped__, + isLazy = value instanceof LazyWrapper; + + if (retUnwrapped && !chainAll) { + if (isLazy) { + return func.apply(value, args); + } + var otherArgs = [this.value()]; + push.apply(otherArgs, args); + return lodash[methodName].apply(lodash, otherArgs); + } + if (isLazy || isArray(value)) { + var result = func.apply(isLazy ? value : new LazyWrapper(this), args); + return new LodashWrapper(result, chainAll); + } + return this.thru(function(value) { + var otherArgs = [value]; + push.apply(otherArgs, args); + return lodash[methodName].apply(lodash, otherArgs); + }); + }; + }); + + // add `Array.prototype` functions to `LodashWrapper` + arrayEach(['concat', 'join', 'pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) { var func = arrayProto[methodName], - retUnwrapped = /^(?:join|pop|shift)$/.test(methodName), - chainName = /^(?:push|reverse|sort|unshift)$/.test(methodName) ? 'tap' : 'thru'; + chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru', + retUnwrapped = /^(?:join|pop|shift)$/.test(methodName); lodash.prototype[methodName] = function() { var args = arguments; @@ -9454,6 +9901,23 @@ }; }); + // add functions to the lazy wrapper + LazyWrapper.prototype.clone = lazyClone; + LazyWrapper.prototype.reverse = lazyReverse; + LazyWrapper.prototype.value = lazyValue; + + // add chaining functions to the lodash wrapper + lodash.prototype.chain = wrapperChain; + lodash.prototype.reverse = wrapperReverse; + lodash.prototype.toString = wrapperToString; + lodash.prototype.toJSON = lodash.prototype.value = lodash.prototype.valueOf = wrapperValueOf; + + // add function aliases to the lodash wrapper + lodash.prototype.collect = lodash.prototype.map; + lodash.prototype.head = lodash.prototype.first; + lodash.prototype.select = lodash.prototype.filter; + lodash.prototype.tail = lodash.prototype.rest; + return lodash; } diff --git a/dist/lodash.min.js b/dist/lodash.min.js index f4ef31fe9..08840f330 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -3,70 +3,78 @@ * Lo-Dash 3.0.0-pre (Custom Build) lodash.com/license | Underscore.js 1.7.0 underscorejs.org/LICENSE * Build: `lodash modern -o ./dist/lodash.js` */ -;(function(){function n(n,t){for(var r=-1,e=n.length;++rt||!r||typeof n=="undefined"&&e)return 1;if(n=n&&9<=n&&13>=n||32==n||160==n||5760==n||6158==n||8192<=n&&(8202>=n||8232==n||8233==n||8239==n||8287==n||12288==n||65279==n)}function j(n,t){for(var r=-1,e=n.length,u=-1,o=[];++ru(t,i)&&f.push(i);return f}function Yt(n,t){var r=n?n.length:0;if(typeof r!="number"||-1>=r||r>K)return er(n,t);for(var e=-1,u=Lr(n);++e=r||r>K)return ur(n,t);for(var e=Lr(n);r--&&false!==t(e[r],r,e););return n -}function Xt(n,t){var r=true;return Yt(n,function(n,e,u){return r=!!t(n,e,u)}),r}function Gt(n,t){var r=[];return Yt(n,function(n,e,u){t(n,e,u)&&r.push(n)}),r}function Ht(n,t,r,e){var u;return r(n,function(n,r,o){return t(n,r,o)?(u=e?r:n,false):void 0}),u}function Qt(n,t,r,e){e=(e||0)-1;for(var u=n.length,o=-1,i=[];++ec))return false}else{var g=p&&ou.call(n,"__wrapped__"),h=h&&ou.call(t,"__wrapped__");if(g||h)return ir(g?n.value():n,h?t.value():t,r,e,u,o);if(!s)return false;if(!f&&!p){switch(l){case yt:case dt:return+n==+t;case bt:return n!=+n?t!=+t:0==n?1/n==1/t:n==+t; -case xt:case wt:return n==Qe(t)}return false}if(g=c?Ge:n.constructor,l=i?Ge:t.constructor,f){if(g.prototype.name!=l.prototype.name)return false}else if(p=!c&&ou.call(n,"constructor"),h=!i&&ou.call(t,"constructor"),p!=h||!p&&g!=l&&"constructor"in n&&"constructor"in t&&!(typeof g=="function"&&g instanceof g&&typeof l=="function"&&l instanceof l))return false;if(g=f?["message","name"]:Ju(n),l=f?g:Ju(t),c&&g.push("length"),i&&l.push("length"),c=g.length,p=l.length,c!=p&&!e)return false}for(u||(u=[]),o||(o=[]),l=u.length;l--;)if(u[l]==n)return o[l]==t; -if(u.push(n),o.push(t),i=true,a)for(;i&&++le(a,p)&&((t||i)&&a.push(p),f.push(c))}return f}function yr(n,t){for(var r=-1,e=t(n),u=e.length,o=Pe(u);++rt||null==r)return r;if(3r?Ou(e+r,0):r||0;else if(r)return r=Zr(n,t),n[r]===t?r:-1;return l(n,t,r)}function Kr(n){return Pr(n,1)}function Pr(n,t,r){var e=-1,u=n?n.length:0,o=typeof r; -if(r&&"number"!=o&&x(n,t,r)&&(t=0,r=u),t=null==t?0:+t||0,0>t&&(t=-t>u?0:u+t),r="undefined"==o||r>u?u:+r||0,0>r&&(r+=u),r&&r==u&&!t)return c(n);for(u=t>r?0:r-t,r=Pe(u);++er?Ou(e+r,0):r||0:0,typeof n=="string"||!Pu(n)&&Fe(n)?ri&&(i=o);else t=u&&o?p:Dr(t,r,3),Yt(n,function(n,r,u){r=t(n,r,u),(r>e||-1/0===r&&r===i)&&(e=r,i=n)});return i}function ie(n,t){return ue(n,Ke(t))}function fe(n,t,r,e){return(Pu(n)?u:pr)(n,Dr(t,e,4),r,3>arguments.length,Yt)}function ae(n,t,r,e){return(Pu(n)?o:pr)(n,Dr(t,e,4),r,3>arguments.length,Jt)}function le(n){n=qr(n);for(var t=-1,r=n.length,e=Pe(r);++targuments.length)return Fr(n,R,null,t);var r=Pr(arguments,2),e=j(r,pe.placeholder);return cr(n,R|U,r,e,t)}function he(n,t){var r=R|k;if(2=r||r>t?(f&&pu(f),r=p,f=s=p=F,r&&(h=no(),a=n.apply(c,i),s||f||(i=c=null))):s=mu(e,r)}function u(){s&&pu(s),f=s=p=F,(v||g!==t)&&(h=no(),a=n.apply(c,i),s||f||(i=c=null))}function o(){if(i=arguments,l=no(),c=this,p=v&&(s||!y),false===g)var r=y&&!s;else{f||y||(h=l); -var o=g-(l-h),d=0>=o||o>g;d?(f&&(f=pu(f)),h=l,a=n.apply(c,i)):f||(f=mu(u,o))}return d&&s?s=pu(s):s||t===g||(s=mu(e,t)),r&&(d=true,a=n.apply(c,i)),!d||s||f||(i=c=null),a}var i,f,a,l,c,s,p,h=0,g=false,v=true;if(!je(n))throw new nu(B);if(t=0>t?0:t,true===r)var y=true,v=false;else Ae(r)&&(y=r.leading,g="maxWait"in r&&Ou(+r.maxWait||0,t),v="trailing"in r?r.trailing:v);return o.cancel=function(){s&&pu(s),f&&pu(f),f=s=p=F},o}function de(){var n=arguments,r=n.length-1;if(0>r)return function(){};if(!t(n,je))throw new nu(B); -return function(){for(var t=r,e=n[t].apply(this,arguments);t--;)e=n[t].call(this,e);return e}}function me(n){var t=Pr(arguments,1),r=j(t,me.placeholder);return cr(n,U,t,r)}function be(n){var t=Pr(arguments,1),r=j(t,be.placeholder);return cr(n,W,t,r)}function _e(n){var t=n&&typeof n=="object"?n.length:F;return typeof t=="number"&&-1t||null==n||!Eu(t))return r; -n=Qe(n);do t%2&&(r+=n),t=hu(t/2),n+=n;while(t);return r}function Ue(n,t,r){return(n=null==n?"":Qe(n))?r||null==t?n.slice(A(n),E(n)+1):(t=Qe(t),n.slice(h(n,t),g(n,t)+1)):n}function We(n,t,r){return(n=null!=n&&Qe(n))&&n.match((r?null:t)||st)||[]}function Ne(n){try{return n()}catch(t){return we(t)?t:Ve(t)}}function $e(n,t,r){return Mt(n,r?F:t)}function qe(n){return n}function Le(n){var t=Ju(n),r=t.length;if(1==r){var e=t[0],u=n[e];if(Tr(u))return function(n){return null!=n&&u===n[e]&&ou.call(n,e)}}for(var o=r,i=Pe(r),f=Pe(r);o--;){var u=n[t[o]],a=Tr(u); -i[o]=a,f[o]=a?u:zt(u)}return function(n){if(o=r,null==n)return!o;for(;o--;)if(i[o]?f[o]!==n[t[o]]:!ou.call(n,t[o]))return false;for(o=r;o--;)if(i[o]?!ou.call(n,t[o]):!ir(f[o],n[t[o]],null,true))return false;return true}}function Be(n,t,r){var e=true,u=Ae(t),o=null==r,i=o&&u&&Ju(t),f=i&&or(t,i);(i&&i.length&&!f.length||o&&!u)&&(o&&(r=t),f=false,t=n,n=this),f||(f=or(t,Ju(t))),false===r?e=false:Ae(r)&&"chain"in r&&(e=r.chain),r=-1,u=je(n);for(o=f.length;++r=q)return r -}else n=0;return Wu(r,e)}}(),Lu=_r(function(n,t,r){ou.call(n,r)?++n[r]:n[r]=1}),Bu=_r(function(n,t,r){ou.call(n,r)?n[r].push(t):n[r]=[t]}),Mu=_r(function(n,t,r){n[r]=t}),zu=_r(function(n,t,r){n[r?0:1].push(t)},function(){return[[],[]]}),Ku=me(se,2),Pu=Au||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&fu.call(n)==vt||false};Uu.dom||(xe=function(n){return n&&typeof n=="object"&&1===n.nodeType&&!Vu(n)||false});var Zu=Ru||function(n){return typeof n=="number"&&Eu(n)},Vu=gu?function(n){if(!n||fu.call(n)!=_t)return false; -var t=n.valueOf,r=Ee(t)&&(r=gu(t))&&gu(r);return r?n==r||gu(n)==r:Nr(n)}:Nr,Yu=xr(Lt),Ju=Iu?function(n){if(n)var t=n.constructor,r=n.length;return typeof t=="function"&&t.prototype===n||typeof r=="number"&&0--n?t.apply(this,arguments):void 0}},Wt.assign=Yu,Wt.at=function(n){var t=n?n.length:0;return typeof t=="number"&&-1t?0:t)},Wt.dropRight=function(n,t,r){var e=n?n.length:0;return t=e-((r||null==t?1:t)||0),Pr(n,0,0>t?0:t)},Wt.dropRightWhile=function(n,t,r){var e=n?n.length:0; -for(t=Dr(t,r,3);e--&&t(n[e],e,n););return Pr(n,0,e+1)},Wt.dropWhile=function(n,t,r){var e=-1,u=n?n.length:0;for(t=Dr(t,r,3);++e(p?s(p,i):u(c,i))){for(t=r;--t;){var h=e[t];if(0>(h?s(h,i):u(n[t],i)))continue n}p&&p.push(i),c.push(i)}return c},Wt.invert=function(n,t,r){t=r?null:t,r=-1;for(var e=Ju(n),u=e.length,o={};++rt?0:t) -},Wt.takeRight=function(n,t,r){var e=n?n.length:0;return t=e-((r||null==t?1:t)||0),Pr(n,0>t?0:t)},Wt.takeRightWhile=function(n,t,r){var e=n?n.length:0;for(t=Dr(t,r,3);e--&&t(n[e],e,n););return Pr(n,e+1)},Wt.takeWhile=function(n,t,r){var e=-1,u=n?n.length:0;for(t=Dr(t,r,3);++er?0:+r||0,e))-t.length,0<=r&&n.indexOf(t,r)==r},Wt.escape=function(n){return(n=null==n?"":Qe(n))&&(G.lastIndex=0,G.test(n))?n.replace(G,m):n},Wt.escapeRegExp=Se,Wt.every=Qr,Wt.find=te,Wt.findIndex=Br,Wt.findKey=function(n,t,r){return t=Dr(t,r,3),Ht(n,t,er,true) -},Wt.findLast=function(n,t,r){return t=Dr(t,r,3),Ht(n,t,Jt)},Wt.findLastIndex=function(n,t,r){var e=n?n.length:0;for(t=Dr(t,r,3);e--;)if(t(n[e],e,n))return e;return-1},Wt.findLastKey=function(n,t,r){return t=Dr(t,r,3),Ht(n,t,ur,true)},Wt.findWhere=function(n,t){return te(n,Le(t))},Wt.first=Mr,Wt.has=function(n,t){return n?ou.call(n,t):false},Wt.identity=qe,Wt.indexOf=zr,Wt.isArguments=_e,Wt.isArray=Pu,Wt.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&fu.call(n)==yt||false},Wt.isDate=function(n){return n&&typeof n=="object"&&fu.call(n)==dt||false -},Wt.isElement=xe,Wt.isEmpty=function(n){if(null==n)return true;var t=n.length;return typeof t=="number"&&-1r?Ou(e+r,0):Fu(r||0,e-1))+1;else if(r)return u=Vr(n,t)-1,n[u]===t?u:-1;if(t!==t)return _(n,u,true);for(;u--;)if(n[u]===t)return u;return-1},Wt.max=oe,Wt.min=function(n,t,r){t=x(n,t,r)?null:t;var e=1/0,u=null==t,o=!(u&&Pu(n))&&Fe(n),i=e;if(u&&!o)for(r=-1,n=qr(n),u=n.length;++rr?0:+r||0,n.length),n.lastIndexOf(t,r)==r},Wt.template=function(n,t,r){var e=Wt.templateSettings;x(n,t,r)&&(t=r=null),n=Qe(null==n?"":n),t=Yu({},r||t,e,qt),r=Yu({},t.imports,e.imports,qt); -var u,o,i=Ju(r),f=ke(r),a=0;r=t.interpolate||ft;var l="__p+='";if(r=He((t.escape||ft).source+"|"+r.source+"|"+(r===nt?tt:ft).source+"|"+(t.evaluate||ft).source+"|$","g"),n.replace(r,function(t,r,e,i,f,c){return e||(e=i),l+=n.slice(a,c).replace(ct,b),r&&(u=true,l+="'+__e("+r+")+'"),f&&(o=true,l+="';"+f+";\n__p+='"),e&&(l+="'+((__t=("+e+"))==null?'':__t)+'"),a=c+t.length,t}),l+="';",(t=t.variable)||(l="with(obj){"+l+"}"),l=(o?l.replace(V,""):l).replace(Y,"$1").replace(J,"$1;"),l="function("+(t||"obj")+"){"+(t?"":"obj||(obj={});")+"var __t,__p=''"+(u?",__e=_.escape":"")+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}",t=Ne(function(){return Ye(i,"return "+l).apply(F,f) -}),t.source=l,we(t))throw t;return t},Wt.trim=Ue,Wt.trimLeft=function(n,t,r){return(n=null==n?"":Qe(n))?r||null==t?n.slice(A(n)):(t=Qe(t),n.slice(h(n,t))):n},Wt.trimRight=function(n,t,r){return(n=null==n?"":Qe(n))?r||null==t?n.slice(0,E(n)+1):(t=Qe(t),n.slice(0,g(n,t)+1)):n},Wt.trunc=function(n,t,r){t=r?null:t;var e=N;if(r=$,Ae(t)){var u="separator"in t?t.separator:u,e="length"in t?+t.length||0:e;r="omission"in t?Qe(t.omission):r}else null!=t&&(e=+t||0);if(n=null==n?"":Qe(n),e>=n.length)return n; -if(e-=r.length,1>e)return r;if(t=n.slice(0,e),null==u)return t+r;if(Oe(u)){if(n.slice(e).search(u)){var o,i=n.slice(0,e);for(u.global||(u=He(u.source,(rt.exec(u)||"")+"g")),u.lastIndex=0;n=u.exec(i);)o=n.index;t=t.slice(0,null==o?e:o)}}else n.indexOf(u,e)!=e&&(u=t.lastIndexOf(u),-1t?0:+t||0,n.length),n)},Wt.prototype.sample=function(n,t){return n=t?null:n,this.__chain__||null!=n?this.thru(function(t){return Wt.sample(t,n)}):Wt.sample(this.value())},Wt.VERSION=D,Nt.prototype=Wt.prototype,Wt.prototype.chain=function(){return Gr(this)},Wt.prototype.toString=function(){return Qe(this.value())},Wt.prototype.toJSON=Wt.prototype.value=Wt.prototype.valueOf=function(){for(var n=-1,t=this.__queue__,r=t.length,e=this.__wrapped__;++n"'`]/g,H=/<%-([\s\S]+?)%>/g,Q=/<%([\s\S]+?)%>/g,nt=/<%=([\s\S]+?)%>/g,tt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,rt=/\w*$/,et=/^\s*function[ \n\r\t]+\w/,ut=/^0[xX]/,ot=/^\[object .+?Constructor\]$/,it=/[\xC0-\xD6\xD8-\xDE\xDF-\xF6\xF8-\xFF]/g,ft=/($^)/,at=/[.*+?^${}()|[\]\/\\]/g,lt=/\bthis\b/,ct=/['\n\r\u2028\u2029\\]/g,st=RegExp("[A-Z\\xC0-\\xD6\\xD8-\\xDE]{2,}(?=[A-Z\\xC0-\\xD6\\xD8-\\xDE][a-z\\xDF-\\xF6\\xF8-\\xFF]+)|[A-Z\\xC0-\\xD6\\xD8-\\xDE]?[a-z\\xDF-\\xF6\\xF8-\\xFF]+|[A-Z\\xC0-\\xD6\\xD8-\\xDE]+|[0-9]+","g"),pt=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",ht="Array ArrayBuffer Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Math Number Object RegExp Set String _ clearTimeout document isFinite parseInt setTimeout TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap window WinRTError".split(" "),gt="[object Arguments]",vt="[object Array]",yt="[object Boolean]",dt="[object Date]",mt="[object Error]",bt="[object Number]",_t="[object Object]",xt="[object RegExp]",wt="[object String]",jt="[object ArrayBuffer]",At="[object Float32Array]",Et="[object Float64Array]",It="[object Int8Array]",Ot="[object Int16Array]",Ft="[object Int32Array]",Dt="[object Uint8Array]",Rt="[object Uint8ClampedArray]",kt="[object Uint16Array]",Ct="[object Uint32Array]",St={}; -St[gt]=St[vt]=St[At]=St[Et]=St[It]=St[Ot]=St[Ft]=St[Dt]=St[Rt]=St[kt]=St[Ct]=true,St[jt]=St[yt]=St[dt]=St[mt]=St["[object Function]"]=St["[object Map]"]=St[bt]=St[_t]=St[xt]=St["[object Set]"]=St[wt]=St["[object WeakMap]"]=false;var Tt={};Tt[gt]=Tt[vt]=Tt[jt]=Tt[yt]=Tt[dt]=Tt[At]=Tt[Et]=Tt[It]=Tt[Ot]=Tt[Ft]=Tt[bt]=Tt[_t]=Tt[xt]=Tt[wt]=Tt[Dt]=Tt[Rt]=Tt[kt]=Tt[Ct]=true,Tt[mt]=Tt["[object Function]"]=Tt["[object Map]"]=Tt["[object Set]"]=Tt["[object WeakMap]"]=false;var Ut={leading:false,maxWait:0,trailing:false},Wt={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Nt={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},$t={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss"},qt={"function":true,object:true},Lt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Bt=qt[typeof window]&&window||this,Mt=qt[typeof exports]&&exports&&!exports.nodeType&&exports,zt=qt[typeof module]&&module&&!module.nodeType&&module,Kt=Mt&&zt&&typeof global=="object"&&global; -!Kt||Kt.global!==Kt&&Kt.window!==Kt&&Kt.self!==Kt||(Bt=Kt);var Pt=zt&&zt.exports===Mt&&Mt,Zt=O();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Bt._=Zt, define(function(){return Zt})):Mt&&zt?Pt?(zt.exports=Zt)._=Zt:Mt._=Zt:Bt._=Zt}).call(this); \ No newline at end of file +;(function(){function n(n,t){for(var r=-1,e=n.length;++rt||!r||typeof n=="undefined"&&e)return 1;if(n=n&&9<=n&&13>=n||32==n||160==n||5760==n||6158==n||8192<=n&&(8202>=n||8232==n||8233==n||8239==n||8287==n||12288==n||65279==n)}function j(n,t){for(var r=-1,e=n.length,u=-1,o=[];++re&&(e=u)}return e}function Ut(n){for(var t=-1,r=n.length,e=Bu;++tu(t,i)&&f.push(i); +return f}function Jt(n,t){var r=n?n.length:0;if(typeof r!="number"||-1>=r||r>Vu)return or(n,t);for(var e=-1,u=Br(n);++e=r||r>Vu)return ir(n,t);for(var e=Br(n);r--&&false!==t(e[r],r,e););return n}function Ht(n,t){var r=true;return Jt(n,function(n,e,u){return r=!!t(n,e,u)}),r}function Qt(n,t){var r=[];return Jt(n,function(n,e,u){t(n,e,u)&&r.push(n)}),r}function nr(n,t,r,e){var u;return r(n,function(n,r,o){return t(n,r,o)?(u=e?r:n,false):void 0 +}),u}function tr(n,t,r,e){e=(e||0)-1;for(var u=n.length,o=-1,i=[];++ec))return false}else{var g=s&&hu.call(n,"__wrapped__"),h=h&&hu.call(t,"__wrapped__");if(g||h)return ar(g?n.value():n,h?t.value():t,r,e,u,o);if(!p)return false;if(!f&&!s){switch(l){case vt:case yt:return+n==+t;case mt:return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case bt:case wt:return n==fu(t)}return false}if(g=c?ou:n.constructor,l=i?ou:t.constructor,f){if(g.prototype.name!=l.prototype.name)return false}else if(s=!c&&hu.call(n,"constructor"),h=!i&&hu.call(t,"constructor"),s!=h||!s&&g!=l&&"constructor"in n&&"constructor"in t&&!(typeof g=="function"&&g instanceof g&&typeof l=="function"&&l instanceof l))return false; +if(g=f?["message","name"]:ao(n),l=f?g:ao(t),c&&g.push("length"),i&&l.push("length"),c=g.length,s=l.length,c!=s&&!e)return false}for(u||(u=[]),o||(o=[]),l=u.length;l--;)if(u[l]==n)return o[l]==t;if(u.push(n),o.push(t),i=true,a)for(;i&&++le(a,s)&&((t||i)&&a.push(s),f.push(c))}return f}function mr(n,t){for(var r=-1,e=t(n),u=e.length,o=Qe(u);++rt||null==r)return r; +if(3t?0:t)}function Pr(n,t,r){var e=n?n.length:0; +return t=e-((r||null==t?1:t)||0),Gr(n,0,0>t?0:t)}function Kr(n,t,r){var e=-1,u=n?n.length:0;for(t=Cr(t,r,3);++er?Wu(e+r,0):r||0;else if(r)return r=Jr(n,t),n=n[r],(t===t?t===n:n!==n)?r:-1;return l(n,t,r)}function Zr(n){return Mr(n,1)}function Gr(n,t,r){var e=-1,u=n?n.length:0,o=typeof r;if(r&&"number"!=o&&w(n,t,r)&&(t=0,r=u),t=null==t?0:+t||0,0>t&&(t=-t>u?0:u+t),r="undefined"==o||r>u?u:+r||0,0>r&&(r+=u),r&&r==u&&!t)return c(n); +for(u=t>r?0:r-t,r=Qe(u);++er?Wu(e+r,0):r||0:0,typeof n=="string"||!uo(n)&&Ne(n)?ri||r===zu&&r===f)&&(i=r,f=n)}),f}function se(n,t){return ce(n,He(t))}function he(n,t,r,e){return(uo(n)?u:gr)(n,Cr(t,e,4),r,3>arguments.length,Jt)}function ge(n,t,r,e){return(uo(n)?o:gr)(n,Cr(t,e,4),r,3>arguments.length,Xt)}function ve(n){n=zr(n);for(var t=-1,r=n.length,e=Qe(r);++targuments.length)return Fr(n,F,null,t);var r=Gr(arguments,2),e=j(r,me.placeholder);return sr(n,F|W,r,e,t)}function _e(n,t){var r=F|C;if(2=r||r>t?(f&&bu(f),r=s,f=p=s=O,r&&(h=ho(),a=n.apply(c,i),p||f||(i=c=null))):p=Iu(e,r)}function u(){p&&bu(p),f=p=s=O,(v||g!==t)&&(h=ho(),a=n.apply(c,i),p||f||(i=c=null))}function o(){if(i=arguments,l=ho(),c=this,s=v&&(p||!y),false===g)var r=y&&!p;else{f||y||(h=l);var o=g-(l-h),d=0>=o||o>g;d?(f&&(f=bu(f)),h=l,a=n.apply(c,i)):f||(f=Iu(u,o)) +}return d&&p?p=bu(p):p||t===g||(p=Iu(e,t)),r&&(d=true,a=n.apply(c,i)),!d||p||f||(i=c=null),a}var i,f,a,l,c,p,s,h=0,g=false,v=true;if(!Ce(n))throw new au(M);if(t=0>t?0:t,true===r)var y=true,v=false;else De(r)&&(y=r.leading,g="maxWait"in r&&Wu(+r.maxWait||0,t),v="trailing"in r?r.trailing:v);return o.cancel=function(){p&&bu(p),f&&bu(f),f=p=s=O},o}function je(){var n=arguments,r=n.length-1;if(0>r)return function(){};if(!t(n,Ce))throw new au(M);return function(){for(var t=r,e=n[t].apply(this,arguments);t--;)e=n[t].call(this,e); +return e}}function Ae(n,t){function r(){var e=r.cache,u=t?t.apply(this,arguments):arguments[0];if(e.has(u))return e.get(u);var o=n.apply(this,arguments);return e.set(u,o),o}if(!Ce(n)||t&&!Ce(t))throw new au(M);return r.cache=new Ae.Cache,r}function Ee(n){var t=Gr(arguments,1),r=j(t,Ee.placeholder);return sr(n,W,t,r)}function Ie(n){var t=Gr(arguments,1),r=j(t,Ie.placeholder);return sr(n,N,t,r)}function ke(){this.__wrapped__={}}function Oe(n){var t=n&&typeof n=="object"?n.length:O;return typeof t=="number"&&-1t||null==n||!Su(t))return r;n=fu(n);do t%2&&(r+=n),t=wu(t/2),n+=n;while(t);return r}function Me(n,t,r){return(n=null==n?"":fu(n))?r||null==t?n.slice(A(n),E(n)+1):(t=fu(t),n.slice(h(n,t),g(n,t)+1)):n}function Pe(n,t,r){return(n=null!=n&&fu(n))&&n.match((r?null:t)||ct)||[]}function Ke(n){try{return n()}catch(t){return Fe(t)?t:tu(t)}}function Ve(n,t,r){return Pt(n,r?O:t) +}function Ye(n){return n}function Ze(n){var t=ao(n),r=t.length;if(1==r){var e=t[0],u=n[e];if(Nr(u))return function(n){return null!=n&&u===n[e]&&hu.call(n,e)}}for(var o=r,i=Qe(r),f=Qe(r);o--;){var u=n[t[o]],a=Nr(u);i[o]=a?u:Kt(u,true,Bt),f[o]=a}return function(n){if(o=r,null==n)return!o;for(;o--;)if(f[o]?i[o]!==n[t[o]]:!hu.call(n,t[o]))return false;for(o=r;o--;)if(f[o]?!hu.call(n,t[o]):!ar(i[o],n[t[o]],null,true))return false;return true}}function Ge(n,t,r){var e=true,u=De(t),o=null==r,i=o&&u&&ao(t),f=i&&fr(t,i);(i&&i.length&&!f.length||o&&!u)&&(o&&(r=t),f=false,t=n,n=this),f||(f=fr(t,ao(t))),false===r?e=false:De(r)&&"chain"in r&&(e=r.chain),r=-1,u=Ce(n); +for(o=f.length;++r=q)return r}else n=0;return Gu(r,e)}}(),Qu=xr(function(n,t,r){hu.call(n,r)?++n[r]:n[r]=1}),no=xr(function(n,t,r){hu.call(n,r)?n[r].push(t):n[r]=[t]}),to=xr(function(n,t,r){n[r]=t}),ro=xr(function(n,t,r){n[r?0:1].push(t)},function(){return[[],[]]}),eo=sr(de,W,[2],[]),uo=Du||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&vu.call(n)==gt||false +};Zu.dom||(Re=function(n){return n&&typeof n=="object"&&1===n.nodeType&&!io(n)||false});var oo=$u||function(n){return typeof n=="number"&&Su(n)},io=xu?function(n){if(!n||vu.call(n)!=_t)return false;var t=n.valueOf,r=Se(t)&&(r=xu(t))&&xu(r);return r?n==r||xu(n)==r:qr(n)}:qr,fo=jr(Mt),ao=Tu?function(n){if(n)var t=n.constructor,r=n.length;return typeof t=="function"&&t.prototype===n||typeof r=="number"&&0--n?t.apply(this,arguments):void 0}},Wt.assign=fo,Wt.at=function(n){var t=n?n.length:0;return typeof t=="number"&&-1(s?p(s,i):u(c,i))){for(t=r;--t;){var h=e[t]; +if(0>(h?p(h,i):u(n[t],i)))continue n}s&&s.push(i),c.push(i)}return c},Wt.invert=function(n,t,r){t=r?null:t,r=-1;for(var e=ao(n),u=e.length,o={};++rt?0:t)},Wt.takeRight=function(n,t,r){var e=n?n.length:0;return t=e-((r||null==t?1:t)||0),Gr(n,0>t?0:t)},Wt.takeRightWhile=function(n,t,r){var e=n?n.length:0;for(t=Cr(t,r,3);e--&&t(n[e],e,n););return Gr(n,e+1)},Wt.takeWhile=function(n,t,r){var e=-1,u=n?n.length:0;for(t=Cr(t,r,3);++er?0:+r||0,e))-t.length,0<=r&&n.indexOf(t,r)==r},Wt.escape=function(n){return(n=null==n?"":fu(n))&&(J.lastIndex=0,J.test(n))?n.replace(J,m):n},Wt.escapeRegExp=ze,Wt.every=oe,Wt.find=fe,Wt.findIndex=Kr,Wt.findKey=function(n,t,r){return t=Cr(t,r,3),nr(n,t,or,true)},Wt.findLast=function(n,t,r){return t=Cr(t,r,3),nr(n,t,Xt) +},Wt.findLastIndex=function(n,t,r){var e=n?n.length:0;for(t=Cr(t,r,3);e--;)if(t(n[e],e,n))return e;return-1},Wt.findLastKey=function(n,t,r){return t=Cr(t,r,3),nr(n,t,ir,true)},Wt.findWhere=function(n,t){return fe(n,Ze(t))},Wt.first=Vr,Wt.has=function(n,t){return n?hu.call(n,t):false},Wt.identity=Ye,Wt.indexOf=Yr,Wt.isArguments=Oe,Wt.isArray=uo,Wt.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&vu.call(n)==vt||false},Wt.isDate=function(n){return n&&typeof n=="object"&&vu.call(n)==yt||false +},Wt.isElement=Re,Wt.isEmpty=function(n){if(null==n)return true;var t=n.length;return typeof t=="number"&&-1r?Wu(e+r,0):Nu(r||0,e-1))+1;else if(r)return u=Xr(n,t)-1,n=n[u],(t===t?t===n:n!==n)?u:-1;if(t!==t)return b(n,u,true);for(;u--;)if(n[u]===t)return u;return-1},Wt.max=pe,Wt.min=function(n,t,r){r&&w(n,t,r)&&(t=null);var e=null==t,u=e&&uo(n),o=!u&&Ne(n);if(e&&!o)return Ut(u?n:zr(n));var i=Bu,f=i;return t=e&&o?s:Cr(t,r,3),Jt(n,function(n,r,e){r=t(n,r,e),(rr?0:+r||0,n.length),n.lastIndexOf(t,r)==r},Wt.template=function(n,t,r){var e=Wt.templateSettings; +r&&w(n,t,r)&&(t=r=null),n=fu(null==n?"":n),t=fo({},r||t,e,Lt),r=fo({},t.imports,e.imports,Lt);var u,o,i=ao(r),f=qe(r),a=0;r=t.interpolate||it;var l="__p+='";if(r=iu((t.escape||it).source+"|"+r.source+"|"+(r===Q?nt:it).source+"|"+(t.evaluate||it).source+"|$","g"),n.replace(r,function(t,r,e,i,f,c){return e||(e=i),l+=n.slice(a,c).replace(lt,_),r&&(u=true,l+="'+__e("+r+")+'"),f&&(o=true,l+="';"+f+";\n__p+='"),e&&(l+="'+((__t=("+e+"))==null?'':__t)+'"),a=c+t.length,t}),l+="';",(t=t.variable)||(l="with(obj){"+l+"}"),l=(o?l.replace(V,""):l).replace(Y,"$1").replace(Z,"$1;"),l="function("+(t||"obj")+"){"+(t?"":"obj||(obj={});")+"var __t,__p=''"+(u?",__e=_.escape":"")+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}",t=Ke(function(){return ru(i,"return "+l).apply(O,f) +}),t.source=l,Fe(t))throw t;return t},Wt.trim=Me,Wt.trimLeft=function(n,t,r){return(n=null==n?"":fu(n))?r||null==t?n.slice(A(n)):(t=fu(t),n.slice(h(n,t))):n},Wt.trimRight=function(n,t,r){return(n=null==n?"":fu(n))?r||null==t?n.slice(0,E(n)+1):(t=fu(t),n.slice(0,g(n,t)+1)):n},Wt.trunc=function(n,t,r){t=r?null:t;var e=U;if(r=$,De(t)){var u="separator"in t?t.separator:u,e="length"in t?+t.length||0:e;r="omission"in t?fu(t.omission):r}else null!=t&&(e=+t||0);if(n=null==n?"":fu(n),e>=n.length)return n; +if(e-=r.length,1>e)return r;if(t=n.slice(0,e),null==u)return t+r;if(We(u)){if(n.slice(e).search(u)){var o,i=n.slice(0,e);for(u.global||(u=iu(u.source,(tt.exec(u)||"")+"g")),u.lastIndex=0;n=u.exec(i);)o=n.index;t=t.slice(0,null==o?e:o)}}else n.indexOf(u,e)!=e&&(u=t.lastIndexOf(u),-1t?0:+t||0,n.length),n)},Wt.prototype.sample=function(n,t){return n=t?null:n,this.__chain__||null!=n?this.thru(function(t){return Wt.sample(t,n)}):Wt.sample(this.value())},Wt.VERSION=R,n("bind bindKey curry curryRight partial partialRight".split(" "),function(n){Wt[n].placeholder=Wt}),n(["filter","map","takeWhile"],function(n,t){var r=!t; +ee.prototype[n]=function(t,e){t=Cr(t,e,3);var u=this.clone();return u.filtered=r||u.filtered,u.iteratees.push({iteratee:t,type:$t[n]}),u}}),n(["drop","take"],function(n){var t=n+"Count",r=n+"While";ee.prototype[n]=function(r){r=null==r?1:Wu(+r||0,0);var e=this.clone();return this.filtered?(e[t]=r,e):(e.views.push({size:r,type:n+(0>e.dir?"Right":"")}),e)},ee.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()},ee.prototype[n+"RightWhile"]=function(n,t){var e=this.reverse()[r](n,t); +return e.filtered=true,e.reverse()}}),n(["first","last"],function(n,t){var r="take"+(t?"Right":"");ee.prototype[n]=function(){return this[r](1).value()[0]}}),n(["initial","rest"],function(n,t){var r="drop"+(t?"":"Right");ee.prototype[n]=function(){return this[r](1)}}),ee.prototype.dropWhile=function(n,t){n=Cr(n,t,3);var r,e,u=0>this.dir;return this.filter(function(t,o,i){return r=r&&(u?oe),e=o,r||(r=!n(t,o,i))})},ee.prototype.reject=function(n,t){return n=Cr(n,t,3),this.filter(function(t,r,e){return!n(t,r,e) +})},ee.prototype.slice=function(n,t){n=null==n?0:+n||0;var r=0>n?this.takeRight(-n):this.drop(n);return typeof t!="undefined"&&(t=+t||0,r=0>t?r.dropRight(-t):r.take(t-n)),r},or(ee.prototype,function(n,t){var r=/^(?:first|last)$/.test(t);Wt.prototype[t]=function(){var e=arguments,u=this.__chain__,o=this.__wrapped__,i=o instanceof ee;return r&&!u?i?n.apply(o,e):(u=[this.value()],ju.apply(u,e),Wt[t].apply(Wt,u)):i||uo(o)?(o=n.apply(i?o:new ee(this),e),new re(o,u)):this.thru(function(n){return n=[n],ju.apply(n,e),Wt[t].apply(Wt,n) +})}}),n("concat join pop push shift sort splice unshift".split(" "),function(n){var t=lu[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:join|pop|shift)$/.test(n);Wt.prototype[n]=function(){var n=arguments;return e&&!this.__chain__?t.apply(this.value(),n):this[r](function(r){return t.apply(r,n)})}}),ee.prototype.clone=function(){var n=new ee(this.wrapped);return n.dir=this.dir,n.dropCount=this.dropCount,n.filtered=this.filtered,n.takeCount=this.takeCount,ju.apply(n.iteratees,this.iteratees),ju.apply(n.views,this.views),n +},ee.prototype.reverse=function(){var n=this.filtered,t=n?new ee(this):this.clone();return t.dir=-1*this.dir,t.filtered=n,t},ee.prototype.value=function(){for(var n=this.wrapped.value(),t=n.length,r=0,e=t,u=this.views,o=-1,i=u.length;++ou,r=l?e:r-1,e=this.iteratees,c=e.length,p=0,s=[]; +n:for(;t--&&p=o}return l?s.reverse():s},Wt.prototype.chain=function(){return te(this)},Wt.prototype.reverse=function(){return this.thru(function(n){return n.reverse()})},Wt.prototype.toString=function(){return fu(this.value())},Wt.prototype.toJSON=Wt.prototype.value=Wt.prototype.valueOf=function(){var n=this.__wrapped__;n instanceof ee&&(n=n.value());for(var t=-1,r=this.__queue__,e=r.length;++t"'`]/g,X=/<%-([\s\S]+?)%>/g,H=/<%([\s\S]+?)%>/g,Q=/<%=([\s\S]+?)%>/g,nt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,tt=/\w*$/,rt=/^\s*function[ \n\r\t]+\w/,et=/^0[xX]/,ut=/^\[object .+?Constructor\]$/,ot=/[\xC0-\xD6\xD8-\xDE\xDF-\xF6\xF8-\xFF]/g,it=/($^)/,ft=/[.*+?^${}()|[\]\/\\]/g,at=/\bthis\b/,lt=/['\n\r\u2028\u2029\\]/g,ct=RegExp("[A-Z\\xC0-\\xD6\\xD8-\\xDE]{2,}(?=[A-Z\\xC0-\\xD6\\xD8-\\xDE][a-z\\xDF-\\xF6\\xF8-\\xFF]+)|[A-Z\\xC0-\\xD6\\xD8-\\xDE]?[a-z\\xDF-\\xF6\\xF8-\\xFF]+|[A-Z\\xC0-\\xD6\\xD8-\\xDE]+|[0-9]+","g"),pt=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",st="Array ArrayBuffer Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Math Number Object RegExp Set String _ clearTimeout document isFinite parseInt setTimeout TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap window WinRTError".split(" "),ht="[object Arguments]",gt="[object Array]",vt="[object Boolean]",yt="[object Date]",dt="[object Error]",mt="[object Number]",_t="[object Object]",bt="[object RegExp]",wt="[object String]",xt="[object ArrayBuffer]",jt="[object Float32Array]",At="[object Float64Array]",Et="[object Int8Array]",It="[object Int16Array]",kt="[object Int32Array]",Ot="[object Uint8Array]",Rt="[object Uint8ClampedArray]",Ft="[object Uint16Array]",Ct="[object Uint32Array]",Dt={}; +Dt[ht]=Dt[gt]=Dt[jt]=Dt[At]=Dt[Et]=Dt[It]=Dt[kt]=Dt[Ot]=Dt[Rt]=Dt[Ft]=Dt[Ct]=true,Dt[xt]=Dt[vt]=Dt[yt]=Dt[dt]=Dt["[object Function]"]=Dt["[object Map]"]=Dt[mt]=Dt[_t]=Dt[bt]=Dt["[object Set]"]=Dt[wt]=Dt["[object WeakMap]"]=false;var St={};St[ht]=St[gt]=St[xt]=St[vt]=St[yt]=St[jt]=St[At]=St[Et]=St[It]=St[kt]=St[mt]=St[_t]=St[bt]=St[wt]=St[Ot]=St[Rt]=St[Ft]=St[Ct]=true,St[dt]=St["[object Function]"]=St["[object Map]"]=St["[object Set]"]=St["[object WeakMap]"]=false;var Tt={leading:false,maxWait:0,trailing:false},Wt={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss"},Nt={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Ut={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},$t={filter:z,map:B,takeWhile:3},qt={"function":true,object:true},Lt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},zt=qt[typeof window]&&window||this,Bt=qt[typeof exports]&&exports&&!exports.nodeType&&exports,Mt=qt[typeof module]&&module&&!module.nodeType&&module,Pt=Bt&&Mt&&typeof global=="object"&&global; +!Pt||Pt.global!==Pt&&Pt.window!==Pt&&Pt.self!==Pt||(zt=Pt);var Kt=Mt&&Mt.exports===Bt&&Bt,Vt=k();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(zt._=Vt, define(function(){return Vt})):Bt&&Mt?Kt?(Mt.exports=Vt)._=Vt:Bt._=Vt:zt._=Vt}).call(this); \ No newline at end of file diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index 6f98fc92e..1c579c033 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -26,20 +26,9 @@ CURRY_BOUND_FLAG = 16, PARTIAL_FLAG = 32; - /** Used as the TypeError message for "Functions" methods */ + /** Used as the `TypeError` message for "Functions" methods */ var FUNC_ERROR_TEXT = 'Expected a function'; - /** Used as references for the max length and index of an array */ - var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1, - MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1; - - /** - * Used as the maximum length of an array-like value. - * See the [ES6 spec](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength) - * for more details. - */ - var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; - /** Used as the internal argument placeholder */ var PLACEHOLDER = '__lodash_placeholder__'; @@ -224,26 +213,6 @@ return true; } - /** - * A specialized version of `_.map` for arrays without support for callback - * shorthands or `this` binding. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the new mapped array. - */ - function arrayMap(array, iteratee) { - var index = -1, - length = array.length, - result = Array(length); - - while (++index < length) { - result[index] = iteratee(array[index], index, array); - } - return result; - } - /** * A specialized version of `_.filter` for arrays without support for callback * shorthands or `this` binding. @@ -268,6 +237,26 @@ return result; } + /** + * A specialized version of `_.map` for arrays without support for callback + * shorthands or `this` binding. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ + function arrayMap(array, iteratee) { + var index = -1, + length = array.length, + result = Array(length); + + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; + } + /** * A specialized version of `_.reduce` for arrays without support for callback * shorthands or `this` binding. @@ -374,9 +363,6 @@ * @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 || 0) - 1, length = array.length; @@ -443,29 +429,6 @@ return '\\' + stringEscapes[chr]; } - /** - * Gets the index at which the first occurrence of `NaN` is found in `array`. - * If `fromRight` is provided elements of `array` are iterated from right to left. - * - * @private - * @param {Array} array The array to search. - * @param {number} [fromIndex] The index to search from. - * @param {boolean} [fromRight=false] 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 = fromRight ? (fromIndex || length) : ((fromIndex || 0) - 1); - - while ((fromRight ? index-- : ++index < length)) { - var other = array[index]; - if (other !== other) { - return index; - } - } - return -1; - } - /** * Checks if the provided arguments are from an iteratee call. * @@ -587,6 +550,21 @@ nativeNow = isNative(nativeNow = Date.now) && nativeNow, nativeRandom = Math.random; + /** Used as references for `-Infinity` and `Infinity` */ + var NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY, + POSITIVE_INFINITY = Number.POSITIVE_INFINITY; + + /** Used as references for the max length and index of an array */ + var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1, + MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1; + + /** + * Used as the maximum length of an array-like value. + * See the [ES6 spec](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength) + * for more details. + */ + var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; + /*------------------------------------------------------------------------*/ /** @@ -660,21 +638,7 @@ function lodash(value) { return (value instanceof lodash) ? value - : new lodashWrapper(value); - } - - /** - * A fast path for creating `lodash` wrapper objects. - * - * @private - * @param {*} value The value to wrap in a `lodash` instance. - * @param {boolean} [chainAll=false] Enable chaining for all methods. - * @param {Array} [queue=[]] Actions to peform to resolve the unwrapped value. - * @returns {Object} Returns a `lodash` instance. - */ - function lodashWrapper(value, chainAll) { - this.__chain__ = !!chainAll; - this.__wrapped__ = value; + : new LodashWrapper(value); } /** @@ -752,6 +716,48 @@ /*------------------------------------------------------------------------*/ + /** + * A specialized version of `_.max` for arrays without support for iteratees. + * + * @private + * @param {Array} array The array to iterate over. + * @returns {*} Returns the maximum value. + */ + function arrayMax(array) { + var index = -1, + length = array.length, + result = NEGATIVE_INFINITY; + + while (++index < length) { + var value = array[index]; + if (value > result) { + result = value; + } + } + return result; + } + + /** + * A specialized version of `_.min` for arrays without support for iteratees. + * + * @private + * @param {Array} array The array to iterate over. + * @returns {*} Returns the minimum value. + */ + function arrayMin(array) { + var index = -1, + length = array.length, + result = POSITIVE_INFINITY; + + while (++index < length) { + var value = array[index]; + if (value < result) { + result = value; + } + } + return result; + } + /** * The base implementation of `_.assign` without support for argument juggling, * multiple sources, and `this` binding. @@ -801,7 +807,7 @@ * "_.pluck" and "_.where" style callbacks. * * @private - * @param {*} [func=identity] The value to convert to a callback. + * @param {*} [func=_.identity] The value to convert to a callback. * @param {*} [thisArg] The `this` binding of the created callback. * @param {number} [argCount] The number of arguments the callback accepts. * @returns {Function} Returns the new function. @@ -960,8 +966,8 @@ } /** - * The base implementation of `_.filter` without support for callback shorthands - * or `this` binding. + * The base implementation of `_.filter` without support for callback + * shorthands or `this` binding. * * @private * @param {Array|Object|string} collection The collection to iterate over. @@ -1330,6 +1336,7 @@ * @param {Function} func The function to partially apply arguments to. * @param {number} bitmask The bitmask of flags to compose. * @param {Array} args The arguments to be partially applied. + * @param {Array} holders The `args` placeholder indexes. * @param {*} [thisArg] The `this` binding of `func`. * @returns {Function} Returns the new partially applied function. */ @@ -1566,7 +1573,7 @@ * @private * @param {Function} func The function to bind. * @param {*} [thisArg] The `this` binding of `func`. - * @returns {Function} Returns the new wrapped function. + * @returns {Function} Returns the new bound function. */ function createBindWrapper(func, thisArg) { var Ctor = createCtorWrapper(func); @@ -1583,7 +1590,7 @@ * * @private * @param {Function} Ctor The constructor to wrap. - * @returns {Function} Returns the new function. + * @returns {Function} Returns the new wrapped function. */ function createCtorWrapper(Ctor) { return function() { @@ -1609,7 +1616,7 @@ * @param {Array} [partialHolders] The `partialArgs` placeholder indexes. * @param {Array} [partialRightArgs] The arguments to append to those provided to the new function. * @param {Array} [partialRightHolders] The `partialRightArgs` placeholder indexes. - * @returns {Function} Returns the new function. + * @returns {Function} Returns the new wrapped function. */ function createHybridWrapper(func, bitmask, arity, thisArg, partialArgs, partialHolders, partialRightArgs, partialRightHolders) { var isBind = bitmask & BIND_FLAG, @@ -1695,7 +1702,7 @@ * @param {Array} [partialHolders] The `partialArgs` placeholder indexes. * @param {Array} [partialRightArgs] The arguments to append to those provided to the new function. * @param {Array} [partialRightHolders] The `partialRightArgs` placeholder indexes. - * @returns {Function} Returns the new function. + * @returns {Function} Returns the new wrapped function. */ function createWrapper(func, bitmask, arity, thisArg, partialArgs, partialHolders, partialRightArgs, partialRightHolders) { var isBindKey = bitmask & BIND_KEY_FLAG; @@ -1868,8 +1875,9 @@ * Creates an array excluding all values of the provided arrays using * `SameValueZero` for equality comparisons. * - * **Note:** `SameValueZero` is like strict equality, e.g. `===`, except that - * `NaN` matches `NaN`. See the [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * **Note:** `SameValueZero` comparisons are like strict equality comparisons, + * e.g. `===`, except that `NaN` matches `NaN`. See the + * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for more details. * * @static @@ -1938,7 +1946,7 @@ * @memberOf _ * @category Array * @param {Array} array The array to search. - * @param {Function|Object|string} [predicate=identity] The function invoked + * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. @@ -2032,8 +2040,9 @@ * it is used as the offset from the end of the collection. If `array` is * sorted providing `true` for `fromIndex` performs a faster binary search. * - * **Note:** `SameValueZero` is like strict equality, e.g. `===`, except that - * `NaN` matches `NaN`. See the [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * **Note:** `SameValueZero` comparisons are like strict equality comparisons, + * e.g. `===`, except that `NaN` matches `NaN`. See the + * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for more details. * * @static @@ -2065,8 +2074,10 @@ if (typeof fromIndex == 'number') { fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0); } else if (fromIndex) { - var index = sortedIndex(array, value); - return array[index] === value ? index : -1; + var index = sortedIndex(array, value), + other = array[index]; + + return value === other ? index : -1; } return baseIndexOf(array, value, fromIndex); } @@ -2097,8 +2108,9 @@ * Creates an array of unique values present in all provided arrays using * `SameValueZero` for equality comparisons. * - * **Note:** `SameValueZero` is like strict equality, e.g. `===`, except that - * `NaN` matches `NaN`. See the [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * **Note:** `SameValueZero` comparisons are like strict equality comparisons, + * e.g. `===`, except that `NaN` matches `NaN`. See the + * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for more details. * * @static @@ -2201,9 +2213,6 @@ if (typeof fromIndex == 'number') { index = (fromIndex < 0 ? nativeMax(length + fromIndex, 0) : nativeMin(fromIndex || 0, length - 1)) + 1; } - if (value !== value) { - return indexOfNaN(array, index, true); - } while (index--) { if (array[index] === value) { return index; @@ -2297,7 +2306,7 @@ * @category Array * @param {Array} array The array to inspect. * @param {*} value The value to evaluate. - * @param {Function|Object|string} [iteratee=identity] The function invoked + * @param {Function|Object|string} [iteratee=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. @@ -2359,8 +2368,9 @@ * Creates an array of unique values, in order, of the provided arrays using * `SameValueZero` for equality comparisons. * - * **Note:** `SameValueZero` is like strict equality, e.g. `===`, except that - * `NaN` matches `NaN`. See the [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * **Note:** `SameValueZero` comparisons are like strict equality comparisons, + * e.g. `===`, except that `NaN` matches `NaN`. See the + * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for more details. * * @static @@ -2392,8 +2402,9 @@ * returns `true` for elements that have the properties of the given object, * else `false`. * - * **Note:** `SameValueZero` is like strict equality, e.g. `===`, except that - * `NaN` matches `NaN`. See the [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * **Note:** `SameValueZero` comparisons are like strict equality comparisons, + * e.g. `===`, except that `NaN` matches `NaN`. See the + * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for more details. * * @static @@ -2476,8 +2487,9 @@ * Creates an array excluding all provided values using `SameValueZero` for * equality comparisons. * - * **Note:** `SameValueZero` is like strict equality, e.g. `===`, except that - * `NaN` matches `NaN`. See the [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * **Note:** `SameValueZero` comparisons are like strict equality comparisons, + * e.g. `===`, except that `NaN` matches `NaN`. See the + * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for more details. * * @static @@ -2530,25 +2542,25 @@ * @alias object * @category Array * @param {Array} props The property names. - * @param {Array} [vals=[]] The property values. + * @param {Array} [values=[]] The property values. * @returns {Object} Returns the new object. * @example * * _.zipObject(['fred', 'barney'], [30, 40]); * // => { 'fred': 30, 'barney': 40 } */ - function zipObject(props, vals) { + function zipObject(props, values) { var index = -1, length = props ? props.length : 0, result = {}; - if (!vals && length && !isArray(props[0])) { - vals = []; + if (!values && length && !isArray(props[0])) { + values = []; } while (++index < length) { var key = props[index]; - if (vals) { - result[key] = vals[index]; + if (values) { + result[key] = values[index]; } else if (key) { result[key[0]] = key[1]; } @@ -2566,7 +2578,7 @@ * @memberOf _ * @category Chain * @param {*} value The value to wrap. - * @returns {Object} Returns the new wrapper object. + * @returns {Object} Returns the new `LodashWrapper` object. * @example * * var users = [ @@ -2614,13 +2626,29 @@ return value; } + /*------------------------------------------------------------------------*/ + + /** + * A fast path for creating `lodash` wrapper objects. + * + * @private + * @param {*} value The value to wrap. + * @param {boolean} [chainAll=false] Enable chaining for all methods. + * @param {Array} [queue=[]] Actions to peform to resolve the unwrapped value. + * @returns {Object} Returns a `LodashWrapper` instance. + */ + function LodashWrapper(value, chainAll) { + this.__chain__ = !!chainAll; + this.__wrapped__ = value; + } + /** * Enables explicit method chaining on the wrapper object. * * @name chain * @memberOf _ * @category Chain - * @returns {*} Returns the wrapper object. + * @returns {*} Returns the `LodashWrapper` object. * @example * * var users = [ @@ -2663,12 +2691,13 @@ /*------------------------------------------------------------------------*/ /** - * Checks if `value` is present in `collection` using `SameValueZero` for + * Checks if `value` is present in `collection` using `SameValueZero` for * equality comparisons. If `fromIndex` is negative, it is used as the offset * from the end of the collection. * - * **Note:** `SameValueZero` is like strict equality, e.g. `===`, except that - * `NaN` matches `NaN`. See the [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * **Note:** `SameValueZero` comparisons are like strict equality comparisons, + * e.g. `===`, except that `NaN` matches `NaN`. See the + * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for more details. * * @static @@ -2721,7 +2750,7 @@ * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [iteratee=identity] The function invoked + * @param {Function|Object|string} [iteratee=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. @@ -2758,7 +2787,7 @@ * @alias all * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=identity] The function invoked + * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. @@ -2807,7 +2836,7 @@ * @alias select * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=identity] The function invoked + * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. @@ -2854,7 +2883,7 @@ * @alias detect * @category Collection * @param {Array|Object|string} collection The collection to search. - * @param {Function|Object|string} [predicate=identity] The function invoked + * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. @@ -2932,7 +2961,7 @@ * @alias each * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} [iteratee=identity] The function invoked per iteration. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Array|Object|string} Returns `collection`. * @example @@ -2967,7 +2996,7 @@ * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [iteratee=identity] The function invoked + * @param {Function|Object|string} [iteratee=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. @@ -3010,7 +3039,7 @@ * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [iteratee=identity] The function invoked + * @param {Function|Object|string} [iteratee=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. @@ -3078,7 +3107,7 @@ * @alias collect * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [iteratee=identity] The function invoked + * @param {Function|Object|string} [iteratee=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. @@ -3151,33 +3180,25 @@ * // => { 'user': 'fred', 'age': 40 }; */ function max(collection, iteratee, thisArg) { - iteratee = isIterateeCall(collection, iteratee, thisArg) ? null : iteratee; - - var computed = -Infinity, - result = computed; + if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { + iteratee = null; + } if (iteratee == null) { - var index = -1, - iterable = toIterable(collection), - length = iterable.length; - - while (++index < length) { - var value = iterable[index]; - if (value > result) { - result = value; - } - } - } else { - iteratee = baseCallback(iteratee, thisArg, 3); - - baseEach(collection, function(value, index, collection) { - var current = iteratee(value, index, collection); - if (current > computed || (current === -Infinity && current === result)) { - computed = current; - result = value; - } - }); + return arrayMax(isArray(collection) ? collection : toIterable(collection)); } + var computed = NEGATIVE_INFINITY, + result = computed; + + iteratee = baseCallback(iteratee, thisArg, 3); + + baseEach(collection, function(value, index, collection) { + var current = iteratee(value, index, collection); + if (current > computed || (current === NEGATIVE_INFINITY && current === result)) { + computed = current; + result = value; + } + }); return result; } @@ -3225,33 +3246,25 @@ * // => { 'user': 'barney', 'age': 36 }; */ function min(collection, iteratee, thisArg) { - iteratee = isIterateeCall(collection, iteratee, thisArg) ? null : iteratee; - - var computed = Infinity, - result = computed; + if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { + iteratee = null; + } if (iteratee == null) { - var index = -1, - iterable = toIterable(collection), - length = iterable.length; - - while (++index < length) { - var value = iterable[index]; - if (value < result) { - result = value; - } - } - } else { - iteratee = baseCallback(iteratee, thisArg, 3); - - baseEach(collection, function(value, index, collection) { - var current = iteratee(value, index, collection); - if (current < computed || (current === Infinity && current === result)) { - computed = current; - result = value; - } - }); + return arrayMin(isArray(collection) ? collection : toIterable(collection)); } + var computed = POSITIVE_INFINITY, + result = computed; + + iteratee = baseCallback(iteratee, thisArg, 3); + + baseEach(collection, function(value, index, collection) { + var current = iteratee(value, index, collection); + if (current < computed || (current === POSITIVE_INFINITY && current === result)) { + computed = current; + result = value; + } + }); return result; } @@ -3272,7 +3285,7 @@ * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=identity] The function invoked + * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. @@ -3343,7 +3356,7 @@ * @alias foldl, inject * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} [iteratee=identity] The function invoked per iteration. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [accumulator] The initial value. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {*} Returns the accumulated value. @@ -3372,7 +3385,7 @@ * @alias foldr * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} [iteratee=identity] The function invoked per iteration. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [accumulator] The initial value. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {*} Returns the accumulated value. @@ -3402,7 +3415,7 @@ * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=identity] The function invoked + * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. @@ -3540,7 +3553,7 @@ * @alias any * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [predicate=identity] The function invoked + * @param {Function|Object|string} [predicate=_.identity] The function invoked * per iteration. If a property name or object is provided it is used to * create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. @@ -3593,7 +3606,7 @@ * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Array|Function|Object|string} [iteratee=identity] The function + * @param {Array|Function|Object|string} [iteratee=_.identity] The function * invoked per iteration. If property name(s) or an object is provided it * is used to create a "_.pluck" or "_.where" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. @@ -3622,8 +3635,9 @@ * // = > [['barney', 26], ['barney', 36], ['fred', 30], ['fred', 40]] */ function sortBy(collection, iteratee, thisArg) { - iteratee = isIterateeCall(collection, iteratee, thisArg) ? null : iteratee; - + if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { + iteratee = null; + } var index = -1, length = collection ? collection.length : 0, result = []; @@ -4117,9 +4131,16 @@ * Creates a function that memoizes the result of `func`. If `resolver` is * provided it determines the cache key for storing the result based on the * arguments provided to the memoized function. By default, the first argument - * provided to the memoized function is used as the cache key. The `func` is - * invoked with the `this` binding of the memoized function. The result cache - * is exposed as the `cache` property on the memoized function. + * provided to the memoized function is coerced to a string and used as the + * cache key. The `func` is invoked with the `this` binding of the memoized + * function. + * + * **Note:** The cache is exposed as the `cache` property on the memoized + * function. Its creation may be customized by replacing the `_.memoize.Cache` + * constructor with one whose instances implement the ES6 `Map` method interface + * of `get`, `has`, and `set`. See the + * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-map-prototype-object) + * for more details. * * @static * @memberOf _ @@ -4144,7 +4165,7 @@ * upperCase('fred'); * // => 'FRED' * - * upperCase.cache.fred = 'BARNEY' + * upperCase.cache.set('fred, 'BARNEY'); * upperCase('fred'); * // => 'BARNEY' */ @@ -4212,7 +4233,7 @@ * initialize(); * // `initialize` invokes `createApplication` once */ - var once = partial(before, 2); + var once = basePartial(before,PARTIAL_FLAG, [2], []); /** * Creates a function that invokes `func` with `partial` arguments prepended @@ -4334,10 +4355,11 @@ * cloning is handled by the method instead. The `customizer` is bound to * `thisArg` and invoked with two argument; (value, index|key). * - * **Note:** This method is loosely based on the structured clone algorithm. Functions - * and DOM nodes are **not** cloned. The enumerable properties of `arguments` objects and - * objects created by constructors other than `Object` are cloned to plain `Object` objects. - * See the [HTML5 specification](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm) + * **Note:** This method is loosely based on the structured clone algorithm. + * The enumerable properties of `arguments` objects and objects created by + * constructors other than `Object` are cloned to plain `Object` objects. An + * empty object is returned for uncloneable values such as functions, DOM nodes, + * Maps, Sets, and WeakMaps. See the [HTML5 specification](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm) * for more details. * * @static @@ -4386,7 +4408,7 @@ * @memberOf _ * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * (function() { return _.isArguments(arguments); })(); @@ -4886,7 +4908,7 @@ index = 0, length = args.length; - if (isIterateeCall(args[1], args[2], args[3])) { + if (length > 3 && isIterateeCall(args[1], args[2], args[3])) { length = 2; } while (++index < length) { @@ -4922,7 +4944,7 @@ index = 0, length = args.length; - if (isIterateeCall(args[1], args[2], args[3])) { + if (length > 3 && isIterateeCall(args[1], args[2], args[3])) { length = 2; } while (++index < length) { @@ -4964,7 +4986,7 @@ * @category Object * @param {Object} object The object to inspect. * @param {string} key The name of the property to check. - * @returns {boolean} Returns `true` if key is a direct property, else `false`. + * @returns {boolean} Returns `true` if `key` is a direct property, else `false`. * @example * * _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); @@ -5465,7 +5487,7 @@ * @memberOf _ * @alias iteratee * @category Utility - * @param {*} [func=identity] The value to convert to a callback. + * @param {*} [func=_.identity] The value to convert to a callback. * @param {*} [thisArg] The `this` binding of the created callback. * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. * @returns {Function} Returns the new function. @@ -5630,7 +5652,7 @@ push.apply(args, arguments); var result = func.apply(lodash, args); - return this.__chain__ ? new lodashWrapper(result, true) : result; + return this.__chain__ ? new LodashWrapper(result, true) : result; }; }()); } @@ -5759,7 +5781,7 @@ /** * Creates an array of numbers (positive and/or negative) progressing from - * `start` up to but not including `end`. If `start` is less than `stop` a + * `start` up to but not including `end`. If `start` is less than `end` a * zero-length range is created unless a negative `step` is specified. * * @static @@ -5864,7 +5886,7 @@ * @memberOf _ * @category Utility * @param {number} n The number of times to invoke `iteratee`. - * @param {Function} [iteratee=identity] The function invoked per iteration. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Array} Returns the array of results. * @example @@ -5918,6 +5940,9 @@ /*------------------------------------------------------------------------*/ + // ensure `new LodashWrapper` is an instance of `lodash` + LodashWrapper.prototype = lodash.prototype; + // add functions that return wrapped values when chaining lodash.after = after; lodash.before = before; @@ -6063,17 +6088,10 @@ */ lodash.VERSION = VERSION; - // ensure `new lodashWrapper` is an instance of `lodash` - lodashWrapper.prototype = lodash.prototype; - - // add "Chaining" functions to the wrapper - lodash.prototype.chain = wrapperChain; - lodash.prototype.value = wrapperValueOf; - // assign default placeholders partial.placeholder = lodash; - // add `Array.prototype` functions + // add `Array.prototype` functions to `LodashWrapper` arrayEach(['concat', 'join', 'pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(methodName) { var func = arrayProto[methodName], retValue = !/^(?:concat|join|slice)$/.test(methodName), @@ -6091,10 +6109,16 @@ if (retValue) { result = value; } - return this.__chain__ ? new lodashWrapper(result, true) : result; + return this.__chain__ ? new LodashWrapper(result, true) : result; }; }); + // add chaining functions to the lodash wrapper + lodash.prototype.chain = wrapperChain; + lodash.prototype.value = wrapperValueOf; + + lodash.prototype.tail = lodash.prototype.rest; + /*--------------------------------------------------------------------------*/ // some AMD build optimizers like r.js check for condition patterns like the following: diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index 7f368f0cf..e6104f16e 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -3,45 +3,44 @@ * Lo-Dash 3.0.0-pre (Custom Build) lodash.com/license | Underscore.js 1.7.0 underscorejs.org/LICENSE * Build: `lodash underscore -o ./dist/lodash.underscore.js` */ -;(function(){function n(n,r){for(var t=-1,e=n.length;++te||!u||typeof t=="undefined"&&o){t=1;break n}if(tu(r,i)&&o.push(i)}return o}function _(n,r){var t=n?n.length:0;if(typeof t!="number"||-1>=t||t>Cr)return E(n,r,Vt); -for(var e=-1,u=J(n);++e=t||t>Cr){for(var t=J(n),e=Vt(n),u=e.length;u--;){var o=e[u];if(r(t[o],o,t)===Br)break}return n}for(e=J(n);t--&&r(e[t],t,e)!==Br;);return n}function w(n,r){var t=true;return _(n,function(n,e,u){return(t=!!r(n,e,u))||Br}),t}function A(n,r){var t=[];return _(n,function(n,e,u){r(n,e,u)&&t.push(n)}),t}function x(n,r,t){var e;return t(n,function(n,t,u){return r(n,t,u)?(e=n,Br):void 0}),e}function T(n,r,t,e){e=(e||0)-1; -for(var u=n.length,o=-1,i=[];++ee(i,a)&&(r&&i.push(a),o.push(f))}return o}function N(n,r){return function(t,e,u){e=m(e,u,3);var o=r?r():{};if(Pt(t)){u=-1; -for(var i=t.length;++ur?0:r) -}function L(n,r,t){var e=n?n.length:0;if(!e)return-1;if(typeof t=="number")t=0>t?Ft(e+t,0):t||0;else if(t)return t=Y(n,r),n[t]===r?t:-1;return f(n,r,t)}function Q(n,r,t){return X(n,null==r||t?1:0>r?0:r)}function X(n,r,t){var e=-1,u=n?n.length:0,o=typeof t;if(t&&"number"!=o&&h(n,r,t)&&(r=0,t=u),r=null==r?0:+r||0,0>r&&(r=-r>u?0:u+r),t="undefined"==o||t>u?u:+t||0,0>t&&(t+=u),t&&t==u&&!r)return a(n);for(u=r>t?0:t-r,t=Array(u);++eu&&(u=i)}}else r=m(r,t,3),_(n,function(n,t,o){t=r(n,t,o),(t>e||-1/0===t&&t===u)&&(e=t,u=n)});return u}function ar(n,r){return ir(n,$r(r))}function cr(n,r,t,e){return(Pt(n)?u:$)(n,m(r,e,4),t,3>arguments.length,_)}function lr(n,r,t,e){return(Pt(n)?o:$)(n,m(r,e,4),t,3>arguments.length,j)}function pr(n){n=H(n);for(var r=-1,t=n.length,e=Array(t);++r=t||t>r?(f&&clearTimeout(f),t=s,f=p=s=qr,t&&(h=Gt(),a=n.apply(l,i),p||f||(i=l=null))):p=setTimeout(e,t)}function u(){p&&clearTimeout(p),f=p=s=qr,(v||g!==r)&&(h=Gt(),a=n.apply(l,i),p||f||(i=l=null)) -}function o(){if(i=arguments,c=Gt(),l=this,s=v&&(p||!y),false===g)var t=y&&!p;else{f||y||(h=c);var o=g-(c-h),m=0>=o||o>g;m?(f&&(f=clearTimeout(f)),h=c,a=n.apply(l,i)):f||(f=setTimeout(u,o))}return m&&p?p=clearTimeout(p):p||r===g||(p=setTimeout(e,r)),t&&(m=true,a=n.apply(l,i)),!m||p||f||(i=l=null),a}var i,f,a,c,l,p,s,h=0,g=false,v=true;if(!br(n))throw new TypeError(Wr);if(r=0>r?0:r,true===t)var y=true,v=false;else dr(t)&&(y=t.leading,g="maxWait"in t&&Ft(+t.maxWait||0,r),v="trailing"in t?t.trailing:v);return o.cancel=function(){p&&clearTimeout(p),f&&clearTimeout(f),f=p=s=qr -},o}function vr(n){for(var r=X(arguments,1),t=r,e=vr.placeholder,u=-1,o=t.length,i=-1,f=[];++u"'`]/g,Jr=/^\[object .+?Constructor\]$/,Kr=/($^)/,Lr=/[.*+?^${}()|[\]\/\\]/g,Qr=/['\n\r\u2028\u2029\\]/g,Xr="[object Arguments]",Yr="[object Boolean]",Zr="[object Date]",nt="[object Error]",rt="[object Number]",tt="[object Object]",et="[object RegExp]",ut="[object String]",ot={}; -ot[Xr]=ot["[object Array]"]=ot["[object Float32Array]"]=ot["[object Float64Array]"]=ot["[object Int8Array]"]=ot["[object Int16Array]"]=ot["[object Int32Array]"]=ot["[object Uint8Array]"]=ot["[object Uint8ClampedArray]"]=ot["[object Uint16Array]"]=ot["[object Uint32Array]"]=true,ot["[object ArrayBuffer]"]=ot[Yr]=ot[Zr]=ot[nt]=ot["[object Function]"]=ot["[object Map]"]=ot[rt]=ot[tt]=ot[et]=ot["[object Set]"]=ot[ut]=ot["[object WeakMap]"]=false;var it={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},ft={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},at={"function":true,object:true},ct={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},lt=at[typeof window]&&window||this,pt=at[typeof exports]&&exports&&!exports.nodeType&&exports,st=at[typeof module]&&module&&!module.nodeType&&module,ht=pt&&st&&typeof global=="object"&&global; -!ht||ht.global!==ht&&ht.window!==ht&&ht.self!==ht||(lt=ht);var gt=st&&st.exports===pt&&pt,vt=Array.prototype,yt=Object.prototype,mt=Function.prototype.toString,bt=yt.hasOwnProperty,dt=lt._,_t=yt.toString,jt=RegExp("^"+function(n){return(n=null==n?"":n+"")&&(Lr.lastIndex=0,Lr.test(n))?n.replace(Lr,"\\$&"):n}(_t).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),wt=Math.ceil,At=Math.floor,xt=vt.push,Tt=yt.propertyIsEnumerable,Et=vt.splice,Ot=_r(Ot=Object.create)&&Ot,kt=_r(kt=Array.isArray)&&kt,St=lt.isFinite,It=_r(It=Object.keys)&&It,Ft=Math.max,Mt=Math.min,$t=_r($t=Date.now)&&$t,qt=Math.random,Bt={}; -!function(){var n={0:1,length:1};Bt.spliceObjects=(Et.call(n,0,1),!n[0])}(0,0),v.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},Ot||(b=function(){function n(){}return function(r){if(dr(r)){n.prototype=r;var t=new n;n.prototype=null}return t||lt.Object()}}());var Nt=Q,Rt=K,Ut=N(function(n,r,t){bt.call(n,t)?++n[t]:n[t]=1}),Wt=N(function(n,r,t){bt.call(n,t)?n[t].push(r):n[t]=[r]}),Dt=N(function(n,r,t){n[t]=r}),zt=N(function(n,r,t){n[t?0:1].push(r) -},function(){return[[],[]]}),Ct=vr(hr,2);yr(arguments)||(yr=function(n){var r=n&&typeof n=="object"?n.length:qr;return typeof r=="number"&&-1--n?r.apply(this,arguments):void 0}},v.before=hr,v.bind=function(n,r){return 3>arguments.length?z(n,Nr,r):F(n,Nr|Ur,X(arguments,2),[],r)},v.bindAll=function(n){for(var r=n,t=1r?0:r)},v.intersection=function(){for(var n=[],r=-1,t=arguments.length;++ri(a,e)){for(r=t;--r;)if(0>i(n[r],e))continue n;a.push(e)}return a},v.invert=function(n){for(var r=-1,t=Vt(n),e=t.length,u={};++rt)return function(){};if(!r(n,br))throw new TypeError(Wr);return function(){for(var r=t,e=n[r].apply(this,arguments);r--;)e=n[r].call(this,e);return e}},v.each=or,v.extend=Ar,v.iteratee=function(n,r,t){return m(n,t?qr:r)},v.methods=Tr,v.object=function(n,r){var t=-1,e=n?n.length:0,u={};for(r||!e||Pt(n[0])||(r=[]);++tr?0:r))},v.lastIndexOf=function(n,r,t){var e=n?n.length:0;if(!e)return-1;var u=e;if(typeof t=="number"&&(u=(0>t?Ft(e+t,0):Mt(t||0,e-1))+1),r!==r)return s(n,u,true);for(;u--;)if(n[u]===r)return u;return-1},v.max=fr,v.min=function(n,r,t){r=h(n,r,t)?null:r;var e=1/0,u=e;if(null==r){t=-1,n=H(n);for(var o=n.length;++tr?0:+r||0,n.length),n)},Mr(Ar({},v)),v.VERSION="3.0.0-pre",y.prototype=v.prototype,v.prototype.chain=function(){return nr(this) -},v.prototype.value=function(){return this.__wrapped__},vr.placeholder=v,n("concat join pop push reverse shift sort splice unshift".split(" "),function(n){var r=vt[n],t=!/^(?:concat|join|slice)$/.test(n),e=!Bt.spliceObjects&&/^(?:pop|shift|splice)$/.test(n);v.prototype[n]=function(){var n=this.__wrapped__,u=r.apply(n,arguments);return e&&0===n.length&&delete n[0],t&&(u=n),this.__chain__?new y(u,true):u}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(lt._=v, define("underscore",function(){return v -})):pt&&st?gt?(st.exports=v)._=v:pt._=v:lt._=v}).call(this); \ No newline at end of file +;(function(){function n(n,r){for(var t=-1,e=n.length;++te||!u||typeof t=="undefined"&&o){t=1;break n}if(te&&(e=u)}return e}function y(n){for(var r=-1,t=n.length,e=$t;++ru(r,i)&&o.push(i)}return o}function _(n,r){var t=n?n.length:0;if(typeof t!="number"||-1>=t||t>Rt)return E(n,r,Ht); +for(var e=-1,u=H(n);++e=t||t>Rt){for(var t=H(n),e=Ht(n),u=e.length;u--;){var o=e[u];if(r(t[o],o,t)===Br)break}return n}for(e=H(n);t--&&r(e[t],t,e)!==Br;);return n}function w(n,r){var t=true;return _(n,function(n,e,u){return(t=!!r(n,e,u))||Br}),t}function A(n,r){var t=[];return _(n,function(n,e,u){r(n,e,u)&&t.push(n)}),t}function x(n,r,t){var e;return t(n,function(n,t,u){return r(n,t,u)?(e=n,Br):void 0}),e}function T(n,r,t,e){e=(e||0)-1; +for(var u=n.length,o=-1,i=[];++ee(i,a)&&(r&&i.push(a),o.push(f))}return o}function B(n,r){return function(t,e,u){e=m(e,u,3);var o=r?r():{};if(Gt(t)){u=-1; +for(var i=t.length;++ur?0:r) +}function K(n,r,t){var e=n?n.length:0;if(!e)return-1;if(typeof t=="number")t=0>t?kt(e+t,0):t||0;else if(t)return t=X(n,r),r===n[t]?t:-1;return f(n,r,t)}function L(n,r,t){return Q(n,null==r||t?1:0>r?0:r)}function Q(n,r,t){var e=-1,u=n?n.length:0,o=typeof t;if(t&&"number"!=o&&s(n,r,t)&&(r=0,t=u),r=null==r?0:+r||0,0>r&&(r=-r>u?0:u+r),t="undefined"==o||t>u?u:+t||0,0>t&&(t+=u),t&&t==u&&!r)return a(n);for(u=r>t?0:t-r,t=Array(u);++ee||t===Mt&&t===u)&&(e=t,u=n)}),u}function cr(n,r){return fr(n,$r(r))}function lr(n,r,t,e){return(Gt(n)?u:M)(n,m(r,e,4),t,3>arguments.length,_)}function pr(n,r,t,e){return(Gt(n)?o:M)(n,m(r,e,4),t,3>arguments.length,j)}function sr(n){n=G(n);for(var r=-1,t=n.length,e=Array(t);++r=t||t>r?(f&&clearTimeout(f),t=s,f=p=s=qr,t&&(h=Jt(),a=n.apply(l,i),p||f||(i=l=null))):p=setTimeout(e,t)}function u(){p&&clearTimeout(p),f=p=s=qr,(v||g!==r)&&(h=Jt(),a=n.apply(l,i),p||f||(i=l=null)) +}function o(){if(i=arguments,c=Jt(),l=this,s=v&&(p||!y),false===g)var t=y&&!p;else{f||y||(h=c);var o=g-(c-h),m=0>=o||o>g;m?(f&&(f=clearTimeout(f)),h=c,a=n.apply(l,i)):f||(f=setTimeout(u,o))}return m&&p?p=clearTimeout(p):p||r===g||(p=setTimeout(e,r)),t&&(m=true,a=n.apply(l,i)),!m||p||f||(i=l=null),a}var i,f,a,c,l,p,s,h=0,g=false,v=true;if(!dr(n))throw new TypeError(Dr);if(r=0>r?0:r,true===t)var y=true,v=false;else _r(t)&&(y=t.leading,g="maxWait"in t&&kt(+t.maxWait||0,r),v="trailing"in t?t.trailing:v);return o.cancel=function(){p&&clearTimeout(p),f&&clearTimeout(f),f=p=s=qr +},o}function yr(n){for(var r=Q(arguments,1),t=r,e=yr.placeholder,u=-1,o=t.length,i=-1,f=[];++u"'`]/g,Yr=/^\[object .+?Constructor\]$/,Gr=/($^)/,Hr=/[.*+?^${}()|[\]\/\\]/g,Jr=/['\n\r\u2028\u2029\\]/g,Kr="[object Arguments]",Lr="[object Boolean]",Qr="[object Date]",Xr="[object Error]",Zr="[object Number]",nt="[object Object]",rt="[object RegExp]",tt="[object String]",et={}; +et[Kr]=et["[object Array]"]=et["[object Float32Array]"]=et["[object Float64Array]"]=et["[object Int8Array]"]=et["[object Int16Array]"]=et["[object Int32Array]"]=et["[object Uint8Array]"]=et["[object Uint8ClampedArray]"]=et["[object Uint16Array]"]=et["[object Uint32Array]"]=true,et["[object ArrayBuffer]"]=et[Lr]=et[Qr]=et[Xr]=et["[object Function]"]=et["[object Map]"]=et[Zr]=et[nt]=et[rt]=et["[object Set]"]=et[tt]=et["[object WeakMap]"]=false;var ut={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},ot={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},it={"function":true,object:true},ft={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},at=it[typeof window]&&window||this,ct=it[typeof exports]&&exports&&!exports.nodeType&&exports,lt=it[typeof module]&&module&&!module.nodeType&&module,pt=ct&<&&typeof global=="object"&&global; +!pt||pt.global!==pt&&pt.window!==pt&&pt.self!==pt||(at=pt);var st=lt&<.exports===ct&&ct,ht=Array.prototype,gt=Object.prototype,vt=Function.prototype.toString,yt=gt.hasOwnProperty,mt=at._,bt=gt.toString,dt=RegExp("^"+function(n){return(n=null==n?"":n+"")&&(Hr.lastIndex=0,Hr.test(n))?n.replace(Hr,"\\$&"):n}(bt).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),_t=Math.ceil,jt=Math.floor,wt=ht.push,At=gt.propertyIsEnumerable,xt=ht.splice,Tt=jr(Tt=Object.create)&&Tt,Et=jr(Et=Array.isArray)&&Et,It=at.isFinite,Ot=jr(Ot=Object.keys)&&Ot,kt=Math.max,St=Math.min,Nt=jr(Nt=Date.now)&&Nt,Ft=Math.random,Mt=Number.NEGATIVE_INFINITY,$t=Number.POSITIVE_INFINITY,qt=Math.pow(2,32)-1,Bt=qt-1,Rt=Math.pow(2,53)-1,Ut={}; +!function(){var n={0:1,length:1};Ut.spliceObjects=(xt.call(n,0,1),!n[0])}(0,0),g.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},Tt||(b=function(){function n(){}return function(r){if(_r(r)){n.prototype=r;var t=new n;n.prototype=null}return t||at.Object()}}());var Wt=L,Dt=J,zt=B(function(n,r,t){yt.call(n,t)?++n[t]:n[t]=1}),Ct=B(function(n,r,t){yt.call(n,t)?n[t].push(r):n[t]=[r]}),Vt=B(function(n,r,t){n[t]=r}),Pt=B(function(n,r,t){n[t?0:1].push(r) +},function(){return[[],[]]}),Yt=N(gr,Wr,[2],[]);mr(arguments)||(mr=function(n){var r=n&&typeof n=="object"?n.length:qr;return typeof r=="number"&&-1--n?r.apply(this,arguments):void 0}},g.before=gr,g.bind=function(n,r){return 3>arguments.length?z(n,Rr,r):N(n,Rr|Wr,Q(arguments,2),[],r)},g.bindAll=function(n){for(var r=n,t=1r?0:r)},g.intersection=function(){for(var n=[],r=-1,t=arguments.length;++ri(a,e)){for(r=t;--r;)if(0>i(n[r],e))continue n;a.push(e)}return a},g.invert=function(n){for(var r=-1,t=Ht(n),e=t.length,u={};++rt)return function(){};if(!r(n,dr))throw new TypeError(Dr);return function(){for(var r=t,e=n[r].apply(this,arguments);r--;)e=n[r].call(this,e);return e}},g.each=ir,g.extend=xr,g.iteratee=function(n,r,t){return m(n,t?qr:r)},g.methods=Er,g.object=function(n,r){var t=-1,e=n?n.length:0,u={};for(r||!e||Gt(n[0])||(r=[]);++tr?0:r))},g.lastIndexOf=function(n,r,t){var e=n?n.length:0;if(!e)return-1;var u=e;for(typeof t=="number"&&(u=(0>t?kt(e+t,0):St(t||0,e-1))+1);u--;)if(n[u]===r)return u;return-1},g.max=ar,g.min=function(n,r,t){if(t&&s(n,r,t)&&(r=null),null==r)return y(Gt(n)?n:G(n));var e=$t,u=e;return r=m(r,t,3),_(n,function(n,t,o){t=r(n,t,o),(tr?0:+r||0,n.length),n) +},Mr(xr({},g)),g.VERSION="3.0.0-pre",yr.placeholder=g,n("concat join pop push reverse shift sort splice unshift".split(" "),function(n){var r=ht[n],t=!/^(?:concat|join|slice)$/.test(n),e=!Ut.spliceObjects&&/^(?:pop|shift|splice)$/.test(n);g.prototype[n]=function(){var n=this.__wrapped__,u=r.apply(n,arguments);return e&&0===n.length&&delete n[0],t&&(u=n),this.__chain__?new rr(u,true):u}}),g.prototype.chain=function(){return nr(this)},g.prototype.value=function(){return this.__wrapped__},g.prototype.tail=g.prototype.rest,typeof define=="function"&&typeof define.amd=="object"&&define.amd?(at._=g, define("underscore",function(){return g +})):ct&<?st?(lt.exports=g)._=g:ct._=g:at._=g}).call(this); \ No newline at end of file