From 5ea3717152006840476d3a05c66a3de06260d5e2 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Wed, 31 Dec 2014 11:52:42 -0600 Subject: [PATCH] Rebuild dist. --- dist/lodash.compat.js | 1394 ++++++++++++++++++++----------------- dist/lodash.compat.min.js | 160 ++--- dist/lodash.js | 1330 ++++++++++++++++++----------------- dist/lodash.min.js | 153 ++-- 4 files changed, 1607 insertions(+), 1430 deletions(-) diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index f9ab23b2d..4d93eade0 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -2,9 +2,9 @@ * @license * Lo-Dash 3.0.0-pre (Custom Build) * Build: `lodash -o ./dist/lodash.compat.js` - * Copyright 2012-2014 The Dojo Foundation + * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.7.0 - * Copyright 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ ;(function() { @@ -63,7 +63,7 @@ /** * Used to match ES6 template delimiters. - * See the [ES6 spec](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components) + * See the [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components) * for more details. */ var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; @@ -140,60 +140,60 @@ var templateCounter = -1; /** `Object#toString` result references. */ - var argsClass = '[object Arguments]', - arrayClass = '[object Array]', - boolClass = '[object Boolean]', - dateClass = '[object Date]', - errorClass = '[object Error]', - funcClass = '[object Function]', - mapClass = '[object Map]', - numberClass = '[object Number]', - objectClass = '[object Object]', - regexpClass = '[object RegExp]', - setClass = '[object Set]', - stringClass = '[object String]', - weakMapClass = '[object WeakMap]'; + var argsTag = '[object Arguments]', + arrayTag = '[object Array]', + boolTag = '[object Boolean]', + dateTag = '[object Date]', + errorTag = '[object Error]', + funcTag = '[object Function]', + mapTag = '[object Map]', + numberTag = '[object Number]', + objectTag = '[object Object]', + regexpTag = '[object RegExp]', + setTag = '[object Set]', + stringTag = '[object String]', + weakMapTag = '[object WeakMap]'; - var arrayBufferClass = '[object ArrayBuffer]', - float32Class = '[object Float32Array]', - float64Class = '[object Float64Array]', - int8Class = '[object Int8Array]', - int16Class = '[object Int16Array]', - int32Class = '[object Int32Array]', - uint8Class = '[object Uint8Array]', - uint8ClampedClass = '[object Uint8ClampedArray]', - uint16Class = '[object Uint16Array]', - uint32Class = '[object Uint32Array]'; + var arrayBufferTag = '[object ArrayBuffer]', + float32Tag = '[object Float32Array]', + float64Tag = '[object Float64Array]', + int8Tag = '[object Int8Array]', + int16Tag = '[object Int16Array]', + int32Tag = '[object Int32Array]', + uint8Tag = '[object Uint8Array]', + uint8ClampedTag = '[object Uint8ClampedArray]', + uint16Tag = '[object Uint16Array]', + uint32Tag = '[object Uint32Array]'; /** Used to identify object classifications that are treated like arrays. */ - var arrayLikeClasses = {}; - arrayLikeClasses[argsClass] = - arrayLikeClasses[arrayClass] = arrayLikeClasses[float32Class] = - arrayLikeClasses[float64Class] = arrayLikeClasses[int8Class] = - arrayLikeClasses[int16Class] = arrayLikeClasses[int32Class] = - arrayLikeClasses[uint8Class] = arrayLikeClasses[uint8ClampedClass] = - arrayLikeClasses[uint16Class] = arrayLikeClasses[uint32Class] = true; - arrayLikeClasses[arrayBufferClass] = arrayLikeClasses[boolClass] = - arrayLikeClasses[dateClass] = arrayLikeClasses[errorClass] = - arrayLikeClasses[funcClass] = arrayLikeClasses[mapClass] = - arrayLikeClasses[numberClass] = arrayLikeClasses[objectClass] = - arrayLikeClasses[regexpClass] = arrayLikeClasses[setClass] = - arrayLikeClasses[stringClass] = arrayLikeClasses[weakMapClass] = false; + var arrayLikeTags = {}; + arrayLikeTags[argsTag] = + arrayLikeTags[arrayTag] = arrayLikeTags[float32Tag] = + arrayLikeTags[float64Tag] = arrayLikeTags[int8Tag] = + arrayLikeTags[int16Tag] = arrayLikeTags[int32Tag] = + arrayLikeTags[uint8Tag] = arrayLikeTags[uint8ClampedTag] = + arrayLikeTags[uint16Tag] = arrayLikeTags[uint32Tag] = true; + arrayLikeTags[arrayBufferTag] = arrayLikeTags[boolTag] = + arrayLikeTags[dateTag] = arrayLikeTags[errorTag] = + arrayLikeTags[funcTag] = arrayLikeTags[mapTag] = + arrayLikeTags[numberTag] = arrayLikeTags[objectTag] = + arrayLikeTags[regexpTag] = arrayLikeTags[setTag] = + arrayLikeTags[stringTag] = arrayLikeTags[weakMapTag] = false; /** Used to identify object classifications that `_.clone` supports. */ - var cloneableClasses = {}; - cloneableClasses[argsClass] = cloneableClasses[arrayClass] = - cloneableClasses[arrayBufferClass] = cloneableClasses[boolClass] = - cloneableClasses[dateClass] = cloneableClasses[float32Class] = - cloneableClasses[float64Class] = cloneableClasses[int8Class] = - cloneableClasses[int16Class] = cloneableClasses[int32Class] = - cloneableClasses[numberClass] = cloneableClasses[objectClass] = - cloneableClasses[regexpClass] = cloneableClasses[stringClass] = - cloneableClasses[uint8Class] = cloneableClasses[uint8ClampedClass] = - cloneableClasses[uint16Class] = cloneableClasses[uint32Class] = true; - cloneableClasses[errorClass] = - cloneableClasses[funcClass] = cloneableClasses[mapClass] = - cloneableClasses[setClass] = cloneableClasses[weakMapClass] = false; + var cloneableTags = {}; + cloneableTags[argsTag] = cloneableTags[arrayTag] = + cloneableTags[arrayBufferTag] = cloneableTags[boolTag] = + cloneableTags[dateTag] = cloneableTags[float32Tag] = + cloneableTags[float64Tag] = cloneableTags[int8Tag] = + cloneableTags[int16Tag] = cloneableTags[int32Tag] = + cloneableTags[numberTag] = cloneableTags[objectTag] = + cloneableTags[regexpTag] = cloneableTags[stringTag] = + cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = + cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; + cloneableTags[errorTag] = + cloneableTags[funcTag] = cloneableTags[mapTag] = + cloneableTags[setTag] = cloneableTags[weakMapTag] = false; /** Used as an internal `_.debounce` options object by `_.throttle`. */ var debounceOptions = { @@ -332,7 +332,7 @@ * @private * @param {Array} array The array to iterate over. * @param {Function} predicate The function invoked per iteration. - * @returns {Array} Returns `true` if all elements pass the predicate check, + * @returns {boolean} Returns `true` if all elements pass the predicate check, * else `false`. */ function arrayEvery(array, predicate) { @@ -701,7 +701,7 @@ */ var isHostObject = (function() { try { - String({ 'toString': 0 } + ''); + Object({ 'toString': 0 } + ''); } catch(e) { return function() { return false; }; } @@ -855,22 +855,30 @@ * @returns {Function} Returns a new `lodash` function. * @example * - * _.mixin({ 'add': function(a, b) { return a + b; } }, false); + * _.mixin({ 'add': function(a, b) { return a + b; } }); * * var lodash = _.runInContext(); - * lodash.mixin({ 'sub': function(a, b) { return a - b; } }, false); + * lodash.mixin({ 'sub': function(a, b) { return a - b; } }); * * _.isFunction(_.add); * // => true - * * _.isFunction(_.sub); * // => false * * lodash.isFunction(lodash.add); * // => false - * * lodash.isFunction(lodash.sub); * // => true + * + * // using `context` to mock `Date#getTime` use in `_.now` + * var mock = _.runInContext({ + * 'Date': function() { + * return { 'getTime': getTimeMock }; + * } + * }); + * + * // or creating a suped-up `defer` in Node.js + * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer; */ function runInContext(context) { // Avoid issues with some ES3 environments that attempt to use values, named @@ -912,15 +920,19 @@ /** Used to generate unique IDs. */ var idCounter = 0; + /** + * Used to resolve the `toStringTag` of values. + * See the [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) + * for more details. + */ + var objToString = objectProto.toString; + /** Used to restore the original `_` reference in `_.noConflict`. */ var oldDash = context._; - /** Used to resolve the internal `[[Class]]` of values. */ - var toString = objectProto.toString; - /** Used to detect if a method is native. */ var reNative = RegExp('^' + - escapeRegExp(toString) + escapeRegExp(objToString) .replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' ); @@ -977,7 +989,7 @@ /** * Used as the maximum length of an array-like value. - * See the [ES6 spec](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength) + * See the [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength) * for more details. */ var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; @@ -985,29 +997,29 @@ /** Used to store function metadata. */ var metaMap = WeakMap && new WeakMap; - /** Used to lookup a built-in constructor by `[[Class]]`. */ - var ctorByClass = {}; - ctorByClass[float32Class] = context.Float32Array; - ctorByClass[float64Class] = context.Float64Array; - ctorByClass[int8Class] = context.Int8Array; - ctorByClass[int16Class] = context.Int16Array; - ctorByClass[int32Class] = context.Int32Array; - ctorByClass[uint8Class] = context.Uint8Array; - ctorByClass[uint8ClampedClass] = context.Uint8ClampedArray; - ctorByClass[uint16Class] = context.Uint16Array; - ctorByClass[uint32Class] = context.Uint32Array; + /** Used to lookup a built-in constructor by `toStringTag`. */ + var ctorByTag = {}; + ctorByTag[float32Tag] = context.Float32Array; + ctorByTag[float64Tag] = context.Float64Array; + ctorByTag[int8Tag] = context.Int8Array; + ctorByTag[int16Tag] = context.Int16Array; + ctorByTag[int32Tag] = context.Int32Array; + ctorByTag[uint8Tag] = context.Uint8Array; + ctorByTag[uint8ClampedTag] = context.Uint8ClampedArray; + ctorByTag[uint16Tag] = context.Uint16Array; + ctorByTag[uint32Tag] = context.Uint32Array; /** Used to avoid iterating over non-enumerable properties in IE < 9. */ var nonEnumProps = {}; - nonEnumProps[arrayClass] = nonEnumProps[dateClass] = nonEnumProps[numberClass] = { 'constructor': true, 'toLocaleString': true, 'toString': true, 'valueOf': true }; - nonEnumProps[boolClass] = nonEnumProps[stringClass] = { 'constructor': true, 'toString': true, 'valueOf': true }; - nonEnumProps[errorClass] = nonEnumProps[funcClass] = nonEnumProps[regexpClass] = { 'constructor': true, 'toString': true }; - nonEnumProps[objectClass] = { 'constructor': true }; + nonEnumProps[arrayTag] = nonEnumProps[dateTag] = nonEnumProps[numberTag] = { 'constructor': true, 'toLocaleString': true, 'toString': true, 'valueOf': true }; + nonEnumProps[boolTag] = nonEnumProps[stringTag] = { 'constructor': true, 'toString': true, 'valueOf': true }; + nonEnumProps[errorTag] = nonEnumProps[funcTag] = nonEnumProps[regexpTag] = { 'constructor': true, 'toString': true }; + nonEnumProps[objectTag] = { 'constructor': true }; arrayEach(shadowProps, function(key) { - for (var className in nonEnumProps) { - if (hasOwnProperty.call(nonEnumProps, className)) { - var props = nonEnumProps[className]; + for (var tag in nonEnumProps) { + if (hasOwnProperty.call(nonEnumProps, tag)) { + var props = nonEnumProps[tag]; props[key] = hasOwnProperty.call(props, key); } } @@ -1140,13 +1152,13 @@ for (var key in new Ctor) { props.push(key); } /** - * Detect if the `[[Class]]` of `arguments` objects is resolvable + * Detect if the `toStringTag` of `arguments` objects is resolvable * (all but Firefox < 4, IE < 9). * * @memberOf _.support * @type boolean */ - support.argsClass = toString.call(arguments) == argsClass; + support.argsTag = objToString.call(arguments) == argsTag; /** * Detect if `name` or `message` properties of `Error.prototype` are @@ -1190,12 +1202,12 @@ support.funcNames = typeof Function.name == 'string'; /** - * Detect if the `[[Class]]` of DOM nodes is resolvable (all but IE < 9). + * Detect if the `toStringTag` of DOM nodes is resolvable (all but IE < 9). * * @memberOf _.support * @type boolean */ - support.nodeClass = toString.call(document) != objectClass; + support.nodeTag = objToString.call(document) != objectTag; /** * Detect if string indexes are non-enumerable @@ -1496,7 +1508,7 @@ * @private * @name get * @memberOf _.memoize.Cache - * @param {string} key The key of the value to retrieve. + * @param {string} key The key of the value to get. * @returns {*} Returns the cached value. */ function mapGet(key) { @@ -1692,9 +1704,17 @@ while (++index < length) { var key = props[index]; - object[key] = customizer - ? customizer(object[key], source[key], key, object, source) - : source[key]; + if (customizer) { + var value = object[key], + result = customizer(value, source[key], key, object, source); + + if ((result === result ? result !== value : value === value) || + (typeof value == 'undefined' && !(key in object))) { + object[key] = result; + } + } else { + object[key] = source[key]; + } } return object; } @@ -1727,49 +1747,6 @@ return result; } - /** - * The base implementation of `binaryIndex` which supports large arrays and - * determining the insert index for `NaN` and `undefined`. - * - * @private - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @param {boolean} [retHighest] Specify returning the highest, instead - * of the lowest, index at which a value should be inserted into `array`. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. - */ - function baseBinaryIndex(array, value, iteratee, retHighest) { - iteratee = iteratee == null ? identity : iteratee; - value = iteratee(value); - - var low = 0, - high = array.length, - valIsNaN = value !== value, - valIsUndef = typeof value == 'undefined'; - - while (low < high) { - var mid = floor((low + high) / 2), - computed = iteratee(array[mid]), - isReflexive = computed === computed; - - if (valIsNaN) { - var setLow = isReflexive || retHighest; - } else if (valIsUndef) { - setLow = isReflexive && (retHighest || typeof computed != 'undefined'); - } else { - setLow = retHighest ? (computed <= value) : (computed < value); - } - if (setLow) { - low = mid + 1; - } else { - high = mid; - } - } - return nativeMin(high, MAX_ARRAY_INDEX); - } - /** * The base implementation of `_.bindAll` without support for individual * method name arguments. @@ -1811,10 +1788,10 @@ if (func == null) { return identity; } - // Handle "_.pluck" and "_.where" style callback shorthands. + // Handle "_.property" and "_.matches" style callback shorthands. return type == 'object' ? baseMatches(func, argCount) - : baseProperty(argCount ? String(func) : func); + : baseProperty(argCount ? (func + '') : func); } /** @@ -1849,7 +1826,7 @@ isDeep = false; result = {}; } else if (isDeep) { - isDeep = toString.call(result) == objectClass; + isDeep = objToString.call(result) == objectTag; } } if (!isDeep || result === value) { @@ -2015,7 +1992,7 @@ * @private * @param {Array|Object|string} collection The collection to iterate over. * @param {Function} predicate The function invoked per iteration. - * @returns {Array} Returns `true` if all elements pass the predicate check, + * @returns {boolean} Returns `true` if all elements pass the predicate check, * else `false` */ function baseEvery(collection, predicate) { @@ -2297,31 +2274,31 @@ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function baseIsEqualDeep(object, other, equalFunc, customizer, isWhere, stackA, stackB) { - var objClass = isArray(object) ? arrayClass : toString.call(object), - objIsArg = objClass == argsClass, - objIsArr = !objIsArg && arrayLikeClasses[objClass], - othClass = isArray(other) ? arrayClass : toString.call(other), - othIsArg = othClass == argsClass, - othIsArr = !othIsArg && arrayLikeClasses[othClass]; + var objTag = isArray(object) ? arrayTag : objToString.call(object), + objIsArg = objTag == argsTag, + objIsArr = !objIsArg && arrayLikeTags[objTag], + othTag = isArray(other) ? arrayTag : objToString.call(other), + othIsArg = othTag == argsTag, + othIsArr = !othIsArg && arrayLikeTags[othTag]; - if (!lodash.support.argsClass) { + if (!lodash.support.argsTag) { objIsArg = !objIsArr && typeof object.length == 'number' && isArguments(object); othIsArg = !othIsArr && typeof other.length == 'number' && isArguments(other); } if (objIsArg) { object = argsToObject(object); - objClass = objectClass; + objTag = objectTag; } if (othIsArg) { other = argsToObject(other); - othClass = objectClass; + othTag = objectTag; } - var objIsObj = objClass == objectClass && !isHostObject(object), - othIsObj = othClass == objectClass && !isHostObject(other), - isSameClass = objClass == othClass; + var objIsObj = objTag == objectTag && !isHostObject(object), + othIsObj = othTag == objectTag && !isHostObject(other), + isSameTag = objTag == othTag; - if (isSameClass && !(objIsArr || objIsObj)) { - return equalByClass(object, other, objClass); + if (isSameTag && !(objIsArr || objIsObj)) { + return equalByTag(object, other, objTag); } var valWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), othWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); @@ -2329,7 +2306,7 @@ if (valWrapped || othWrapped) { return equalFunc(valWrapped ? object.value() : object, othWrapped ? other.value() : other, customizer, isWhere, stackA, stackB); } - if (!isSameClass) { + if (!isSameTag) { return false; } // Assume cyclic structures are equal. @@ -2484,11 +2461,14 @@ value = object[key]; if (!(isArr || isObj)) { - result = customizer ? customizer(value, srcValue, key, object, source) : undefined; - if (typeof result == 'undefined') { + var result = customizer ? customizer(value, srcValue, key, object, source) : undefined, + isCommon = typeof result == 'undefined'; + + if (isCommon) { result = srcValue; } - if (isSrcArr || typeof result != 'undefined') { + if ((isSrcArr || typeof result != 'undefined') && + (isCommon || (result === result ? result !== value : value === value))) { object[key] = result; } return; @@ -2504,10 +2484,10 @@ return; } } - var result = customizer ? customizer(value, srcValue, key, object, source) : undefined, - isDeep = typeof result == 'undefined'; + result = customizer ? customizer(value, srcValue, key, object, source) : undefined; + isCommon = typeof result == 'undefined'; - if (isDeep) { + if (isCommon) { result = isArr ? (isArray(value) ? value : []) : (isPlainObject(value) ? value : {}); @@ -2518,10 +2498,11 @@ stackB.push(result); // Recursively merge objects and arrays (susceptible to call stack limits). - if (isDeep) { - baseMerge(result, srcValue, customizer, stackA, stackB); + if (isCommon) { + object[key] = baseMerge(result, srcValue, customizer, stackA, stackB); + } else if (result === result ? result !== value : value === value) { + object[key] = result; } - object[key] = result; }); return object; } @@ -2530,7 +2511,7 @@ * The base implementation of `_.property` which does not coerce `key` to a string. * * @private - * @param {string} key The name of the property to retrieve. + * @param {string} key The name of the property to get. * @returns {Function} Returns the new function. */ function baseProperty(key) { @@ -2725,49 +2706,87 @@ while (++index < length) { var args = [result], - action = actions[index], - object = action.object; + action = actions[index]; push.apply(args, action.args); - result = object[action.name].apply(object, args); + result = action.func.apply(action.thisArg, args); } return result; } /** * Performs a binary search of `array` to determine the index at which `value` - * should be inserted into `array` in order to maintain its sort order. If - * `iteratee` is provided it is invoked for `value` and each element of - * `array` to compute their sort ranking. The iteratee is invoked with one - * argument; (value). + * should be inserted into `array` in order to maintain its sort order. * * @private * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. - * @param {Function} [iteratee] The function invoked per iteration. * @param {boolean} [retHighest] Specify returning the highest, instead * of the lowest, index at which a value should be inserted into `array`. * @returns {number} Returns the index at which `value` should be inserted * into `array`. */ - function binaryIndex(array, value, iteratee, retHighest) { + function binaryIndex(array, value, retHighest) { var low = 0, high = array ? array.length : low; - if (high && (iteratee || value !== value || typeof value == 'undefined' || high > HALF_MAX_ARRAY_LENGTH)) { - return baseBinaryIndex(array, value, iteratee, retHighest); - } - while (low < high) { - var mid = (low + high) >>> 1, - computed = array[mid]; + if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) { + while (low < high) { + var mid = (low + high) >>> 1, + computed = array[mid]; - if (retHighest ? (computed <= value) : (computed < value)) { + if (retHighest ? (computed <= value) : (computed < value)) { + low = mid + 1; + } else { + high = mid; + } + } + return high; + } + return binaryIndexBy(array, value, identity, retHighest); + } + + /** + * This function is like `binaryIndex` except that it invokes `iteratee` for + * `value` and each element of `array` to compute their sort ranking. The + * iteratee is invoked with one argument; (value). + * + * @private + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {Function} iteratee The function invoked per iteration. + * @param {boolean} [retHighest] Specify returning the highest, instead + * of the lowest, index at which a value should be inserted into `array`. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + */ + function binaryIndexBy(array, value, iteratee, retHighest) { + value = iteratee(value); + + var low = 0, + high = array ? array.length : 0, + valIsNaN = value !== value, + valIsUndef = typeof value == 'undefined'; + + while (low < high) { + var mid = floor((low + high) / 2), + computed = iteratee(array[mid]), + isReflexive = computed === computed; + + if (valIsNaN) { + var setLow = isReflexive || retHighest; + } else if (valIsUndef) { + setLow = isReflexive && (retHighest || typeof computed != 'undefined'); + } else { + setLow = retHighest ? (computed <= value) : (computed < value); + } + if (setLow) { low = mid + 1; } else { high = mid; } } - return high; + return nativeMin(high, MAX_ARRAY_INDEX); } /** @@ -2913,9 +2932,8 @@ /** * Creates a function that aggregates a collection, creating an accumulator * object composed from the results of running each element in the collection - * through `iteratee`. The given setter function sets the keys and values of - * the accumulator object. If `initializer` is provided it is used to initialize - * the accumulator object. + * through an iteratee. The `setter` sets the keys and values of the accumulator + * object. If `initializer` is provided initializes the accumulator object. * * @private * @param {Function} setter The function to set keys and values of the accumulator object. @@ -2949,7 +2967,7 @@ * destination object. * * @private - * @param {Function} assigner The function to handle assigning values. + * @param {Function} assigner The function to assign values. * @returns {Function} Returns the new assigner function. */ function createAssigner(assigner) { @@ -3011,7 +3029,7 @@ * given string. * * @private - * @param {Function} callback The function invoked to combine each word. + * @param {Function} callback The function to combine each word. * @returns {Function} Returns the new compounder function. */ function createCompounder(callback) { @@ -3047,6 +3065,39 @@ }; } + /** + * Creates a function that gets the extremum value of a collection. + * + * @private + * @param {Function} arrayFunc The function to get the extremum value from an array. + * @param {boolean} [isMin] Specify returning the minimum, instead of the maximum, + * extremum value. + * @returns {Function} Returns the new extremum function. + */ + function createExtremum(arrayFunc, isMin) { + return function(collection, iteratee, thisArg) { + if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { + iteratee = null; + } + var func = getCallback(), + noIteratee = iteratee == null; + + if (!(func === baseCallback && noIteratee)) { + noIteratee = false; + iteratee = func(iteratee, thisArg, 3); + } + if (noIteratee) { + var isArr = isArray(collection); + if (!isArr && isString(collection)) { + iteratee = charAtCallback; + } else { + return arrayFunc(isArr ? collection : toIterable(collection)); + } + } + return extremumBy(collection, iteratee, isMin); + }; + } + /** * Creates a function that wraps `func` and invokes it with optional `this` * binding of, partial application, and currying. @@ -3149,7 +3200,7 @@ return ''; } var padLength = length - strLength; - chars = chars == null ? ' ' : String(chars); + chars = chars == null ? ' ' : (chars + ''); return repeat(chars, ceil(padLength / chars.length)).slice(0, padLength); } @@ -3224,9 +3275,7 @@ bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG); partials = holders = null; } - holders = (partials && !holders) ? [] : holders; length -= (holders ? holders.length : 0); - if (bitmask & PARTIAL_RIGHT_FLAG) { var partialsRight = partials, holdersRight = holders; @@ -3238,12 +3287,13 @@ if (data && data !== true) { mergeData(newData, data); + bitmask = newData[1]; + arity = newData[9]; } - newData[9] = newData[9] == null - ? (isBindKey ? 0 : newData[0].length) - : (nativeMax(newData[9] - length, 0) || 0); + newData[9] = arity == null + ? (isBindKey ? 0 : func.length) + : (nativeMax(arity - length, 0) || 0); - bitmask = newData[1]; if (bitmask == BIND_FLAG) { var result = createBindWrapper(newData[0], newData[2]); } else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !newData[4].length) { @@ -3309,40 +3359,40 @@ /** * A specialized version of `baseIsEqualDeep` for comparing objects of - * the same `[[Class]]`. + * the same `toStringTag`. * - * **Note:** This function only supports comparing values with `[[Class]]` + * **Note:** This function only supports comparing values with `toStringTag` * values of `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. * * @private * @param {Object} value The object to compare to `other`. * @param {Object} other The object to compare to `object`. - * @param {string} className The `[[Class]]` of the objects to compare. + * @param {string} tag The `toStringTag` of the objects to compare. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ - function equalByClass(object, other, className) { - switch (className) { - case boolClass: - case dateClass: + function equalByTag(object, other, tag) { + switch (tag) { + case boolTag: + case dateTag: // Coerce dates and booleans to numbers, dates to milliseconds and booleans // to `1` or `0` treating invalid dates coerced to `NaN` as not equal. return +object == +other; - case errorClass: + case errorTag: return object.name == other.name && object.message == other.message; - case numberClass: + case numberTag: // Treat `NaN` vs. `NaN` as equal. return (object != +object) ? other != +other // But, treat `-0` vs. `+0` as not equal. : (object == 0 ? ((1 / object) == (1 / other)) : object == +other); - case regexpClass: - case stringClass: + case regexpTag: + case stringTag: // Coerce regexes to strings (http://es5.github.io/#x15.10.6.4) and // treat strings primitives and string objects as equal. - return object == String(other); + return object == (other + ''); } return false; } @@ -3409,6 +3459,33 @@ return true; } + /** + * Gets the extremum value of `collection` invoking `iteratee` for each value + * in `collection` to generate the criterion by which the value is ranked. + * The `iteratee` is invoked with three arguments; (value, index, collection). + * + * @private + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {boolean} [isMin] Specify returning the minimum, instead of the + * maximum, extremum value. + * @returns {*} Returns the extremum value. + */ + function extremumBy(collection, iteratee, isMin) { + var exValue = isMin ? POSITIVE_INFINITY : NEGATIVE_INFINITY, + computed = exValue, + result = computed; + + baseEach(collection, function(value, index, collection) { + var current = iteratee(value, index, collection); + if ((isMin ? current < computed : current > computed) || (current === exValue && current === result)) { + computed = current; + result = value; + } + }); + return result; + } + /** * Gets the appropriate "callback" function. If the `_.callback` method is * customized this function returns the custom method, otherwise it returns @@ -3518,9 +3595,9 @@ return null; } var Ctor = object.constructor, - className = toString.call(object), - isArgs = className == argsClass || (!lodash.support.argsClass && isArguments(object)), - isObj = className == objectClass; + tag = objToString.call(object), + isArgs = tag == argsTag || (!lodash.support.argsTag && isArguments(object)), + isObj = tag == objectTag; if (isObj && !(typeof Ctor == 'function' && Ctor instanceof Ctor)) { Ctor = Object; @@ -3532,29 +3609,29 @@ } return result; } - switch (className) { - case arrayBufferClass: + switch (tag) { + case arrayBufferTag: return bufferClone(object); - case boolClass: - case dateClass: + case boolTag: + case dateTag: return new Ctor(+object); - case float32Class: case float64Class: - case int8Class: case int16Class: case int32Class: - case uint8Class: case uint8ClampedClass: case uint16Class: case uint32Class: + case float32Tag: case float64Tag: + case int8Tag: case int16Tag: case int32Tag: + case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: // Safari 5 mobile incorrectly has `Object` as the constructor of typed arrays. if (Ctor instanceof Ctor) { - Ctor = ctorByClass[className]; + Ctor = ctorByTag[tag]; } var buffer = object.buffer; return new Ctor(isDeep ? bufferClone(buffer) : buffer, object.byteOffset, object.length); - case numberClass: - case stringClass: + case numberTag: + case stringTag: return new Ctor(object); - case regexpClass: + case regexpTag: result = new Ctor(object.source, reFlags.exec(object)); result.lastIndex = object.lastIndex; } @@ -3570,7 +3647,7 @@ */ function isArrayLike(value) { return (isObjectLike(value) && isLength(value.length) && - (arrayLikeClasses[toString.call(value)] || (!lodash.support.argsClass && isArguments(value)))) || false; + (arrayLikeTags[objToString.call(value)] || (!lodash.support.argsTag && isArguments(value)))) || false; } /** @@ -3606,7 +3683,7 @@ * @returns {boolean} Returns `true` if `value` is cloneable, else `false`. */ function isCloneable(value) { - return (value && cloneableClasses[toString.call(value)] && !isHostObject(value)) || false; + return (value && cloneableTags[objToString.call(value)] && !isHostObject(value)) || false; } /** @@ -3640,7 +3717,7 @@ * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. */ function isLength(value) { - return typeof value == 'number' && value > -1 && value <= MAX_SAFE_INTEGER; + return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** @@ -3847,10 +3924,10 @@ support = lodash.support; // Exit early for non `Object` objects. - if (!(isObjectLike(value) && toString.call(value) == objectClass && !isHostObject(value)) || + if (!(isObjectLike(value) && objToString.call(value) == objectTag && !isHostObject(value)) || (!hasOwnProperty.call(value, 'constructor') && (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor))) || - (!support.argsClass && isArguments(value))) { + (!support.argsTag && isArguments(value))) { return false; } // IE < 9 iterates inherited properties before own properties. If the first @@ -3944,6 +4021,21 @@ return isObject(value) ? value : Object(value); } + /** + * Converts `value` to a string if it is not one. An empty string is + * returned for `null` or `undefined` values. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ + function toString(value) { + if (typeof value == 'string') { + return value; + } + return value == null ? '' : (value + ''); + } + /*------------------------------------------------------------------------*/ /** @@ -3985,7 +4077,7 @@ /** * Creates an array with all falsey values removed. The values `false`, `null`, - * `0`, `""`, `undefined`, and `NaN` are all falsey. + * `0`, `""`, `undefined`, and `NaN` are falsey. * * @static * @memberOf _ @@ -4058,7 +4150,7 @@ * @returns {Array} Returns the slice of `array`. * @example * - * _.drop([1, 2, 3], 1); + * _.drop([1, 2, 3]); * // => [2, 3] * * _.drop([1, 2, 3], 2); @@ -4090,7 +4182,7 @@ * @returns {Array} Returns the slice of `array`. * @example * - * _.dropRight([1, 2, 3], 1); + * _.dropRight([1, 2, 3]); * // => [1, 2] * * _.dropRight([1, 2, 3], 2); @@ -4115,12 +4207,12 @@ * Elements are dropped until `predicate` returns falsey. The predicate is * bound to `thisArg` and invoked with three arguments; (value, index, array). * - * If a property name is provided for `predicate` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `predicate` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -4142,11 +4234,11 @@ * { 'user': 'pebbles', 'status': 'away', 'active': true } * ]; * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.pluck(_.dropRightWhile(users, 'active'), 'user'); * // => ['barney'] * - * // using "_.where" callback shorthand + * // using the "_.matches" callback shorthand * _.pluck(_.dropRightWhile(users, { 'status': 'away' }), 'user'); * // => ['barney', 'fred'] */ @@ -4163,12 +4255,12 @@ * Elements are dropped until `predicate` returns falsey. The predicate is * bound to `thisArg` and invoked with three arguments; (value, index, array). * - * If a property name is provided for `predicate` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `predicate` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -4190,11 +4282,11 @@ * { 'user': 'pebbles', 'status': 'away', 'active': true } * ]; * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.pluck(_.dropWhile(users, 'active'), 'user'); * // => ['fred', 'pebbles'] * - * // using "_.where" callback shorthand + * // using the "_.matches" callback shorthand * _.pluck(_.dropWhile(users, { 'status': 'busy' }), 'user'); * // => ['pebbles'] */ @@ -4211,12 +4303,12 @@ * This method is like `_.find` except that it returns the index of the first * element `predicate` returns truthy for, instead of the element itself. * - * If a property name is provided for `predicate` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `predicate` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -4224,7 +4316,7 @@ * @param {Array} array The array to search. * @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. + * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {number} Returns the index of the found element, else `-1`. * @example @@ -4238,11 +4330,11 @@ * _.findIndex(users, function(chr) { return chr.age < 40; }); * // => 0 * - * // using "_.where" callback shorthand + * // using the "_.matches" callback shorthand * _.findIndex(users, { 'age': 1 }); * // => 2 * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.findIndex(users, 'active'); * // => 1 */ @@ -4263,12 +4355,12 @@ * This method is like `_.findIndex` except that it iterates over elements * of `collection` from right to left. * - * If a property name is provided for `predicate` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `predicate` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -4276,7 +4368,7 @@ * @param {Array} array The array to search. * @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. + * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {number} Returns the index of the found element, else `-1`. * @example @@ -4290,11 +4382,11 @@ * _.findLastIndex(users, function(chr) { return chr.age < 40; }); * // => 2 * - * // using "_.where" callback shorthand + * // using the "_.matches" callback shorthand * _.findLastIndex(users, { 'age': 40 }); * // => 1 * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.findLastIndex(users, 'active'); * // => 0 */ @@ -4555,7 +4647,7 @@ if (typeof fromIndex == 'number') { index = (fromIndex < 0 ? nativeMax(length + fromIndex, 0) : nativeMin(fromIndex || 0, length - 1)) + 1; } else if (fromIndex) { - index = binaryIndex(array, value, null, true) - 1; + index = binaryIndex(array, value, true) - 1; var other = array[index]; return (value === value ? value === other : other !== other) ? index : -1; } @@ -4647,12 +4739,12 @@ * and returns an array of the removed elements. The predicate is bound to * `thisArg` and invoked with three arguments; (value, index, array). * - * If a property name is provided for `predicate` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `predicate` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * **Note:** Unlike `_.filter`, this method mutates `array`. * @@ -4662,7 +4754,7 @@ * @param {Array} array The array to modify. * @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. + * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {Array} Returns the new array of removed elements. * @example @@ -4761,12 +4853,12 @@ * to compute their sort ranking. The iteratee is bound to `thisArg` and * invoked with one argument; (value). * - * If a property name is provided for `iteratee` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `iteratee` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -4775,7 +4867,7 @@ * @param {*} value The value to evaluate. * @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. + * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {number} Returns the index at which `value` should be inserted * into `array`. @@ -4795,13 +4887,15 @@ * }, dict); * // => 1 * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.sortedIndex([{ 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x'); * // => 1 */ function sortedIndex(array, value, iteratee, thisArg) { - iteratee = iteratee == null ? iteratee : getCallback(iteratee, thisArg, 1); - return binaryIndex(array, value, iteratee); + var func = getCallback(iteratee); + return (func === baseCallback && iteratee == null) + ? binaryIndex(array, value) + : binaryIndexBy(array, value, func(iteratee, thisArg, 1)); } /** @@ -4816,7 +4910,7 @@ * @param {*} value The value to evaluate. * @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. + * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {number} Returns the index at which `value` should be inserted * into `array`. @@ -4826,8 +4920,10 @@ * // => 4 */ function sortedLastIndex(array, value, iteratee, thisArg) { - iteratee = iteratee == null ? iteratee : getCallback(iteratee, thisArg, 1); - return binaryIndex(array, value, iteratee, true); + var func = getCallback(iteratee); + return (func === baseCallback && iteratee == null) + ? binaryIndex(array, value, true) + : binaryIndexBy(array, value, func(iteratee, thisArg, 1), true); } /** @@ -4843,7 +4939,7 @@ * @returns {Array} Returns the slice of `array`. * @example * - * _.take([1, 2, 3], 1); + * _.take([1, 2, 3]); * // => [1] * * _.take([1, 2, 3], 2); @@ -4875,7 +4971,7 @@ * @returns {Array} Returns the slice of `array`. * @example * - * _.takeRight([1, 2, 3], 1); + * _.takeRight([1, 2, 3]); * // => [3] * * _.takeRight([1, 2, 3], 2); @@ -4900,12 +4996,12 @@ * taken until `predicate` returns falsey. The predicate is bound to `thisArg` * and invoked with three arguments; (value, index, array). * - * If a property name is provided for `predicate` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `predicate` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -4927,11 +5023,11 @@ * { 'user': 'pebbles', 'status': 'away', 'active': true } * ]; * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.pluck(_.takeRightWhile(users, 'active'), 'user'); * // => ['fred', 'pebbles'] * - * // using "_.where" callback shorthand + * // using the "_.matches" callback shorthand * _.pluck(_.takeRightWhile(users, { 'status': 'away' }), 'user'); * // => ['pebbles'] */ @@ -4948,12 +5044,12 @@ * are taken until `predicate` returns falsey. The predicate is bound to * `thisArg` and invoked with three arguments; (value, index, array). * - * If a property name is provided for `predicate` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `predicate` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -4975,11 +5071,11 @@ * { 'user': 'pebbles', 'status': 'away', 'active': true } * ]; * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.pluck(_.takeWhile(users, 'active'), 'user'); * // => ['barney'] * - * // using "_.where" callback shorthand + * // using the "_.matches" callback shorthand * _.pluck(_.takeWhile(users, { 'status': 'busy' }), 'user'); * // => ['barney', 'fred'] */ @@ -5023,12 +5119,12 @@ * uniqueness is computed. The `iteratee` is bound to `thisArg` and invoked * with three arguments; (value, index, array). * - * If a property name is provided for `iteratee` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `iteratee` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * **Note:** `SameValueZero` comparisons are like strict equality comparisons, * e.g. `===`, except that `NaN` matches `NaN`. See the @@ -5042,8 +5138,8 @@ * @param {Array} array The array to inspect. * @param {boolean} [isSorted] Specify the array is sorted. * @param {Function|Object|string} [iteratee] 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. + * If a property name or object is provided it is used to create a "_.property" + * or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Array} Returns the new duplicate-value-free array. * @example @@ -5059,7 +5155,7 @@ * _.uniq([1, 2.5, 1.5, 2], function(n) { return this.floor(n); }, Math); * // => [1, 2.5] * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); * // => [{ 'x': 1 }, { 'x': 2 }] */ @@ -5074,10 +5170,10 @@ iteratee = isIterateeCall(array, isSorted, thisArg) ? null : isSorted; isSorted = false; } - iteratee = iteratee == null - ? iteratee - : getCallback(iteratee, thisArg, 3); - + var func = getCallback(); + if (!(func === baseCallback && iteratee == null)) { + iteratee = func(iteratee, thisArg, 3); + } return (isSorted && getIndexOf() == baseIndexOf) ? sortedUniq(array, iteratee) : baseUniq(array, iteratee); @@ -5216,7 +5312,7 @@ length = props ? props.length : 0, result = {}; - if (!values && length && !isArray(props[0])) { + if (length && !values && !isArray(props[0])) { values = []; } while (++index < length) { @@ -5382,7 +5478,7 @@ * // => '1,2,3' */ function wrapperToString() { - return String(this.value()); + return (this.value() + ''); } /** @@ -5490,12 +5586,12 @@ * The `iteratee` is bound to `thisArg` and invoked with three arguments; * (value, index|key, collection). * - * If a property name is provided for `iteratee` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `iteratee` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -5503,7 +5599,7 @@ * @param {Array|Object|string} collection The collection to iterate over. * @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. + * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Object} Returns the composed aggregate object. * @example @@ -5526,12 +5622,12 @@ * The predicate is bound to `thisArg` and invoked with three arguments; * (value, index|key, collection). * - * If a property name is provided for `predicate` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `predicate` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -5540,7 +5636,7 @@ * @param {Array|Object|string} collection The collection to iterate over. * @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. + * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {boolean} Returns `true` if all elements pass the predicate check, * else `false`. @@ -5554,11 +5650,11 @@ * { 'user': 'fred', 'age': 40 } * ]; * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.every(users, 'age'); * // => true * - * // using "_.where" callback shorthand + * // using the "_.matches" callback shorthand * _.every(users, { 'age': 36 }); * // => false */ @@ -5575,12 +5671,12 @@ * `predicate` returns truthy for. The predicate is bound to `thisArg` and * invoked with three arguments; (value, index|key, collection). * - * If a property name is provided for `predicate` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `predicate` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -5589,7 +5685,7 @@ * @param {Array|Object|string} collection The collection to iterate over. * @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. + * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {Array} Returns the new filtered array. * @example @@ -5602,11 +5698,11 @@ * { 'user': 'fred', 'age': 40, 'active': true } * ]; * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.pluck(_.filter(users, 'active'), 'user'); * // => ['fred'] * - * // using "_.where" callback shorthand + * // using the "_.matches" callback shorthand * _.pluck(_.filter(users, { 'age': 36 }), 'user'); * // => ['barney'] */ @@ -5622,12 +5718,12 @@ * `predicate` returns truthy for. The predicate is bound to `thisArg` and * invoked with three arguments; (value, index|key, collection). * - * If a property name is provided for `predicate` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `predicate` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -5636,7 +5732,7 @@ * @param {Array|Object|string} collection The collection to search. * @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. + * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {*} Returns the matched element, else `undefined`. * @example @@ -5650,11 +5746,11 @@ * _.result(_.find(users, function(chr) { return chr.age < 40; }), 'user'); * // => 'barney' * - * // using "_.where" callback shorthand + * // using the "_.matches" callback shorthand * _.result(_.find(users, { 'age': 1 }), 'user'); * // => 'pebbles' * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.result(_.find(users, 'active'), 'user'); * // => 'fred' */ @@ -5677,7 +5773,7 @@ * @param {Array|Object|string} collection The collection to search. * @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. + * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {*} Returns the matched element, else `undefined`. * @example @@ -5780,12 +5876,12 @@ * The `iteratee` is bound to `thisArg` and invoked with three arguments; * (value, index|key, collection). * - * If a property name is provided for `iteratee` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `iteratee` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -5793,7 +5889,7 @@ * @param {Array|Object|string} collection The collection to iterate over. * @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. + * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Object} Returns the composed aggregate object. * @example @@ -5804,7 +5900,7 @@ * _.groupBy([4.2, 6.1, 6.4], function(n) { return this.floor(n); }, Math); * // => { '4': [4.2], '6': [6.1, 6.4] } * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.groupBy(['one', 'two', 'three'], 'length'); * // => { '3': ['one', 'two'], '5': ['three'] } */ @@ -5823,12 +5919,12 @@ * iteratee function is bound to `thisArg` and invoked with three arguments; * (value, index|key, collection). * - * If a property name is provided for `iteratee` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `iteratee` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -5836,7 +5932,7 @@ * @param {Array|Object|string} collection The collection to iterate over. * @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. + * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Object} Returns the composed aggregate object. * @example @@ -5890,12 +5986,12 @@ * `iteratee`. The `iteratee` is bound to `thisArg` and invoked with three * arguments; (value, index|key, collection). * - * If a property name is provided for `iteratee` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `iteratee` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -5904,7 +6000,7 @@ * @param {Array|Object|string} collection The collection to iterate over. * @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. + * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Array} Returns the new mapped array. * @example @@ -5920,7 +6016,7 @@ * { 'user': 'fred' } * ]; * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.map(users, 'user'); * // => ['barney', 'fred'] */ @@ -5932,26 +6028,26 @@ } /** - * Retrieves the maximum value of `collection`. If `collection` is empty or - * falsey `-Infinity` is returned. If an iteratee function is provided it is - * invoked for each value in `collection` to generate the criterion by which - * the value is ranked. The `iteratee` is bound to `thisArg` and invoked with - * three arguments; (value, index, collection). + * Gets the maximum value of `collection`. If `collection` is empty or falsey + * `-Infinity` is returned. If an iteratee function is provided it is invoked + * for each value in `collection` to generate the criterion by which the value + * is ranked. The `iteratee` is bound to `thisArg` and invoked with three + * arguments; (value, index, collection). * - * If a property name is provided for `iteratee` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `iteratee` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. * @param {Function|Object|string} [iteratee] 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. + * If a property name or object is provided it is used to create a "_.property" + * or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {*} Returns the maximum value. * @example @@ -5970,59 +6066,33 @@ * _.max(users, function(chr) { return chr.age; }); * // => { 'user': 'fred', 'age': 40 }; * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.max(users, 'age'); * // => { 'user': 'fred', 'age': 40 }; */ - function max(collection, iteratee, thisArg) { - if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { - iteratee = null; - } - var noIteratee = iteratee == null, - isArr = noIteratee && isArray(collection), - isStr = !isArr && isString(collection); - - if (noIteratee && !isStr) { - 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; - } + var max = createExtremum(arrayMax); /** - * Retrieves the minimum value of `collection`. If `collection` is empty or - * falsey `Infinity` is returned. If an iteratee function is provided it is - * invoked for each value in `collection` to generate the criterion by which - * the value is ranked. The `iteratee` is bound to `thisArg` and invoked with - * three arguments; (value, index, collection). + * Gets the minimum value of `collection`. If `collection` is empty or falsey + * `Infinity` is returned. If an iteratee function is provided it is invoked + * for each value in `collection` to generate the criterion by which the value + * is ranked. The `iteratee` is bound to `thisArg` and invoked with three + * arguments; (value, index, collection). * - * If a property name is provided for `iteratee` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `iteratee` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. * @param {Function|Object|string} [iteratee] 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. + * If a property name or object is provided it is used to create a "_.property" + * or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {*} Returns the minimum value. * @example @@ -6041,37 +6111,11 @@ * _.min(users, function(chr) { return chr.age; }); * // => { 'user': 'barney', 'age': 36 }; * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.min(users, 'age'); * // => { 'user': 'barney', 'age': 36 }; */ - function min(collection, iteratee, thisArg) { - if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { - iteratee = null; - } - var noIteratee = iteratee == null, - isArr = noIteratee && isArray(collection), - isStr = !isArr && isString(collection); - - if (noIteratee && !isStr) { - 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; - } + var min = createExtremum(arrayMin, true); /** * Creates an array of elements split into two groups, the first of which @@ -6079,12 +6123,12 @@ * contains elements `predicate` returns falsey for. The predicate is bound * to `thisArg` and invoked with three arguments; (value, index|key, collection). * - * If a property name is provided for `predicate` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `predicate` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -6092,7 +6136,7 @@ * @param {Array|Object|string} collection The collection to iterate over. * @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. + * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {Array} Returns the array of grouped elements. * @example @@ -6109,11 +6153,11 @@ * { 'user': 'pebbles', 'age': 1, 'active': false } * ]; * - * // using "_.where" callback shorthand + * // using the "_.matches" callback shorthand * _.map(_.partition(users, { 'age': 1 }), function(array) { return _.pluck(array, 'user'); }); * // => [['pebbles'], ['barney', 'fred']] * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.map(_.partition(users, 'active'), function(array) { return _.pluck(array, 'user'); }); * // => [['fred'], ['barney', 'pebbles']] */ @@ -6122,7 +6166,7 @@ }, function() { return [[], []]; }); /** - * Retrieves the value of a specified property from all elements in `collection`. + * Gets the value of a specified property from all elements in `collection`. * * @static * @memberOf _ @@ -6209,12 +6253,12 @@ * The opposite of `_.filter`; this method returns the elements of `collection` * that `predicate` does **not** return truthy for. * - * If a property name is provided for `predicate` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `predicate` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -6222,7 +6266,7 @@ * @param {Array|Object|string} collection The collection to iterate over. * @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. + * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {Array} Returns the new filtered array. * @example @@ -6235,11 +6279,11 @@ * { 'user': 'fred', 'age': 40, 'active': true } * ]; * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.pluck(_.reject(users, 'active'), 'user'); * // => ['barney'] * - * // using "_.where" callback shorthand + * // using the "_.matches" callback shorthand * _.pluck(_.reject(users, { 'age': 36 }), 'user'); * // => ['fred'] */ @@ -6253,7 +6297,7 @@ } /** - * Retrieves a random element or `n` random elements from a collection. + * Gets a random element or `n` random elements from a collection. * * @static * @memberOf _ @@ -6321,7 +6365,7 @@ * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to inspect. - * @returns {number} Returns `collection.length` or number of own enumerable properties. + * @returns {number} Returns the size of `collection`. * @example * * _.size([1, 2]); @@ -6344,12 +6388,12 @@ * over the entire collection. The predicate is bound to `thisArg` and invoked * with three arguments; (value, index|key, collection). * - * If a property name is provided for `predicate` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `predicate` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -6358,7 +6402,7 @@ * @param {Array|Object|string} collection The collection to iterate over. * @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. + * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {boolean} Returns `true` if any element passes the predicate check, * else `false`. @@ -6372,11 +6416,11 @@ * { 'user': 'fred', 'age': 40, 'active': true } * ]; * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.some(users, 'active'); * // => true * - * // using "_.where" callback shorthand + * // using the "_.matches" callback shorthand * _.some(users, { 'age': 1 }); * // => false */ @@ -6395,12 +6439,12 @@ * The `iteratee` is bound to `thisArg` and invoked with three arguments; * (value, index|key, collection). * - * If a property name is provided for `iteratee` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `iteratee` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -6408,7 +6452,7 @@ * @param {Array|Object|string} collection The collection to iterate over. * @param {Array|Function|Object|string} [iteratee=_.identity] The function * invoked per iteration. If a property name or an object is provided it is - * used to create a "_.pluck" or "_.where" style callback respectively. + * used to create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Array} Returns the new sorted array. * @example @@ -6425,7 +6469,7 @@ * { 'user': 'barney' } * ]; * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.pluck(_.sortBy(users, 'user'), 'user'); * // => ['barney', 'fred', 'pebbles'] */ @@ -6936,13 +6980,13 @@ * jQuery('#postbox').on('click', _.debounce(sendMail, 300, { * 'leading': true, * 'trailing': false - * }); + * })); * * // ensure `batchLog` is invoked once after 1 second of debounced calls * var source = new EventSource('/stream'); * jQuery(source).on('message', _.debounce(batchLog, 250, { * 'maxWait': 1000 - * }, false); + * })); * * // cancel a debounced call * var todoChanges = _.debounce(batchLog, 1000); @@ -7227,14 +7271,6 @@ * @returns {Function} Returns the new memoizing function. * @example * - * var fibonacci = _.memoize(function(n) { - * return n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2); - * }); - * - * fibonacci(9) - * // => 34 - * - * // modifying the result cache * var upperCase = _.memoize(function(string) { * return string.toUpperCase(); * }); @@ -7242,9 +7278,28 @@ * upperCase('fred'); * // => 'FRED' * + * // modifying the result cache * upperCase.cache.set('fred, 'BARNEY'); * upperCase('fred'); * // => 'BARNEY' + * + * // replacing `_.memoize.Cache` + * var object = { 'user': 'fred' }; + * var other = { 'user': 'barney' }; + * var identity = _.memoize(_.identity); + * + * identity(object); + * // => { 'user': 'fred' } + * identity(other); + * // => { 'user': 'fred' } + * + * _.memoize.Cache = WeakMap; + * var identity = _.memoize(_.identity); + * + * identity(object); + * // => { 'user': 'fred' } + * identity(other); + * // => { 'user': 'barney' } */ function memoize(func, resolver) { if (!isFunction(func) || (resolver && !isFunction(resolver))) { @@ -7503,7 +7558,7 @@ */ function wrap(value, wrapper) { wrapper = wrapper == null ? identity : wrapper; - return createWrapper(wrapper, PARTIAL_FLAG, null, [value]); + return createWrapper(wrapper, PARTIAL_FLAG, null, [value], []); } /*------------------------------------------------------------------------*/ @@ -7513,7 +7568,7 @@ * otherwise they are assigned by reference. If `customizer` is provided it is * invoked to produce the cloned values. If `customizer` returns `undefined` * cloning is handled by the method instead. The `customizer` is bound to - * `thisArg` and invoked with two argument; (value, index|key). + * `thisArg` and invoked with two argument; (value [, index|key, object]). * * **Note:** This method is loosely based on the structured clone algorithm. * The enumerable properties of `arguments` objects and objects created by @@ -7545,14 +7600,16 @@ * deep[0] === users[0]; * // => false * - * _.mixin({ - * 'clone': _.partialRight(_.clone, function(value) { - * return _.isElement(value) ? value.cloneNode(false) : undefined; - * }) + * // using a customizer callback + * var body = _.clone(document.body, function(value) { + * return _.isElement(value) ? value.cloneNode(false) : undefined; * }); * - * var clone = _.clone(document.body); - * clone.childNodes.length; + * body === document.body + * // => false + * body.nodeName + * // => BODY + * body.childNodes.length; * // => 0 */ function clone(value, isDeep, customizer, thisArg) { @@ -7570,7 +7627,7 @@ * Creates a deep clone of `value`. If `customizer` is provided it is invoked * to produce the cloned values. If `customizer` returns `undefined` cloning * is handled by the method instead. The `customizer` is bound to `thisArg` - * and invoked with two argument; (value, index|key). + * and invoked with two argument; (value [, index|key, object]). * * **Note:** This method is loosely based on the structured clone algorithm. * The enumerable properties of `arguments` objects and objects created by @@ -7597,17 +7654,17 @@ * deep[0] === users[0]; * // => false * - * var view = { - * 'label': 'docs', - * 'node': element - * }; - * - * var clone = _.cloneDeep(view, function(value) { + * // using a customizer callback + * var el = _.cloneDeep(document.body, function(value) { * return _.isElement(value) ? value.cloneNode(true) : undefined; * }); * - * clone.node == view.node; + * body === document.body * // => false + * body.nodeName + * // => BODY + * body.childNodes.length; + * // => 20 */ function cloneDeep(value, customizer, thisArg) { customizer = typeof customizer == 'function' && bindCallback(customizer, thisArg, 1); @@ -7632,10 +7689,10 @@ */ function isArguments(value) { var length = isObjectLike(value) ? value.length : undefined; - return (isLength(length) && toString.call(value) == argsClass) || false; + return (isLength(length) && objToString.call(value) == argsTag) || false; } - // Fallback for environments without a `[[Class]]` for `arguments` objects. - if (!support.argsClass) { + // Fallback for environments without a `toStringTag` for `arguments` objects. + if (!support.argsTag) { isArguments = function(value) { var length = isObjectLike(value) ? value.length : undefined; return (isLength(length) && hasOwnProperty.call(value, 'callee') && @@ -7660,7 +7717,7 @@ * // => false */ var isArray = nativeIsArray || function(value) { - return (isObjectLike(value) && isLength(value.length) && toString.call(value) == arrayClass) || false; + return (isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag) || false; }; /** @@ -7680,7 +7737,7 @@ * // => false */ function isBoolean(value) { - return (value === true || value === false || isObjectLike(value) && toString.call(value) == boolClass) || false; + return (value === true || value === false || isObjectLike(value) && objToString.call(value) == boolTag) || false; } /** @@ -7700,7 +7757,7 @@ * // => false */ function isDate(value) { - return (isObjectLike(value) && toString.call(value) == dateClass) || false; + return (isObjectLike(value) && objToString.call(value) == dateTag) || false; } /** @@ -7721,7 +7778,7 @@ */ function isElement(value) { return (value && value.nodeType === 1 && isObjectLike(value) && - (lodash.support.nodeClass ? toString.call(value).indexOf('Element') > -1 : isHostObject(value))) || false; + (lodash.support.nodeTag ? objToString.call(value).indexOf('Element') > -1 : isHostObject(value))) || false; } // Fallback for environments without DOM support. if (!support.dom) { @@ -7774,7 +7831,7 @@ * equivalent. If `customizer` is provided it is invoked to compare values. * If `customizer` returns `undefined` comparisons are handled by the method * instead. The `customizer` is bound to `thisArg` and invoked with three - * arguments; (value, other, key). + * arguments; (value, other [, index|key]). * * **Note:** This method supports comparing arrays, booleans, `Date` objects, * numbers, `Object` objects, regexes, and strings. Functions and DOM nodes @@ -7800,10 +7857,11 @@ * _.isEqual(object, other); * // => true * - * var words = ['hello', 'goodbye']; - * var otherWords = ['hi', 'goodbye']; + * // using a customizer callback + * var array = ['hello', 'goodbye']; + * var other = ['hi', 'goodbye']; * - * _.isEqual(words, otherWords, function(value, other) { + * _.isEqual(array, other, function(value, other) { * return _.every([value, other], RegExp.prototype.test, /^h(?:i|ello)$/) || undefined; * }); * // => true @@ -7835,14 +7893,14 @@ * // => false */ function isError(value) { - return (isObjectLike(value) && typeof value.message == 'string' && toString.call(value) == errorClass) || false; + return (isObjectLike(value) && typeof value.message == 'string' && objToString.call(value) == errorTag) || false; } /** * Checks if `value` is a finite primitive number. * * **Note:** This method is based on ES6 `Number.isFinite`. See the - * [ES6 spec](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isfinite) + * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isfinite) * for more details. * * @static @@ -7896,10 +7954,9 @@ if (isFunction(/x/) || (Uint8Array && !isFunction(Uint8Array))) { isFunction = function(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in older versions of Chrome and Safari which return 'function' for - // regexes and Safari 8 equivalents which return 'object' for typed - // array constructors. - return toString.call(value) == funcClass; + // in older versions of Chrome and Safari which return 'function' for regexes + // and Safari 8 equivalents which return 'object' for typed array constructors. + return objToString.call(value) == funcTag; }; } @@ -7937,7 +7994,7 @@ * `object` contains equivalent property values. If `customizer` is provided * it is invoked to compare values. If `customizer` returns `undefined` * comparisons are handled by the method instead. The `customizer` is bound - * to `thisArg` and invoked with three arguments; (value, other, key). + * to `thisArg` and invoked with three arguments; (value, other, index|key). * * **Note:** This method supports comparing properties of arrays, booleans, * `Date` objects, numbers, `Object` objects, regexes, and strings. Functions @@ -7962,6 +8019,7 @@ * _.isMatch(object, { 'age': 36 }); * // => false * + * // using a customizer callback * var object = { 'greeting': 'hello' }; * var source = { 'greeting': 'hi' }; * @@ -8020,8 +8078,8 @@ * // => false */ function isNaN(value) { - // `NaN` as a primitive is the only value that is not equal to itself - // (perform the `[[Class]]` check first to avoid errors with some host objects in IE). + // An `NaN` primitive is the only value that is not equal to itself. + // Perform the `toStringTag` check first to avoid errors with some host objects in IE. return isNumber(value) && value != +value; } @@ -8045,7 +8103,7 @@ if (value == null) { return false; } - if (toString.call(value) == funcClass) { + if (objToString.call(value) == funcTag) { return reNative.test(fnToString.call(value)); } return (isObjectLike(value) && @@ -8095,7 +8153,7 @@ * // => false */ function isNumber(value) { - return typeof value == 'number' || (isObjectLike(value) && toString.call(value) == numberClass) || false; + return typeof value == 'number' || (isObjectLike(value) && objToString.call(value) == numberTag) || false; } /** @@ -8130,7 +8188,7 @@ * // => true */ var isPlainObject = !getPrototypeOf ? shimIsPlainObject : function(value) { - if (!(value && toString.call(value) == objectClass) || (!lodash.support.argsClass && isArguments(value))) { + if (!(value && objToString.call(value) == objectTag) || (!lodash.support.argsTag && isArguments(value))) { return false; } var valueOf = value.valueOf, @@ -8158,7 +8216,7 @@ * // => false */ function isRegExp(value) { - return (isObject(value) && toString.call(value) == regexpClass) || false; + return (isObject(value) && objToString.call(value) == regexpTag) || false; } /** @@ -8178,7 +8236,7 @@ * // => false */ function isString(value) { - return typeof value == 'string' || (isObjectLike(value) && toString.call(value) == stringClass) || false; + return typeof value == 'string' || (isObjectLike(value) && objToString.call(value) == stringTag) || false; } /** @@ -8218,12 +8276,13 @@ * @param {...Object} [sources] The source objects. * @param {Function} [customizer] The function to customize assigning values. * @param {*} [thisArg] The `this` binding of `customizer`. - * @returns {Object} Returns the destination object. + * @returns {Object} Returns `object`. * @example * * _.assign({ 'user': 'barney' }, { 'age': 40 }, { 'user': 'fred', 'status': 'busy' }); * // => { 'user': 'fred', 'age': 40, 'status': 'busy' } * + * // using a customizer callback * var defaults = _.partialRight(_.assign, function(value, other) { * return typeof value == 'undefined' ? other : value; * }); @@ -8283,7 +8342,7 @@ * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. - * @returns {Object} Returns the destination object. + * @returns {Object} Returns `object`. * @example * * _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred', 'status': 'busy' }); @@ -8302,12 +8361,12 @@ * This method is like `_.findIndex` except that it returns the key of the * first element `predicate` returns truthy for, instead of the element itself. * - * If a property name is provided for `predicate` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `predicate` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -8315,7 +8374,7 @@ * @param {Object} object The object to search. * @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. + * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {string|undefined} Returns the key of the matched element, else `undefined`. * @example @@ -8329,11 +8388,11 @@ * _.findKey(users, function(chr) { return chr.age < 40; }); * // => 'barney' (iteration order is not guaranteed) * - * // using "_.where" callback shorthand + * // using the "_.matches" callback shorthand * _.findKey(users, { 'age': 1 }); * // => 'pebbles' * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.findKey(users, 'active'); * // => 'barney' */ @@ -8346,12 +8405,12 @@ * This method is like `_.findKey` except that it iterates over elements of * a collection in the opposite order. * - * If a property name is provided for `predicate` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `predicate` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -8359,7 +8418,7 @@ * @param {Object} object The object to search. * @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. + * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {string|undefined} Returns the key of the matched element, else `undefined`. * @example @@ -8373,11 +8432,11 @@ * _.findLastKey(users, function(chr) { return chr.age < 40; }); * // => returns `pebbles` assuming `_.findKey` returns `barney` * - * // using "_.where" callback shorthand + * // using the "_.matches" callback shorthand * _.findLastKey(users, { 'age': 40 }); * // => 'fred' * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.findLastKey(users, 'active'); * // => 'pebbles' */ @@ -8593,6 +8652,10 @@ /** * Creates an array of the own enumerable property names of `object`. * + * **Note:** Non-object values are coerced to objects. See the + * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.keys) + * for more details. + * * @static * @memberOf _ * @category Object @@ -8609,6 +8672,9 @@ * * _.keys(new Shape); * // => ['x', 'y'] (iteration order is not guaranteed) + * + * _.keys('hi'); + * // => ['0', '1'] */ var keys = !nativeKeys ? shimKeys : function(object) { if (object) { @@ -8625,6 +8691,8 @@ /** * Creates an array of the own and inherited enumerable property names of `object`. * + * **Note:** Non-object values are coerced to objects. + * * @static * @memberOf _ * @category Object @@ -8666,7 +8734,7 @@ skipProto = support.enumPrototypes && typeof object == 'function'; while (++index < length) { - result[index] = String(index); + result[index] = (index + ''); } // Lo-Dash skips the `constructor` property when it infers it is iterating // over a `prototype` object because IE < 9 can't set the `[[Enumerable]]` @@ -8681,10 +8749,10 @@ } } if (support.nonEnumShadows && object !== objectProto) { - var className = object === stringProto ? stringClass : object === errorProto ? errorClass : toString.call(object), - nonEnums = nonEnumProps[className] || nonEnumProps[objectClass]; + var tag = object === stringProto ? stringTag : object === errorProto ? errorTag : objToString.call(object), + nonEnums = nonEnumProps[tag] || nonEnumProps[objectTag]; - if (className == objectClass) { + if (tag == objectTag) { proto = objectProto; } length = shadowProps.length; @@ -8706,12 +8774,12 @@ * iteratee function is bound to `thisArg` and invoked with three arguments; * (value, key, object). * - * If a property name is provided for `iteratee` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `iteratee` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `iteratee` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `iteratee` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -8719,7 +8787,7 @@ * @param {Object} object The object to iterate over. * @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. + * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Object} Returns the new mapped object. * @example @@ -8732,9 +8800,9 @@ * 'pebbles': { 'user': 'pebbles', 'age': 1 } * }; * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.mapValues(users, 'age'); - * // => { 'fred': 40, 'pebbles': 1 } + * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) */ function mapValues(object, iteratee, thisArg) { iteratee = getCallback(iteratee, thisArg, 3); @@ -8762,7 +8830,7 @@ * @param {...Object} [sources] The source objects. * @param {Function} [customizer] The function to customize merging properties. * @param {*} [thisArg] The `this` binding of `customizer`. - * @returns {Object} Returns the destination object. + * @returns {Object} Returns `object`. * @example * * var users = { @@ -8776,17 +8844,18 @@ * _.merge(users, ages); * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] } * - * var food = { + * // using a customizer callback + * var object = { * 'fruits': ['apple'], * 'vegetables': ['beet'] * }; * - * var otherFood = { + * var other = { * 'fruits': ['banana'], * 'vegetables': ['carrot'] * }; * - * _.merge(food, otherFood, function(a, b) { + * _.merge(object, other, function(a, b) { * return _.isArray(a) ? a.concat(b) : undefined; * }); * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] } @@ -8829,7 +8898,7 @@ var props = arrayMap(baseFlatten(arguments, false, false, 1), String); return pickByArray(object, baseDifference(keysIn(object), props)); } - predicate = getCallback(predicate, thisArg, 3); + predicate = bindCallback(predicate, thisArg, 3); return pickByCallback(object, function(value, key, object) { return !predicate(value, key, object); }); @@ -8893,7 +8962,7 @@ return {}; } return typeof predicate == 'function' - ? pickByCallback(object, getCallback(predicate, thisArg, 3)) + ? pickByCallback(object, bindCallback(predicate, thisArg, 3)) : pickByArray(object, baseFlatten(arguments, false, false, 1)); } @@ -8991,6 +9060,8 @@ /** * Creates an array of the own enumerable property values of `object`. * + * **Note:** Non-object values are coerced to objects. + * * @static * @memberOf _ * @category Object @@ -9007,6 +9078,9 @@ * * _.values(new Shape(2, 1)); * // => [2, 1] (iteration order is not guaranteed) + * + * _.values('hi'); + * // => ['h', 'i'] */ function values(object) { return baseValues(object, keys(object)); @@ -9016,6 +9090,8 @@ * Creates an array of the own and inherited enumerable property values * of `object`. * + * **Note:** Non-object values are coerced to objects. + * * @static * @memberOf _ * @category Object @@ -9096,7 +9172,7 @@ } if (floating || min % 1 || max % 1) { var rand = nativeRandom(); - return nativeMin(min + (rand * (max - min + parseFloat('1e-' + (String(rand).length - 1)))), max); + return nativeMin(min + (rand * (max - min + parseFloat('1e-' + ((rand + '').length - 1)))), max); } return baseRandom(min, max); } @@ -9114,14 +9190,14 @@ * @returns {string} Returns the camel cased string. * @example * - * _.camelCase('Hello world'); - * // => 'helloWorld' + * _.camelCase('Foo Bar'); + * // => 'fooBar' * - * _.camelCase('--hello-world'); - * // => 'helloWorld' + * _.camelCase('--foo-bar'); + * // => 'fooBar' * - * _.camelCase('__hello_world__'); - * // => 'helloWorld' + * _.camelCase('__foo_bar__'); + * // => 'fooBar' */ var camelCase = createCompounder(function(result, word, index) { word = word.toLowerCase(); @@ -9142,8 +9218,8 @@ * // => 'Fred' */ function capitalize(string) { - string = string == null ? '' : String(string); - return string ? (string.charAt(0).toUpperCase() + string.slice(1)) : string; + string = toString(string); + return string && (string.charAt(0).toUpperCase() + string.slice(1)); } /** @@ -9162,8 +9238,8 @@ * // => 'deja vu' */ function deburr(string) { - string = string == null ? '' : String(string); - return string ? string.replace(reLatin1, deburrLetter) : string; + string = toString(string); + return string && string.replace(reLatin1, deburrLetter); } /** @@ -9188,8 +9264,8 @@ * // => true */ function endsWith(string, target, position) { - string = string == null ? '' : String(string); - target = String(target); + string = toString(string); + target = (target + ''); var length = string.length; position = (typeof position == 'undefined' ? length : nativeMin(position < 0 ? 0 : (+position || 0), length)) - target.length; @@ -9230,7 +9306,7 @@ */ function escape(string) { // Reset `lastIndex` because in IE < 9 `String#replace` does not. - string = string == null ? '' : String(string); + string = toString(string); return (string && reHasUnescapedHtml.test(string)) ? string.replace(reUnescapedHtml, escapeHtmlChar) : string; @@ -9251,7 +9327,7 @@ * // => '\[lodash\]\(https://lodash\.com/\)' */ function escapeRegExp(string) { - string = string == null ? '' : String(string); + string = toString(string); return (string && reHasRegExpChars.test(string)) ? string.replace(reRegExpChars, '\\$&') : string; @@ -9269,14 +9345,14 @@ * @returns {string} Returns the kebab cased string. * @example * - * _.kebabCase('Hello world'); - * // => 'hello-world' + * _.kebabCase('Foo Bar'); + * // => 'foo-bar' * - * _.kebabCase('helloWorld'); - * // => 'hello-world' + * _.kebabCase('fooBar'); + * // => 'foo-bar' * - * _.kebabCase('__hello_world__'); - * // => 'hello-world' + * _.kebabCase('__foo_bar__'); + * // => 'foo-bar' */ var kebabCase = createCompounder(function(result, word, index) { return result + (index ? '-' : '') + word.toLowerCase(); @@ -9306,7 +9382,7 @@ * // => 'abc' */ function pad(string, length, chars) { - string = string == null ? '' : String(string); + string = toString(string); length = +length; var strLength = string.length; @@ -9345,8 +9421,8 @@ * // => 'abc' */ function padLeft(string, length, chars) { - string = string == null ? '' : String(string); - return string ? (createPad(string, length, chars) + string) : string; + string = toString(string); + return string && (createPad(string, length, chars) + string); } /** @@ -9373,8 +9449,8 @@ * // => 'abc' */ function padRight(string, length, chars) { - string = string == null ? '' : String(string); - return string ? (string + createPad(string, length, chars)) : string; + string = toString(string); + return string && (string + createPad(string, length, chars)); } /** @@ -9396,6 +9472,9 @@ * * _.parseInt('08'); * // => 8 + * + * _.map(['6', '08', '10'], _.parseInt); + * // => [6, 8, 10] */ function parseInt(string, radix, guard) { if (guard && isIterateeCall(string, radix, guard)) { @@ -9409,7 +9488,11 @@ // Firefox < 21 and Opera < 15 follow ES3 for `parseInt` and // Chrome fails to trim leading whitespace characters. // See https://code.google.com/p/v8/issues/detail?id=3109. - radix = (guard && isIterateeCall(string, radix, guard)) ? 0 : +radix; + if (guard ? isIterateeCall(string, radix, guard) : radix == null) { + radix = 0; + } else if (radix) { + radix = +radix; + } string = trim(string); return nativeParseInt(string, radix || (reHexPrefix.test(string) ? 16 : 10)); }; @@ -9442,7 +9525,7 @@ if (n < 1 || string == null || !nativeIsFinite(n)) { return result; } - string = String(string); + string = (string + ''); // Leverage the exponentiation by squaring algorithm for a faster repeat. // See http://en.wikipedia.org/wiki/Exponentiation_by_squaring. @@ -9468,14 +9551,14 @@ * @returns {string} Returns the snake cased string. * @example * - * _.snakeCase('Hello world'); - * // => 'hello_world' + * _.snakeCase('Foo Bar'); + * // => 'foo_bar' * - * _.snakeCase('--hello-world'); - * // => 'hello_world' + * _.snakeCase('--foo-bar'); + * // => 'foo_bar' * - * _.snakeCase('helloWorld'); - * // => 'hello_world' + * _.snakeCase('fooBar'); + * // => 'foo_bar' */ var snakeCase = createCompounder(function(result, word, index) { return result + (index ? '_' : '') + word.toLowerCase(); @@ -9503,8 +9586,8 @@ * // => true */ function startsWith(string, target, position) { - string = string == null ? '' : String(string); - position = typeof position == 'undefined' ? 0 : nativeMin(position < 0 ? 0 : (+position || 0), string.length); + string = toString(string); + position = position == null ? 0 : nativeMin(position < 0 ? 0 : (+position || 0), string.length); return string.lastIndexOf(target, position) == position; } @@ -9612,7 +9695,7 @@ if (otherOptions && isIterateeCall(string, options, otherOptions)) { options = otherOptions = null; } - string = String(string == null ? '' : string); + string = toString(string); options = baseAssign(baseAssign({}, otherOptions || options), settings, assignOwnDefaults); var imports = baseAssign(baseAssign({}, options.imports), settings.imports, assignOwnDefaults), @@ -9638,7 +9721,7 @@ var sourceURL = '//# sourceURL=' + ('sourceURL' in options ? options.sourceURL - : ('/lodash/template/source[' + (++templateCounter) + ']') + : ('lodash.templateSources[' + (++templateCounter) + ']') ) + '\n'; string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) { @@ -9723,22 +9806,25 @@ * @returns {string} Returns the trimmed string. * @example * - * _.trim(' fred '); - * // => 'fred' + * _.trim(' abc '); + * // => 'abc' * - * _.trim('-_-fred-_-', '_-'); - * // => 'fred' + * _.trim('-_-abc-_-', '_-'); + * // => 'abc' + * + * _.map([' foo ', ' bar '], _.trim); + * // => ['foo', 'bar] */ function trim(string, chars, guard) { var value = string; - string = string == null ? '' : String(string); + string = toString(string); if (!string) { return string; } if (guard ? isIterateeCall(value, chars, guard) : chars == null) { return string.slice(trimmedLeftIndex(string), trimmedRightIndex(string) + 1); } - chars = String(chars); + chars = (chars + ''); return string.slice(charsLeftIndex(string, chars), charsRightIndex(string, chars) + 1); } @@ -9754,23 +9840,22 @@ * @returns {string} Returns the trimmed string. * @example * - * _.trimLeft(' fred '); - * // => 'fred ' + * _.trimLeft(' abc '); + * // => 'abc ' * - * _.trimLeft('-_-fred-_-', '_-'); - * // => 'fred-_-' + * _.trimLeft('-_-abc-_-', '_-'); + * // => 'abc-_-' */ function trimLeft(string, chars, guard) { var value = string; - string = string == null ? '' : String(string); + string = toString(string); if (!string) { return string; } if (guard ? isIterateeCall(value, chars, guard) : chars == null) { return string.slice(trimmedLeftIndex(string)) } - chars = String(chars); - return string.slice(charsLeftIndex(string, chars)); + return string.slice(charsLeftIndex(string, (chars + ''))); } /** @@ -9785,23 +9870,22 @@ * @returns {string} Returns the trimmed string. * @example * - * _.trimRight(' fred '); - * // => ' fred' + * _.trimRight(' abc '); + * // => ' abc' * - * _.trimRight('-_-fred-_-', '_-'); - * // => '-_-fred' + * _.trimRight('-_-abc-_-', '_-'); + * // => '-_-abc' */ function trimRight(string, chars, guard) { var value = string; - string = string == null ? '' : String(string); + string = toString(string); if (!string) { return string; } if (guard ? isIterateeCall(value, chars, guard) : chars == null) { return string.slice(0, trimmedRightIndex(string) + 1) } - chars = String(chars); - return string.slice(0, charsRightIndex(string, chars) + 1); + return string.slice(0, charsRightIndex(string, (chars + '')) + 1); } /** @@ -9843,15 +9927,16 @@ var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION; - if (isObject(options)) { - var separator = 'separator' in options ? options.separator : separator; - length = 'length' in options ? +options.length || 0 : length; - omission = 'omission' in options ? String(options.omission) : omission; + if (options != null) { + if (isObject(options)) { + var separator = 'separator' in options ? options.separator : separator; + length = 'length' in options ? +options.length || 0 : length; + omission = 'omission' in options ? (options.omission + '') : omission; + } else { + length = +options || 0; + } } - else if (options != null) { - length = +options || 0; - } - string = string == null ? '' : String(string); + string = toString(string); if (length >= string.length) { return string; } @@ -9906,7 +9991,7 @@ * // => 'fred, barney, & pebbles' */ function unescape(string) { - string = string == null ? '' : String(string); + string = toString(string); return (string && reHasEscapedHtml.test(string)) ? string.replace(reEscapedHtml, unescapeHtmlChar) : string; @@ -9934,8 +10019,8 @@ if (guard && isIterateeCall(string, pattern, guard)) { pattern = null; } - string = string != null && String(string); - return (string && string.match(pattern || reWords)) || []; + string = toString(string); + return string.match(pattern || reWords) || []; } /*------------------------------------------------------------------------*/ @@ -10050,7 +10135,7 @@ } /** - * Creates a "_.where" style predicate function which performs a deep comparison + * Creates a "_.matches" style predicate function which performs a deep comparison * between a given object and `source`, returning `true` if the given object * has equivalent property values, else `false`. * @@ -10112,48 +10197,51 @@ * // => ['e'] */ function mixin(object, source, options) { - var chain = true, - isObj = isObject(source), - noOpts = options == null, - props = noOpts && isObj && keys(source), - methodNames = props && baseFunctions(source, props); + if (options == null) { + var isObj = isObject(source), + props = isObj && keys(source), + methodNames = props && props.length && baseFunctions(source, props); - if ((props && props.length && !methodNames.length) || (noOpts && !isObj)) { - if (noOpts) { + if (!(methodNames ? methodNames.length : isObj)) { + methodNames = false; options = source; + source = object; + object = this; } - methodNames = false; - source = object; - object = this; } - methodNames || (methodNames = baseFunctions(source, keys(source))); + if (!methodNames) { + methodNames = baseFunctions(source, keys(source)); + } + var chain = true, + index = -1, + isFunc = isFunction(object), + length = methodNames.length; + if (options === false) { chain = false; } else if (isObject(options) && 'chain' in options) { chain = options.chain; } - var index = -1, - isFunc = isFunction(object), - length = methodNames.length; - while (++index < length) { - var methodName = methodNames[index]; - object[methodName] = source[methodName]; + var methodName = methodNames[index], + func = source[methodName]; + + object[methodName] = func; if (isFunc) { - object.prototype[methodName] = (function(methodName) { + object.prototype[methodName] = (function(func) { return function() { var chainAll = this.__chain__; if (chain || chainAll) { var result = object(this.__wrapped__); - (result.__actions__ = baseSlice(this.__actions__)).push({ 'args': arguments, 'object': object, 'name': methodName }); + (result.__actions__ = baseSlice(this.__actions__)).push({ 'func': func, 'args': arguments, 'thisArg': object }); result.__chain__ = chainAll; return result; } var args = [this.value()]; push.apply(args, arguments); - return object[methodName].apply(object, args); + return func.apply(object, args); }; - }(methodName)); + }(func)); } } return object; @@ -10193,13 +10281,13 @@ } /** - * Creates a "_.pluck" style function which returns the property value + * Creates a "_.property" style function which returns the property value * of `key` on a given object. * * @static * @memberOf _ * @category Utility - * @param {string} key The name of the property to retrieve. + * @param {string} key The name of the property to get. * @returns {Function} Returns the new function. * @example * @@ -10217,7 +10305,7 @@ * // => ['barney', 'fred'] */ function property(key) { - return baseProperty(String(key)); + return baseProperty(key + ''); } /** @@ -10366,7 +10454,7 @@ */ function uniqueId(prefix) { var id = ++idCounter; - return String(prefix == null ? '' : prefix) + id; + return toString(prefix) + id; } /*------------------------------------------------------------------------*/ @@ -10606,10 +10694,10 @@ lodash.prototype.sample = function(n) { if (!this.__chain__ && n == null) { - return lodash.sample(this.value()); + return sample(this.value()); } return this.thru(function(value) { - return lodash.sample(value, n); + return sample(value, n); }); }; @@ -10763,7 +10851,7 @@ if (!retUnwrapped && (isHybrid || result.actions)) { var actions = result.actions || (result.actions = []); - actions.push({ 'args': [interceptor], 'object': lodash, 'name': 'thru' }); + actions.push({ 'func': thru, 'args': [interceptor], 'thisArg': lodash }); } return new LodashWrapper(result, chainAll); } diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index b21423df8..78e3bc453 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -5,84 +5,84 @@ */ ;(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 A(n,t){for(var r=-1,e=n.length,u=-1,o=[];++re&&(e=u)}return e}function Xt(n){for(var t=-1,r=n.length,e=lo;++to(t,a)&&e.push(a);return e}function fr(n,t){var r=n?n.length:0;if(!oe(r))return yr(n,t);for(var e=-1,u=pe(n);++ee(a,s)&&((t||i)&&a.push(s),l.push(c))}return l}function Ur(n,t){for(var r=-1,e=t.length,u=yu(e);++rpo)){u=r,u=null==u?pu:u,t=u(t),o=0,r=n.length;for(var i=t!==t,a=typeof t=="undefined";o>>1,i=n[r],(e?i<=t:it||null==r)return r; -if(3=o&&r<=i&&(e=L&&t>u||e>u&&t>=L)||o)&&(t&k&&(n[2]=h[2],r|=e&k?0:U),(e=h[3])&&(u=n[3],n[3]=u?$r(u,e,h[4]):l(e),n[4]=u?A(n[3],Y):l(h[4])),(e=h[5])&&(u=n[5],n[5]=u?Pr(u,e,h[6]):l(e),n[6]=u?A(n[5],Y):l(h[6])),(e=h[7])&&(n[7]=l(e)),t&$&&(n[8]=null==n[8]?h[8]:eo(n[8],h[8])),null==n[9]&&(n[9]=h[9]),n[0]=h[0],n[1]=r) -}return n[9]=null==n[9]?f?0:n[0].length:ro(n[9]-c,0)||0,t=n[1],(h?wo:jo)(t==k?Dr(n[0],n[2]):t!=W&&t!=(k|W)||n[4].length?Kr.apply(null,n):Yr.apply(null,n),n)}function Gr(n,t,r,e,u,o,i){var a=-1,f=n.length,l=t.length,c=true;if(f!=l&&(!u||l<=f))return false;for(;c&&++at?0:t)}function ge(n,t,r){return(r?ue(n,t,r):null==t)&&(t=1),t=n?n.length-(+t||0):0,_e(n,0,0>t?0:t)}function ve(n,t,r){var e=-1,u=n?n.length:0;for(t=Hr(t,r,3);++er?ro(e+r,0):r||0;else if(r)return r=Tr(n,t),n=n[r],(t===t?t===n:n!==n)?r:-1;return f(n,t,r)}function me(n){return he(n,1) -}function _e(n,t,r){var e=-1,u=n?n.length:0,o=typeof r;if(r&&"number"!=o&&ue(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 l(n);for(u=t>r?0:r-t,r=yu(u);++e>>0,u=yu(r);++tr?ro(e+r,0):r||0:0,typeof n=="string"||!ko(n)&&Qe(n)?rarguments.length,fr)}function Ue(n,t,r,e){return(ko(n)?o:Rr)(n,Hr(t,e,4),r,3>arguments.length,lr)}function Fe(n){n=se(n);for(var t=-1,r=n.length,e=yu(r);++t=r||r>t?(a&&Du(a),r=p,a=s=p=C,r&&(h=Ro(),f=n.apply(c,i),s||a||(i=c=null))):s=Zu(e,r)}function u(){s&&Du(s),a=s=p=C,(v||g!==t)&&(h=Ro(),f=n.apply(c,i),s||a||(i=c=null))}function o(){if(i=arguments,l=Ro(),c=this,p=v&&(s||!d),false===g)var r=d&&!s;else{a||d||(h=l);var o=g-(l-h),y=0>=o||o>g;y?(a&&(a=Du(a)),h=l,f=n.apply(c,i)):a||(a=Zu(u,o))}return y&&s?s=Du(s):s||t===g||(s=Zu(e,t)),r&&(y=true,f=n.apply(c,i)),!y||s||a||(i=c=null),f}var i,a,f,l,c,s,p,h=0,g=false,v=true;if(!Ze(n))throw new Ou(V);if(t=0>t?0:t,true===r)var d=true,v=false; -else Ge(r)&&(d=r.leading,g="maxWait"in r&&ro(+r.maxWait||0,t),v="trailing"in r?r.trailing:v);return o.cancel=function(){s&&Du(s),a&&Du(a),a=s=p=C},o}function ze(){var n=arguments,r=n.length-1;if(0>r)return function(){};if(!t(n,Ze))throw new Ou(V);return function(){for(var t=r,e=n[t].apply(this,arguments);t--;)e=n[t].call(this,e);return e}}function De(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(!Ze(n)||t&&!Ze(t))throw new Ou(V);return r.cache=new De.Cache,r}function Me(n){var t=_e(arguments,1),r=A(t,Me.placeholder);return Zr(n,W,null,t,r)}function qe(n){var t=_e(arguments,1),r=A(t,qe.placeholder);return Zr(n,N,null,t,r)}function Ke(n){return oe(w(n)?n.length:C)&&Lu.call(n)==_t||false}function Ve(n){return n&&1===n.nodeType&&w(n)&&(Dt.support.nodeClass?-1t||null==n||!no(t))return r;n=Eu(n);do t%2&&(r+=n),t=Mu(t/2),n+=n;while(t);return r}function au(n,t,r){var e=n;return(n=null==n?"":Eu(n))?(r?ue(e,t,r):null==t)?n.slice(j(n),E(n)+1):(t=Eu(t),n.slice(p(n,t),h(n,t)+1)):n}function fu(n,t,r){return r&&ue(n,t,r)&&(t=null),(n=null!=n&&Eu(n))&&n.match(t||vt)||[]}function lu(n){try{return n()}catch(t){return Ye(t)?t:_u(t)}}function cu(n,t,r){return r&&ue(n,t,r)&&(t=null),ur(n,t)}function su(n){return function(){return n -}}function pu(n){return n}function hu(n){return Er(n,true)}function gu(n,t,r){var e=true,u=Ge(t),o=null==r,i=o&&u&&To(t),a=i&&_r(t,i);(i&&i.length&&!a.length||o&&!u)&&(o&&(r=t),a=false,t=n,n=this),a||(a=_r(t,To(t))),false===r?e=false:Ge(r)&&"chain"in r&&(e=r.chain),r=-1,u=Ze(n);for(o=a.length;++r>>1,ho=Hu?Hu.BYTES_PER_ELEMENT:0,go=wu.pow(2,53)-1,vo=Xu&&new Xu,yo={};yo[kt]=x.Float32Array,yo[St]=x.Float64Array,yo[Ut]=x.Int8Array,yo[Ft]=x.Int16Array,yo[Tt]=x.Int32Array,yo[Wt]=x.Uint8Array,yo[Nt]=x.Uint8ClampedArray,yo[Lt]=x.Uint16Array,yo[$t]=x.Uint32Array; -var mo={};mo[bt]=mo[xt]=mo[Et]={constructor:true,toLocaleString:true,toString:true,valueOf:true},mo[wt]=mo[Ct]={constructor:true,toString:true,valueOf:true},mo[At]=mo[jt]=mo[It]={constructor:true,toString:true},mo[Ot]={constructor:true},n(mt,function(n){for(var t in mo)if(Tu.call(mo,t)){var r=mo[t];r[n]=Tu.call(r,n)}});var _o=Dt.support={};!function(n){function t(){this.x=1}var r={0:1,length:1},e=[];t.prototype={valueOf:1,y:1};for(var u in new t)e.push(u);_o.argsClass=Lu.call(arguments)==_t,_o.enumErrorProps=Vu.call(Cu,"message")||Vu.call(Cu,"name"),_o.enumPrototypes=Vu.call(t,"prototype"),_o.funcDecomp=!Je(x.WinRTError)&&ht.test(I),_o.funcNames=typeof bu.name=="string",_o.nodeClass=Lu.call(Su)!=Ot,_o.nonEnumStrings=!Vu.call("x",0),_o.nonEnumShadows=!/valueOf/.test(e),_o.ownLast="x"!=e[0],_o.spliceObjects=(Gu.call(r,0,1),!r[0]),_o.unindexedChars="xx"!="x"[0]+Au("x")[0]; -try{_o.dom=11===Su.createDocumentFragment().nodeType}catch(o){_o.dom=false}try{_o.nonEnumArgs=!Vu.call(arguments,1)}catch(i){_o.nonEnumArgs=true}}(0,0),Dt.templateSettings={escape:tt,evaluate:rt,interpolate:et,variable:"",imports:{_:Dt}};var bo=function(){function n(){}return function(t){if(Ge(t)){n.prototype=t;var r=new n;n.prototype=null}return r||x.Object()}}(),wo=vo?function(n,t){return vo.set(n,t),n}:pu;Bu||(Nr=Pu&&Ju?function(n){var t=n.byteLength,r=Hu?Mu(t/ho):0,e=r*ho,u=new Pu(t);if(r){var o=new Hu(u,0,r); -o.set(new Hu(n,0,r))}return t!=e&&(o=new Ju(u,e),o.set(new Ju(n,e))),u}:su(null));var xo=Yu?function(n){return new Vt(n)}:su(null),Ao=vo?function(n){return vo.get(n)}:vu,jo=function(){var n=0,t=0;return function(r,e){var u=Ro(),o=D-(u-t);if(t=u,0=z)return r}else n=0;return wo(r,e)}}(),Eo=Br(function(n,t,r){Tu.call(n,r)?++n[r]:n[r]=1}),Oo=Br(function(n,t,r){Tu.call(n,r)?n[r].push(t):n[r]=[t]}),Io=Br(function(n,t,r){n[r]=t}),Co=Br(function(n,t,r){n[r?0:1].push(t)},function(){return[[],[]] -}),Ro=uo||function(){return(new mu).getTime()};_o.argsClass||(Ke=function(n){return oe(w(n)?n.length:C)&&Tu.call(n,"callee")&&!Vu.call(n,"callee")||false});var ko=Qu||function(n){return w(n)&&oe(n.length)&&Lu.call(n)==bt||false};_o.dom||(Ve=function(n){return n&&1===n.nodeType&&w(n)&&!Uo(n)||false});var So=oo||function(n){return typeof n=="number"&&no(n)};(Ze(/x/)||Ju&&!Ze(Ju))&&(Ze=function(n){return Lu.call(n)==jt});var Uo=qu?function(n){if(!n||Lu.call(n)!=Ot||!Dt.support.argsClass&&Ke(n))return false;var t=n.valueOf,r=Je(t)&&(r=qu(t))&&qu(r); -return r?n==r||qu(n)==r:le(n)}:le,Fo=zr(rr),To=to?function(n){if(n)var t=n.constructor,r=n.length;return typeof t=="function"&&t.prototype===n||(typeof n=="function"?Dt.support.enumPrototypes:r&&oe(r))?ce(n):Ge(n)?to(n):[]}:ce,Wo=zr(Or),No=Mr(function(n,t,r){return t=t.toLowerCase(),r?n+t.charAt(0).toUpperCase()+t.slice(1):t}),Lo=Mr(function(n,t,r){return n+(r?"-":"")+t.toLowerCase()});8!=io(dt+"08")&&(ou=function(n,t,r){return t=r&&ue(n,t,r)?0:+t,n=au(n),io(n,t||(at.test(n)?16:10))});var $o=Mr(function(n,t,r){return n+(r?"_":"")+t.toLowerCase() -});return Mt.prototype=Dt.prototype,Kt.prototype["delete"]=function(n){return this.has(n)&&delete this.__data__[n]},Kt.prototype.get=function(n){return"__proto__"==n?C:this.__data__[n]},Kt.prototype.has=function(n){return"__proto__"!=n&&Tu.call(this.__data__,n)},Kt.prototype.set=function(n,t){return"__proto__"!=n&&(this.__data__[n]=t),this},Vt.prototype.push=function(n){var t=this.data,r=typeof n;"number"==r?t[r][n]=true:t.set.add(n)},De.Cache=Kt,Dt.after=function(n,t){if(!Ze(t)){if(!Ze(n))throw new Ou(V); -var r=n;n=t,t=r}return n=no(n=+n)?n:0,function(){return 1>--n?t.apply(this,arguments):void 0}},Dt.ary=function(n,t,r){return r&&ue(n,t,r)&&(t=null),t=null==t?n.length:+t||0,Zr(n,$,null,null,null,null,t)},Dt.assign=Fo,Dt.at=function(n){return oe(n?n.length:0)&&(n=se(n)),er(n,hr(arguments,false,false,1))},Dt.before=We,Dt.bind=Ne,Dt.bindAll=function(n){for(var t=n,r=1(s?Zt(s,i):u(c,i))){for(t=r;--t;){var p=e[t];if(0>(p?Zt(p,i):u(n[t],i)))continue n}s&&s.push(i),c.push(i) -}return c},Dt.invert=function(n,t,r){r&&ue(n,t,r)&&(t=null),r=-1;for(var e=To(n),u=e.length,o={};++rt?0:t)},Dt.takeRight=function(n,t,r){return(r?ue(n,t,r):null==t)&&(t=1),t=n?n.length-(+t||0):0,_e(n,0>t?0:t) -},Dt.takeRightWhile=function(n,t,r){var e=n?n.length:0;for(t=Hr(t,r,3);e--&&t(n[e],e,n););return _e(n,e+1)},Dt.takeWhile=function(n,t,r){var e=-1,u=n?n.length:0;for(t=Hr(t,r,3);++en||!no(n))return[];var e=-1,u=yu(eo(n,co));for(t=Wr(t,r,1);++er?0:+r||0,e))-t.length,0<=r&&n.indexOf(t,r)==r},Dt.escape=function(n){return(n=null==n?"":Eu(n))&&nt.test(n)?n.replace(H,y):n},Dt.escapeRegExp=uu,Dt.every=Ee,Dt.find=Ie,Dt.findIndex=ve,Dt.findKey=function(n,t,r){return t=Hr(t,r,3),pr(n,t,yr,true) -},Dt.findLast=function(n,t,r){return t=Hr(t,r,3),pr(n,t,lr)},Dt.findLastIndex=function(n,t,r){var e=n?n.length:0;for(t=Hr(t,r,3);e--;)if(t(n[e],e,n))return e;return-1},Dt.findLastKey=function(n,t,r){return t=Hr(t,r,3),pr(n,t,mr,true)},Dt.findWhere=function(n,t){return Ie(n,hu(t))},Dt.first=de,Dt.has=function(n,t){return n?Tu.call(n,t):false},Dt.identity=pu,Dt.includes=je,Dt.indexOf=ye,Dt.isArguments=Ke,Dt.isArray=ko,Dt.isBoolean=function(n){return true===n||false===n||w(n)&&Lu.call(n)==wt||false},Dt.isDate=function(n){return w(n)&&Lu.call(n)==xt||false -},Dt.isElement=Ve,Dt.isEmpty=function(n){if(null==n)return true;var t=n.length;return oe(t)&&(ko(n)||Qe(n)||Ke(n)||w(n)&&Ze(n.splice))?!t:!To(n).length},Dt.isEqual=function(n,t,r,e){return r=typeof r=="function"&&Wr(r,e,3),!r&&ie(n)&&ie(t)?n===t:(e=r?r(n,t):C,typeof e=="undefined"?wr(n,t,r):!!e)},Dt.isError=Ye,Dt.isFinite=So,Dt.isFunction=Ze,Dt.isMatch=function(n,t,r,e){var u=To(t),o=u.length;if(r=typeof r=="function"&&Wr(r,e,3),!r&&1==o){var i=u[0];if(e=t[i],ie(e))return null!=n&&e===n[i]&&Tu.call(n,i) -}for(var i=yu(o),a=yu(o);o--;)e=i[o]=t[u[o]],a[o]=ie(e);return Ar(n,u,i,a,r)},Dt.isNaN=function(n){return Xe(n)&&n!=+n},Dt.isNative=Je,Dt.isNull=function(n){return null===n},Dt.isNumber=Xe,Dt.isObject=Ge,Dt.isPlainObject=Uo,Dt.isRegExp=He,Dt.isString=Qe,Dt.isUndefined=function(n){return typeof n=="undefined"},Dt.kebabCase=Lo,Dt.last=function(n){var t=n?n.length:0;return t?n[t-1]:C},Dt.lastIndexOf=function(n,t,r){var e=n?n.length:0;if(!e)return-1;var u=e;if(typeof r=="number")u=(0>r?ro(e+r,0):eo(r||0,e-1))+1; -else if(r)return u=Tr(n,t,null,true)-1,n=n[u],(t===t?t===n:n!==n)?u:-1;if(t!==t)return _(n,u,true);for(;u--;)if(n[u]===t)return u;return-1},Dt.max=function(n,t,r){r&&ue(n,t,r)&&(t=null);var e=null==t,u=e&&ko(n),o=!u&&Qe(n);if(e&&!o)return Jt(u?n:se(n));var i=fo,a=i;return t=e&&o?s:Hr(t,r,3),fr(n,function(n,r,e){r=t(n,r,e),(r>i||r===fo&&r===a)&&(i=r,a=n)}),a},Dt.min=function(n,t,r){r&&ue(n,t,r)&&(t=null);var e=null==t,u=e&&ko(n),o=!u&&Qe(n);if(e&&!o)return Xt(u?n:se(n));var i=lo,a=i;return t=e&&o?s:Hr(t,r,3),fr(n,function(n,r,e){r=t(n,r,e),(rr?0:+r||0,n.length),n.lastIndexOf(t,r)==r -},Dt.template=function(n,t,r){var e=Dt.templateSettings;r&&ue(n,t,r)&&(t=r=null),n=Eu(null==n?"":n),t=rr(rr({},r||t),e,tr),r=rr(rr({},t.imports),e.imports,tr);var u,o,i=To(r),a=Ur(r,i),f=0;r=t.interpolate||ct;var l="__p+='";r=ju((t.escape||ct).source+"|"+r.source+"|"+(r===et?ut:ct).source+"|"+(t.evaluate||ct).source+"|$","g");var c="sourceURL"in t?"//# sourceURL="+t.sourceURL+"\n":"";if(n.replace(r,function(t,r,e,i,a,c){return e||(e=i),l+=n.slice(f,c).replace(gt,m),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(Z,""):l).replace(G,"$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=lu(function(){return bu(i,c+"return "+l).apply(C,a)}),t.source=l,Ye(t))throw t;return t},Dt.trim=au,Dt.trimLeft=function(n,t,r){var e=n;return(n=null==n?"":Eu(n))?(r?ue(e,t,r):null==t)?n.slice(j(n)):(t=Eu(t),n.slice(p(n,t))):n -},Dt.trimRight=function(n,t,r){var e=n;return(n=null==n?"":Eu(n))?(r?ue(e,t,r):null==t)?n.slice(0,E(n)+1):(t=Eu(t),n.slice(0,h(n,t)+1)):n},Dt.trunc=function(n,t,r){r&&ue(n,t,r)&&(t=null);var e=P;if(r=B,Ge(t)){var u="separator"in t?t.separator:u,e="length"in t?+t.length||0:e;r="omission"in t?Eu(t.omission):r}else null!=t&&(e=+t||0);if(n=null==n?"":Eu(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(He(u)){if(n.slice(e).search(u)){var o,i=n.slice(0,e);for(u.global||(u=ju(u.source,(ot.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) -},Dt.prototype.sample=function(n){return this.__chain__||null!=n?this.thru(function(t){return Dt.sample(t,n)}):Dt.sample(this.value())},Dt.VERSION=R,n("bind bindKey curry curryRight partial partialRight".split(" "),function(n){Dt[n].placeholder=Dt}),n(["filter","map","takeWhile"],function(n,t){var r=t==M;qt.prototype[n]=function(n,e){n=Hr(n,e,3);var u=this.clone(),o=u.filtered,i=u.iteratees||(u.iteratees=[]);return u.filtered=o||r||t==K&&0>u.dir,i.push({iteratee:n,type:t}),u}}),n(["drop","take"],function(n,t){var r=n+"Count",e=n+"While"; -qt.prototype[n]=function(e){e=null==e?1:ro(+e||0,0);var u=this.clone();if(u.filtered){var o=u[r];u[r]=t?eo(o,e):o+e}else(u.views||(u.views=[])).push({size:e,type:n+(0>u.dir?"Right":"")});return u},qt.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()},qt.prototype[n+"RightWhile"]=function(n,t){return this.reverse()[e](n,t).reverse()}}),n(["first","last"],function(n,t){var r="take"+(t?"Right":"");qt.prototype[n]=function(){return this[r](1).value()[0]}}),n(["initial","rest"],function(n,t){var r="drop"+(t?"":"Right"); -qt.prototype[n]=function(){return this[r](1)}}),n(["pluck","where"],function(n,t){var r=t?"filter":"map",e=t?hu:du;qt.prototype[n]=function(n){return this[r](e(n))}}),qt.prototype.dropWhile=function(n,t){n=Hr(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))})},qt.prototype.reject=function(n,t){return n=Hr(n,t,3),this.filter(function(t,r,e){return!n(t,r,e)})},qt.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},yr(qt.prototype,function(n,t){var r=/^(?:first|last)$/.test(t);Dt.prototype[t]=function(){function e(n){return n=[n],Ku.apply(n,o),Dt[t].apply(Dt,n)}var u=this.__wrapped__,o=arguments,i=this.__chain__,a=!!this.__actions__.length,f=u instanceof qt,l=f&&!a;return r&&!i?l?n.call(u):Dt[t](this.value()):f||ko(u)?(u=n.apply(l?u:new qt(this),o),r||!a&&!u.actions||(u.actions||(u.actions=[])).push({args:[e],object:Dt,name:"thru"}),new Mt(u,i)):this.thru(e) -}}),n("concat join pop push shift sort splice unshift".split(" "),function(n){var t=Iu[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:join|pop|shift)$/.test(n),u=_o.spliceObjects||!/^(?:pop|shift|splice)$/.test(n)?t:function(){var n=t.apply(this,arguments);return 0===this.length&&delete this[0],n};Dt.prototype[n]=function(){var n=arguments;return e&&!this.__chain__?u.apply(this.value(),n):this[r](function(t){return u.apply(t,n)})}}),qt.prototype.clone=function(){var n=this.actions,t=this.iteratees,r=this.views,e=new qt(this.wrapped); -return e.actions=n?l(n):null,e.dir=this.dir,e.dropCount=this.dropCount,e.filtered=this.filtered,e.iteratees=t?l(t):null,e.takeCount=this.takeCount,e.views=r?l(r):null,e},qt.prototype.reverse=function(){var n=this.filtered,t=n?new qt(this):this.clone();return t.dir=-1*this.dir,t.filtered=n,t},qt.prototype.value=function(){var n=this.wrapped.value();if(!ko(n))return Fr(n,this.actions);var t,r=this.dir,e=0>r,u=n.length;t=u;for(var o=this.views,i=0,a=-1,f=o?o.length:0;++a"'`]/g,Q=RegExp(X.source),nt=RegExp(H.source),tt=/<%-([\s\S]+?)%>/g,rt=/<%([\s\S]+?)%>/g,et=/<%=([\s\S]+?)%>/g,ut=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ot=/\w*$/,it=/^\s*function[ \n\r\t]+\w/,at=/^0[xX]/,ft=/^\[object .+?Constructor\]$/,lt=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,ct=/($^)/,st=/[.*+?^${}()|[\]\/\\]/g,pt=RegExp(st.source),ht=/\bthis\b/,gt=/['\n\r\u2028\u2029\\]/g,vt=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"),dt=" \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",yt="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(" "),mt="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),_t="[object Arguments]",bt="[object Array]",wt="[object Boolean]",xt="[object Date]",At="[object Error]",jt="[object Function]",Et="[object Number]",Ot="[object Object]",It="[object RegExp]",Ct="[object String]",Rt="[object ArrayBuffer]",kt="[object Float32Array]",St="[object Float64Array]",Ut="[object Int8Array]",Ft="[object Int16Array]",Tt="[object Int32Array]",Wt="[object Uint8Array]",Nt="[object Uint8ClampedArray]",Lt="[object Uint16Array]",$t="[object Uint32Array]",Pt={}; -Pt[_t]=Pt[bt]=Pt[kt]=Pt[St]=Pt[Ut]=Pt[Ft]=Pt[Tt]=Pt[Wt]=Pt[Nt]=Pt[Lt]=Pt[$t]=true,Pt[Rt]=Pt[wt]=Pt[xt]=Pt[At]=Pt[jt]=Pt["[object Map]"]=Pt[Et]=Pt[Ot]=Pt[It]=Pt["[object Set]"]=Pt[Ct]=Pt["[object WeakMap]"]=false;var Bt={};Bt[_t]=Bt[bt]=Bt[Rt]=Bt[wt]=Bt[xt]=Bt[kt]=Bt[St]=Bt[Ut]=Bt[Ft]=Bt[Tt]=Bt[Et]=Bt[Ot]=Bt[It]=Bt[Ct]=Bt[Wt]=Bt[Nt]=Bt[Lt]=Bt[$t]=true,Bt[At]=Bt[jt]=Bt["[object Map]"]=Bt["[object Set]"]=Bt["[object WeakMap]"]=false;var zt={leading:false,maxWait:0,trailing:false},Dt={"\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"},Mt={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},qt={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Kt={"function":true,object:true},Vt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Yt=Kt[typeof window]&&window!==(this&&this.window)?window:this,Zt=Kt[typeof exports]&&exports&&!exports.nodeType&&exports,Gt=Kt[typeof module]&&module&&!module.nodeType&&module,Jt=Zt&&Gt&&typeof global=="object"&&global; -!Jt||Jt.global!==Jt&&Jt.window!==Jt&&Jt.self!==Jt||(Yt=Jt);var Xt=Gt&&Gt.exports===Zt&&Zt,Ht=function(){try{String({toString:0}+"")}catch(n){return function(){return false}}return function(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}}(),Qt=I();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Yt._=Qt, define(function(){return Qt})):Zt&&Gt?Xt?(Gt.exports=Qt)._=Qt:Zt._=Qt:Yt._=Qt}).call(this); \ No newline at end of file +}function I(x){function Dt(n){if(w(n)&&!Lo(n)){if(n instanceof Mt)return n;if(Pu.call(n,"__wrapped__"))return new Mt(n.__wrapped__,n.__chain__,l(n.__actions__))}return new Mt(n)}function Mt(n,t,r){this.__actions__=r||[],this.__chain__=!!t,this.__wrapped__=n}function qt(n){this.actions=null,this.dir=1,this.dropCount=0,this.filtered=false,this.iteratees=null,this.takeCount=go,this.views=null,this.wrapped=n}function Kt(){this.__data__={}}function Vt(n){var t=n?n.length:0;for(this.data={number:{},set:new Hu};t--;)this.push(n[t]) +}function Zt(n,t){var r=typeof t,e=n.data;return("number"==r?e[r][t]:e.set.has(t))?0:-1}function Gt(n){var t={length:0};return Ju.apply(t,n),t}function Jt(n){for(var t=-1,r=n.length,e=ho;++te&&(e=u)}return e}function Xt(n,t){return typeof n=="undefined"?t:n}function nr(n,t,r,e){return typeof n!="undefined"&&Pu.call(e,r)?n:t}function tr(n,t,r){for(var e=-1,u=zo(t),o=u.length;++eo(t,a)&&e.push(a);return e}function ar(n,t){var r=n?n.length:0;if(!ae(r))return yr(n,t);for(var e=-1,u=ge(n);++ee(a,s)&&((t||i)&&a.push(s),l.push(c))}return l}function Cr(n,t){for(var r=-1,e=t.length,u=xu(e);++r>>1,i=n[o];(r?i<=t:it||null==r)return r;if(3=o&&a<=i&&(e=L&&t>u||e>u&&t>=L)||o)&&(t&S&&(r[2]=h[2],a|=e&S?0:T),(e=h[3])&&(u=r[3],r[3]=u?$r(u,e,h[4]):l(e),r[4]=u?A(r[3],Y):l(h[4])),(e=h[5])&&(u=r[5],r[5]=u?Pr(u,e,h[6]):l(e),r[6]=u?A(r[5],Y):l(h[6])),(e=h[7])&&(r[7]=l(e)),t&$&&(r[8]=null==r[8]?h[8]:fo(r[8],h[8])),null==r[9]&&(r[9]=h[9]),r[0]=h[0],r[1]=a),t=r[1],a=r[9]}return r[9]=null==a?f?0:n.length:ao(a-c,0)||0,(h?Oo:ko)(t==S?Dr(r[0],r[2]):t!=W&&t!=(S|W)||r[4].length?Vr.apply(null,r):Zr.apply(null,r),r)}function Jr(n,t,r,e,u,o,i){var a=-1,f=n.length,l=t.length,c=true; +if(f!=l&&(!u||l<=f))return false;for(;c&&++au)||i===e&&i===o)&&(u=i,o=n)}),o}function ne(n,t,r){var e=Dt.callback||vu,e=e===vu?er:e; +return r?e(n,t,r):e}function te(n,t,r){var e=Dt.indexOf||be,e=e===be?f:e;return n?e(n,t,r):e}function re(n,t){var r=-1,e=n.length,u=new n.constructor(e);if(!t)for(;++rt?0:t)}function de(n,t,r){return(r?ie(n,t,r):null==t)&&(t=1),t=n?n.length-(+t||0):0,xe(n,0,0>t?0:t)}function me(n,t,r){var e=-1,u=n?n.length:0;for(t=ne(t,r,3);++er?ao(e+r,0):r||0;else if(r)return r=Ur(n,t),n=n[r],(t===t?t===n:n!==n)?r:-1; +return f(n,t,r)}function we(n){return ye(n,1)}function xe(n,t,r){var e=-1,u=n?n.length:0,o=typeof r;if(r&&"number"!=o&&ie(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 l(n);for(u=t>r?0:r-t,r=xu(u);++e>>0,u=xu(r);++tr?ao(e+r,0):r||0:0,typeof n=="string"||!Lo(n)&&uu(n)?rarguments.length,ar)}function Ne(n,t,r,e){return(Lo(n)?o:Rr)(n,ne(t,e,4),r,3>arguments.length,fr)}function Le(n,t,r){return(r?ie(n,t,r):null==t)?(n=he(n),t=n.length,0t?0:+t||0,n.length),n)}function $e(n){n=he(n);for(var t=-1,r=n.length,e=xu(r);++t=r||r>t?(a&&Yu(a),r=p,a=s=p=R,r&&(h=No(),f=n.apply(c,i),s||a||(i=c=null))):s=Qu(e,r)}function u(){s&&Yu(s),a=s=p=R,(v||g!==t)&&(h=No(),f=n.apply(c,i),s||a||(i=c=null))}function o(){if(i=arguments,l=No(),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=Yu(a)),h=l,f=n.apply(c,i)):a||(a=Qu(u,o))}return d&&s?s=Yu(s):s||t===g||(s=Qu(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(!Qe(n))throw new Cu(V);if(t=0>t?0:t,true===r)var y=true,v=false;else nu(r)&&(y=r.leading,g="maxWait"in r&&ao(+r.maxWait||0,t),v="trailing"in r?r.trailing:v);return o.cancel=function(){s&&Yu(s),a&&Yu(a),a=s=p=R},o}function Ve(){var n=arguments,r=n.length-1;if(0>r)return function(){};if(!t(n,Qe))throw new Cu(V);return function(){for(var t=r,e=n[t].apply(this,arguments);t--;)e=n[t].call(this,e);return e}}function Ye(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(!Qe(n)||t&&!Qe(t))throw new Cu(V);return r.cache=new Ye.Cache,r}function Ze(n){var t=xe(arguments,1),r=A(t,Ze.placeholder);return Gr(n,W,null,t,r)}function Ge(n){var t=xe(arguments,1),r=A(t,Ge.placeholder);return Gr(n,N,null,t,r)}function Je(n){return ae(w(n)?n.length:R)&&zu.call(n)==_t||false}function Xe(n){return n&&1===n.nodeType&&w(n)&&(Dt.support.nodeTag?-1t||null==n||!oo(t))return r;n+="";do t%2&&(r+=n),t=Zu(t/2),n+=n;while(t);return r}function pu(n,t,r){var e=n;return(n=ve(n))?(r?ie(e,t,r):null==t)?n.slice(j(n),E(n)+1):(t+="",n.slice(p(n,t),h(n,t)+1)):n}function hu(n,t,r){return r&&ie(n,t,r)&&(t=null),n=ve(n),n.match(t||vt)||[]}function gu(n){try{return n()}catch(t){return He(t)?t:ju(t)}}function vu(n,t,r){return r&&ie(n,t,r)&&(t=null),er(n,t)}function yu(n){return function(){return n}}function du(n){return n}function mu(n){return jr(n,true) +}function _u(n,t,r){if(null==r){var e=nu(t),u=e&&zo(t);((u=u&&u.length&&mr(t,u))?u.length:e)||(u=false,r=t,t=n,n=this)}u||(u=mr(t,zo(t)));var o=true,e=-1,i=Qe(n),a=u.length;false===r?o=false:nu(r)&&"chain"in r&&(o=r.chain);for(;++e>>1,_o=eo?eo.BYTES_PER_ELEMENT:0,bo=Ou.pow(2,53)-1,wo=ro&&new ro,xo={};xo[St]=x.Float32Array,xo[Ct]=x.Float64Array,xo[Tt]=x.Int8Array,xo[Ut]=x.Int16Array,xo[Ft]=x.Int32Array,xo[Wt]=x.Uint8Array,xo[Nt]=x.Uint8ClampedArray,xo[Lt]=x.Uint16Array,xo[$t]=x.Uint32Array; +var Ao={};Ao[bt]=Ao[xt]=Ao[Et]={constructor:true,toLocaleString:true,toString:true,valueOf:true},Ao[wt]=Ao[Rt]={constructor:true,toString:true,valueOf:true},Ao[At]=Ao[jt]=Ao[It]={constructor:true,toString:true},Ao[Ot]={constructor:true},n(mt,function(n){for(var t in Ao)if(Pu.call(Ao,t)){var r=Ao[t];r[n]=Pu.call(r,n)}});var jo=Dt.support={};!function(n){function t(){this.x=1}var r={0:1,length:1},e=[];t.prototype={valueOf:1,y:1};for(var u in new t)e.push(u);jo.argsTag=zu.call(arguments)==_t,jo.enumErrorProps=Xu.call(Uu,"message")||Xu.call(Uu,"name"),jo.enumPrototypes=Xu.call(t,"prototype"),jo.funcDecomp=!tu(x.WinRTError)&&ht.test(I),jo.funcNames=typeof Eu.name=="string",jo.nodeTag=zu.call(Nu)!=Ot,jo.nonEnumStrings=!Xu.call("x",0),jo.nonEnumShadows=!/valueOf/.test(e),jo.ownLast="x"!=e[0],jo.spliceObjects=(no.call(r,0,1),!r[0]),jo.unindexedChars="xx"!="x"[0]+Ru("x")[0]; +try{jo.dom=11===Nu.createDocumentFragment().nodeType}catch(o){jo.dom=false}try{jo.nonEnumArgs=!Xu.call(arguments,1)}catch(i){jo.nonEnumArgs=true}}(0,0),Dt.templateSettings={escape:tt,evaluate:rt,interpolate:et,variable:"",imports:{_:Dt}};var Eo=function(){function n(){}return function(t){if(nu(t)){n.prototype=t;var r=new n;n.prototype=null}return r||x.Object()}}(),Oo=wo?function(n,t){return wo.set(n,t),n}:du;Ku||(Nr=qu&&to?function(n){var t=n.byteLength,r=eo?Zu(t/_o):0,e=r*_o,u=new qu(t);if(r){var o=new eo(u,0,r); +o.set(new eo(n,0,r))}return t!=e&&(o=new to(u,e),o.set(new to(n,e))),u}:yu(null));var Io=Hu?function(n){return new Vt(n)}:yu(null),Ro=wo?function(n){return wo.get(n)}:bu,ko=function(){var n=0,t=0;return function(r,e){var u=No(),o=D-(u-t);if(t=u,0=z)return r}else n=0;return Oo(r,e)}}(),So=Br(function(n,t,r){Pu.call(n,r)?++n[r]:n[r]=1}),Co=Br(function(n,t,r){Pu.call(n,r)?n[r].push(t):n[r]=[t]}),To=Br(function(n,t,r){n[r]=t}),Uo=Kr(Jt),Fo=Kr(function(n){for(var t=-1,r=n.length,e=go;++t--n?t.apply(this,arguments):void 0}},Dt.ary=function(n,t,r){return r&&ie(n,t,r)&&(t=null),t=null==t?n.length:+t||0,Gr(n,$,null,null,null,null,t)},Dt.assign=Bo,Dt.at=function(n){return ae(n?n.length:0)&&(n=he(n)),rr(n,pr(arguments,false,false,1))},Dt.before=Be,Dt.bind=ze,Dt.bindAll=function(n){for(var t=n,r=1(s?Zt(s,i):u(c,i))){for(t=r;--t;){var p=e[t];if(0>(p?Zt(p,i):u(n[t],i)))continue n}s&&s.push(i),c.push(i) +}return c},Dt.invert=function(n,t,r){r&&ie(n,t,r)&&(t=null),r=-1;for(var e=zo(n),u=e.length,o={};++rt?0:t)},Dt.takeRight=function(n,t,r){return(r?ie(n,t,r):null==t)&&(t=1),t=n?n.length-(+t||0):0,xe(n,0>t?0:t) +},Dt.takeRightWhile=function(n,t,r){var e=n?n.length:0;for(t=ne(t,r,3);e--&&t(n[e],e,n););return xe(n,e+1)},Dt.takeWhile=function(n,t,r){var e=-1,u=n?n.length:0;for(t=ne(t,r,3);++en||!oo(n))return[]; +var e=-1,u=xu(fo(n,vo));for(t=Wr(t,r,1);++er?0:+r||0,e))-t.length,0<=r&&n.indexOf(t,r)==r},Dt.escape=function(n){return(n=ve(n))&&nt.test(n)?n.replace(H,d):n},Dt.escapeRegExp=lu,Dt.every=ke,Dt.find=Ce,Dt.findIndex=me,Dt.findKey=function(n,t,r){return t=ne(t,r,3),sr(n,t,yr,true) +},Dt.findLast=function(n,t,r){return t=ne(t,r,3),sr(n,t,fr)},Dt.findLastIndex=function(n,t,r){var e=n?n.length:0;for(t=ne(t,r,3);e--;)if(t(n[e],e,n))return e;return-1},Dt.findLastKey=function(n,t,r){return t=ne(t,r,3),sr(n,t,dr,true)},Dt.findWhere=function(n,t){return Ce(n,mu(t))},Dt.first=_e,Dt.has=function(n,t){return n?Pu.call(n,t):false},Dt.identity=du,Dt.includes=Re,Dt.indexOf=be,Dt.isArguments=Je,Dt.isArray=Lo,Dt.isBoolean=function(n){return true===n||false===n||w(n)&&zu.call(n)==wt||false},Dt.isDate=function(n){return w(n)&&zu.call(n)==xt||false +},Dt.isElement=Xe,Dt.isEmpty=function(n){if(null==n)return true;var t=n.length;return ae(t)&&(Lo(n)||uu(n)||Je(n)||w(n)&&Qe(n.splice))?!t:!zo(n).length},Dt.isEqual=function(n,t,r,e){return r=typeof r=="function"&&Wr(r,e,3),!r&&fe(n)&&fe(t)?n===t:(e=r?r(n,t):R,typeof e=="undefined"?br(n,t,r):!!e)},Dt.isError=He,Dt.isFinite=$o,Dt.isFunction=Qe,Dt.isMatch=function(n,t,r,e){var u=zo(t),o=u.length;if(r=typeof r=="function"&&Wr(r,e,3),!r&&1==o){var i=u[0];if(e=t[i],fe(e))return null!=n&&e===n[i]&&Pu.call(n,i) +}for(var i=xu(o),a=xu(o);o--;)e=i[o]=t[u[o]],a[o]=fe(e);return xr(n,u,i,a,r)},Dt.isNaN=function(n){return ru(n)&&n!=+n},Dt.isNative=tu,Dt.isNull=function(n){return null===n},Dt.isNumber=ru,Dt.isObject=nu,Dt.isPlainObject=Po,Dt.isRegExp=eu,Dt.isString=uu,Dt.isUndefined=function(n){return typeof n=="undefined"},Dt.kebabCase=qo,Dt.last=function(n){var t=n?n.length:0;return t?n[t-1]:R},Dt.lastIndexOf=function(n,t,r){var e=n?n.length:0;if(!e)return-1;var u=e;if(typeof r=="number")u=(0>r?ao(e+r,0):fo(r||0,e-1))+1; +else if(r)return u=Ur(n,t,true)-1,n=n[u],(t===t?t===n:n!==n)?u:-1;if(t!==t)return _(n,u,true);for(;u--;)if(n[u]===t)return u;return-1},Dt.max=Uo,Dt.min=Fo,Dt.noConflict=function(){return x._=Du,this},Dt.noop=bu,Dt.now=No,Dt.pad=function(n,t,r){n=ve(n),t=+t;var e=n.length;return er?0:+r||0,n.length),n.lastIndexOf(t,r)==r},Dt.template=function(n,t,r){var e=Dt.templateSettings;r&&ie(n,t,r)&&(t=r=null),n=ve(n),t=tr(tr({},r||t),e,nr),r=tr(tr({},t.imports),e.imports,nr);var u,o,i=zo(r),a=Cr(r,i),f=0;r=t.interpolate||ct;var l="__p+='";r=ku((t.escape||ct).source+"|"+r.source+"|"+(r===et?ut:ct).source+"|"+(t.evaluate||ct).source+"|$","g"); +var c="sourceURL"in t?"//# sourceURL="+t.sourceURL+"\n":"";if(n.replace(r,function(t,r,e,i,a,c){return e||(e=i),l+=n.slice(f,c).replace(gt,m),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(Z,""):l).replace(G,"$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=gu(function(){return Eu(i,c+"return "+l).apply(R,a) +}),t.source=l,He(t))throw t;return t},Dt.trim=pu,Dt.trimLeft=function(n,t,r){var e=n;return(n=ve(n))?n.slice((r?ie(e,t,r):null==t)?j(n):p(n,t+"")):n},Dt.trimRight=function(n,t,r){var e=n;return(n=ve(n))?(r?ie(e,t,r):null==t)?n.slice(0,E(n)+1):n.slice(0,h(n,t+"")+1):n},Dt.trunc=function(n,t,r){r&&ie(n,t,r)&&(t=null);var e=P;if(r=B,null!=t)if(nu(t)){var u="separator"in t?t.separator:u,e="length"in t?+t.length||0:e;r="omission"in t?t.omission+"":r}else e=+t||0;if(n=ve(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(eu(u)){if(n.slice(e).search(u)){var o,i=n.slice(0,e);for(u.global||(u=ku(u.source,(ot.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),-1u.dir,i.push({iteratee:n,type:t}),u +}}),n(["drop","take"],function(n,t){var r=n+"Count",e=n+"While";qt.prototype[n]=function(e){e=null==e?1:ao(+e||0,0);var u=this.clone();if(u.filtered){var o=u[r];u[r]=t?fo(o,e):o+e}else(u.views||(u.views=[])).push({size:e,type:n+(0>u.dir?"Right":"")});return u},qt.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()},qt.prototype[n+"RightWhile"]=function(n,t){return this.reverse()[e](n,t).reverse()}}),n(["first","last"],function(n,t){var r="take"+(t?"Right":"");qt.prototype[n]=function(){return this[r](1).value()[0] +}}),n(["initial","rest"],function(n,t){var r="drop"+(t?"":"Right");qt.prototype[n]=function(){return this[r](1)}}),n(["pluck","where"],function(n,t){var r=t?"filter":"map",e=t?mu:wu;qt.prototype[n]=function(n){return this[r](e(n))}}),qt.prototype.dropWhile=function(n,t){n=ne(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))})},qt.prototype.reject=function(n,t){return n=ne(n,t,3),this.filter(function(t,r,e){return!n(t,r,e)})},qt.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},yr(qt.prototype,function(n,t){var r=/^(?:first|last)$/.test(t);Dt.prototype[t]=function(){function e(n){return n=[n],Ju.apply(n,o),Dt[t].apply(Dt,n)}var u=this.__wrapped__,o=arguments,i=this.__chain__,a=!!this.__actions__.length,f=u instanceof qt,l=f&&!a;return r&&!i?l?n.call(u):Dt[t](this.value()):f||Lo(u)?(u=n.apply(l?u:new qt(this),o),r||!a&&!u.actions||(u.actions||(u.actions=[])).push({func:Ie,args:[e],thisArg:Dt}),new Mt(u,i)):this.thru(e) +}}),n("concat join pop push shift sort splice unshift".split(" "),function(n){var t=Tu[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:join|pop|shift)$/.test(n),u=jo.spliceObjects||!/^(?:pop|shift|splice)$/.test(n)?t:function(){var n=t.apply(this,arguments);return 0===this.length&&delete this[0],n};Dt.prototype[n]=function(){var n=arguments;return e&&!this.__chain__?u.apply(this.value(),n):this[r](function(t){return u.apply(t,n)})}}),qt.prototype.clone=function(){var n=this.actions,t=this.iteratees,r=this.views,e=new qt(this.wrapped); +return e.actions=n?l(n):null,e.dir=this.dir,e.dropCount=this.dropCount,e.filtered=this.filtered,e.iteratees=t?l(t):null,e.takeCount=this.takeCount,e.views=r?l(r):null,e},qt.prototype.reverse=function(){var n=this.filtered,t=n?new qt(this):this.clone();return t.dir=-1*this.dir,t.filtered=n,t},qt.prototype.value=function(){var n=this.wrapped.value();if(!Lo(n))return Tr(n,this.actions);var t,r=this.dir,e=0>r,u=n.length;t=u;for(var o=this.views,i=0,a=-1,f=o?o.length:0;++a"'`]/g,Q=RegExp(X.source),nt=RegExp(H.source),tt=/<%-([\s\S]+?)%>/g,rt=/<%([\s\S]+?)%>/g,et=/<%=([\s\S]+?)%>/g,ut=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ot=/\w*$/,it=/^\s*function[ \n\r\t]+\w/,at=/^0[xX]/,ft=/^\[object .+?Constructor\]$/,lt=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,ct=/($^)/,st=/[.*+?^${}()|[\]\/\\]/g,pt=RegExp(st.source),ht=/\bthis\b/,gt=/['\n\r\u2028\u2029\\]/g,vt=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"),yt=" \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",dt="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(" "),mt="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),_t="[object Arguments]",bt="[object Array]",wt="[object Boolean]",xt="[object Date]",At="[object Error]",jt="[object Function]",Et="[object Number]",Ot="[object Object]",It="[object RegExp]",Rt="[object String]",kt="[object ArrayBuffer]",St="[object Float32Array]",Ct="[object Float64Array]",Tt="[object Int8Array]",Ut="[object Int16Array]",Ft="[object Int32Array]",Wt="[object Uint8Array]",Nt="[object Uint8ClampedArray]",Lt="[object Uint16Array]",$t="[object Uint32Array]",Pt={}; +Pt[_t]=Pt[bt]=Pt[St]=Pt[Ct]=Pt[Tt]=Pt[Ut]=Pt[Ft]=Pt[Wt]=Pt[Nt]=Pt[Lt]=Pt[$t]=true,Pt[kt]=Pt[wt]=Pt[xt]=Pt[At]=Pt[jt]=Pt["[object Map]"]=Pt[Et]=Pt[Ot]=Pt[It]=Pt["[object Set]"]=Pt[Rt]=Pt["[object WeakMap]"]=false;var Bt={};Bt[_t]=Bt[bt]=Bt[kt]=Bt[wt]=Bt[xt]=Bt[St]=Bt[Ct]=Bt[Tt]=Bt[Ut]=Bt[Ft]=Bt[Et]=Bt[Ot]=Bt[It]=Bt[Rt]=Bt[Wt]=Bt[Nt]=Bt[Lt]=Bt[$t]=true,Bt[At]=Bt[jt]=Bt["[object Map]"]=Bt["[object Set]"]=Bt["[object WeakMap]"]=false;var zt={leading:false,maxWait:0,trailing:false},Dt={"\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"},Mt={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},qt={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Kt={"function":true,object:true},Vt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Yt=Kt[typeof window]&&window!==(this&&this.window)?window:this,Zt=Kt[typeof exports]&&exports&&!exports.nodeType&&exports,Gt=Kt[typeof module]&&module&&!module.nodeType&&module,Jt=Zt&&Gt&&typeof global=="object"&&global; +!Jt||Jt.global!==Jt&&Jt.window!==Jt&&Jt.self!==Jt||(Yt=Jt);var Xt=Gt&&Gt.exports===Zt&&Zt,Ht=function(){try{Object({toString:0}+"")}catch(n){return function(){return false}}return function(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}}(),Qt=I();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Yt._=Qt, define(function(){return Qt})):Zt&&Gt?Xt?(Gt.exports=Qt)._=Qt:Zt._=Qt:Yt._=Qt}).call(this); \ No newline at end of file diff --git a/dist/lodash.js b/dist/lodash.js index ce133e011..2e1235d12 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -2,9 +2,9 @@ * @license * Lo-Dash 3.0.0-pre (Custom Build) * Build: `lodash modern -o ./dist/lodash.js` - * Copyright 2012-2014 The Dojo Foundation + * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.7.0 - * Copyright 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ ;(function() { @@ -63,7 +63,7 @@ /** * Used to match ES6 template delimiters. - * See the [ES6 spec](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components) + * See the [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components) * for more details. */ var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; @@ -134,60 +134,60 @@ var templateCounter = -1; /** `Object#toString` result references. */ - var argsClass = '[object Arguments]', - arrayClass = '[object Array]', - boolClass = '[object Boolean]', - dateClass = '[object Date]', - errorClass = '[object Error]', - funcClass = '[object Function]', - mapClass = '[object Map]', - numberClass = '[object Number]', - objectClass = '[object Object]', - regexpClass = '[object RegExp]', - setClass = '[object Set]', - stringClass = '[object String]', - weakMapClass = '[object WeakMap]'; + var argsTag = '[object Arguments]', + arrayTag = '[object Array]', + boolTag = '[object Boolean]', + dateTag = '[object Date]', + errorTag = '[object Error]', + funcTag = '[object Function]', + mapTag = '[object Map]', + numberTag = '[object Number]', + objectTag = '[object Object]', + regexpTag = '[object RegExp]', + setTag = '[object Set]', + stringTag = '[object String]', + weakMapTag = '[object WeakMap]'; - var arrayBufferClass = '[object ArrayBuffer]', - float32Class = '[object Float32Array]', - float64Class = '[object Float64Array]', - int8Class = '[object Int8Array]', - int16Class = '[object Int16Array]', - int32Class = '[object Int32Array]', - uint8Class = '[object Uint8Array]', - uint8ClampedClass = '[object Uint8ClampedArray]', - uint16Class = '[object Uint16Array]', - uint32Class = '[object Uint32Array]'; + var arrayBufferTag = '[object ArrayBuffer]', + float32Tag = '[object Float32Array]', + float64Tag = '[object Float64Array]', + int8Tag = '[object Int8Array]', + int16Tag = '[object Int16Array]', + int32Tag = '[object Int32Array]', + uint8Tag = '[object Uint8Array]', + uint8ClampedTag = '[object Uint8ClampedArray]', + uint16Tag = '[object Uint16Array]', + uint32Tag = '[object Uint32Array]'; /** Used to identify object classifications that are treated like arrays. */ - var arrayLikeClasses = {}; - arrayLikeClasses[argsClass] = - arrayLikeClasses[arrayClass] = arrayLikeClasses[float32Class] = - arrayLikeClasses[float64Class] = arrayLikeClasses[int8Class] = - arrayLikeClasses[int16Class] = arrayLikeClasses[int32Class] = - arrayLikeClasses[uint8Class] = arrayLikeClasses[uint8ClampedClass] = - arrayLikeClasses[uint16Class] = arrayLikeClasses[uint32Class] = true; - arrayLikeClasses[arrayBufferClass] = arrayLikeClasses[boolClass] = - arrayLikeClasses[dateClass] = arrayLikeClasses[errorClass] = - arrayLikeClasses[funcClass] = arrayLikeClasses[mapClass] = - arrayLikeClasses[numberClass] = arrayLikeClasses[objectClass] = - arrayLikeClasses[regexpClass] = arrayLikeClasses[setClass] = - arrayLikeClasses[stringClass] = arrayLikeClasses[weakMapClass] = false; + var arrayLikeTags = {}; + arrayLikeTags[argsTag] = + arrayLikeTags[arrayTag] = arrayLikeTags[float32Tag] = + arrayLikeTags[float64Tag] = arrayLikeTags[int8Tag] = + arrayLikeTags[int16Tag] = arrayLikeTags[int32Tag] = + arrayLikeTags[uint8Tag] = arrayLikeTags[uint8ClampedTag] = + arrayLikeTags[uint16Tag] = arrayLikeTags[uint32Tag] = true; + arrayLikeTags[arrayBufferTag] = arrayLikeTags[boolTag] = + arrayLikeTags[dateTag] = arrayLikeTags[errorTag] = + arrayLikeTags[funcTag] = arrayLikeTags[mapTag] = + arrayLikeTags[numberTag] = arrayLikeTags[objectTag] = + arrayLikeTags[regexpTag] = arrayLikeTags[setTag] = + arrayLikeTags[stringTag] = arrayLikeTags[weakMapTag] = false; /** Used to identify object classifications that `_.clone` supports. */ - var cloneableClasses = {}; - cloneableClasses[argsClass] = cloneableClasses[arrayClass] = - cloneableClasses[arrayBufferClass] = cloneableClasses[boolClass] = - cloneableClasses[dateClass] = cloneableClasses[float32Class] = - cloneableClasses[float64Class] = cloneableClasses[int8Class] = - cloneableClasses[int16Class] = cloneableClasses[int32Class] = - cloneableClasses[numberClass] = cloneableClasses[objectClass] = - cloneableClasses[regexpClass] = cloneableClasses[stringClass] = - cloneableClasses[uint8Class] = cloneableClasses[uint8ClampedClass] = - cloneableClasses[uint16Class] = cloneableClasses[uint32Class] = true; - cloneableClasses[errorClass] = - cloneableClasses[funcClass] = cloneableClasses[mapClass] = - cloneableClasses[setClass] = cloneableClasses[weakMapClass] = false; + var cloneableTags = {}; + cloneableTags[argsTag] = cloneableTags[arrayTag] = + cloneableTags[arrayBufferTag] = cloneableTags[boolTag] = + cloneableTags[dateTag] = cloneableTags[float32Tag] = + cloneableTags[float64Tag] = cloneableTags[int8Tag] = + cloneableTags[int16Tag] = cloneableTags[int32Tag] = + cloneableTags[numberTag] = cloneableTags[objectTag] = + cloneableTags[regexpTag] = cloneableTags[stringTag] = + cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = + cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; + cloneableTags[errorTag] = + cloneableTags[funcTag] = cloneableTags[mapTag] = + cloneableTags[setTag] = cloneableTags[weakMapTag] = false; /** Used as an internal `_.debounce` options object by `_.throttle`. */ var debounceOptions = { @@ -326,7 +326,7 @@ * @private * @param {Array} array The array to iterate over. * @param {Function} predicate The function invoked per iteration. - * @returns {Array} Returns `true` if all elements pass the predicate check, + * @returns {boolean} Returns `true` if all elements pass the predicate check, * else `false`. */ function arrayEvery(array, predicate) { @@ -829,22 +829,30 @@ * @returns {Function} Returns a new `lodash` function. * @example * - * _.mixin({ 'add': function(a, b) { return a + b; } }, false); + * _.mixin({ 'add': function(a, b) { return a + b; } }); * * var lodash = _.runInContext(); - * lodash.mixin({ 'sub': function(a, b) { return a - b; } }, false); + * lodash.mixin({ 'sub': function(a, b) { return a - b; } }); * * _.isFunction(_.add); * // => true - * * _.isFunction(_.sub); * // => false * * lodash.isFunction(lodash.add); * // => false - * * lodash.isFunction(lodash.sub); * // => true + * + * // using `context` to mock `Date#getTime` use in `_.now` + * var mock = _.runInContext({ + * 'Date': function() { + * return { 'getTime': getTimeMock }; + * } + * }); + * + * // or creating a suped-up `defer` in Node.js + * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer; */ function runInContext(context) { // Avoid issues with some ES3 environments that attempt to use values, named @@ -884,15 +892,19 @@ /** Used to generate unique IDs. */ var idCounter = 0; + /** + * Used to resolve the `toStringTag` of values. + * See the [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) + * for more details. + */ + var objToString = objectProto.toString; + /** Used to restore the original `_` reference in `_.noConflict`. */ var oldDash = context._; - /** Used to resolve the internal `[[Class]]` of values. */ - var toString = objectProto.toString; - /** Used to detect if a method is native. */ var reNative = RegExp('^' + - escapeRegExp(toString) + escapeRegExp(objToString) .replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' ); @@ -949,7 +961,7 @@ /** * Used as the maximum length of an array-like value. - * See the [ES6 spec](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength) + * See the [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength) * for more details. */ var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; @@ -1339,7 +1351,7 @@ * @private * @name get * @memberOf _.memoize.Cache - * @param {string} key The key of the value to retrieve. + * @param {string} key The key of the value to get. * @returns {*} Returns the cached value. */ function mapGet(key) { @@ -1535,9 +1547,17 @@ while (++index < length) { var key = props[index]; - object[key] = customizer - ? customizer(object[key], source[key], key, object, source) - : source[key]; + if (customizer) { + var value = object[key], + result = customizer(value, source[key], key, object, source); + + if ((result === result ? result !== value : value === value) || + (typeof value == 'undefined' && !(key in object))) { + object[key] = result; + } + } else { + object[key] = source[key]; + } } return object; } @@ -1570,49 +1590,6 @@ return result; } - /** - * The base implementation of `binaryIndex` which supports large arrays and - * determining the insert index for `NaN` and `undefined`. - * - * @private - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @param {boolean} [retHighest] Specify returning the highest, instead - * of the lowest, index at which a value should be inserted into `array`. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. - */ - function baseBinaryIndex(array, value, iteratee, retHighest) { - iteratee = iteratee == null ? identity : iteratee; - value = iteratee(value); - - var low = 0, - high = array.length, - valIsNaN = value !== value, - valIsUndef = typeof value == 'undefined'; - - while (low < high) { - var mid = floor((low + high) / 2), - computed = iteratee(array[mid]), - isReflexive = computed === computed; - - if (valIsNaN) { - var setLow = isReflexive || retHighest; - } else if (valIsUndef) { - setLow = isReflexive && (retHighest || typeof computed != 'undefined'); - } else { - setLow = retHighest ? (computed <= value) : (computed < value); - } - if (setLow) { - low = mid + 1; - } else { - high = mid; - } - } - return nativeMin(high, MAX_ARRAY_INDEX); - } - /** * The base implementation of `_.bindAll` without support for individual * method name arguments. @@ -1654,10 +1631,10 @@ if (func == null) { return identity; } - // Handle "_.pluck" and "_.where" style callback shorthands. + // Handle "_.property" and "_.matches" style callback shorthands. return type == 'object' ? baseMatches(func, argCount) - : baseProperty(argCount ? String(func) : func); + : baseProperty(argCount ? (func + '') : func); } /** @@ -1692,7 +1669,7 @@ isDeep = false; result = {}; } else if (isDeep) { - isDeep = toString.call(result) == objectClass; + isDeep = objToString.call(result) == objectTag; } } if (!isDeep || result === value) { @@ -1858,7 +1835,7 @@ * @private * @param {Array|Object|string} collection The collection to iterate over. * @param {Function} predicate The function invoked per iteration. - * @returns {Array} Returns `true` if all elements pass the predicate check, + * @returns {boolean} Returns `true` if all elements pass the predicate check, * else `false` */ function baseEvery(collection, predicate) { @@ -2140,27 +2117,27 @@ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function baseIsEqualDeep(object, other, equalFunc, customizer, isWhere, stackA, stackB) { - var objClass = isArray(object) ? arrayClass : toString.call(object), - objIsArg = objClass == argsClass, - objIsArr = !objIsArg && arrayLikeClasses[objClass], - othClass = isArray(other) ? arrayClass : toString.call(other), - othIsArg = othClass == argsClass, - othIsArr = !othIsArg && arrayLikeClasses[othClass]; + var objTag = isArray(object) ? arrayTag : objToString.call(object), + objIsArg = objTag == argsTag, + objIsArr = !objIsArg && arrayLikeTags[objTag], + othTag = isArray(other) ? arrayTag : objToString.call(other), + othIsArg = othTag == argsTag, + othIsArr = !othIsArg && arrayLikeTags[othTag]; if (objIsArg) { object = argsToObject(object); - objClass = objectClass; + objTag = objectTag; } if (othIsArg) { other = argsToObject(other); - othClass = objectClass; + othTag = objectTag; } - var objIsObj = objClass == objectClass, - othIsObj = othClass == objectClass, - isSameClass = objClass == othClass; + var objIsObj = objTag == objectTag, + othIsObj = othTag == objectTag, + isSameTag = objTag == othTag; - if (isSameClass && !(objIsArr || objIsObj)) { - return equalByClass(object, other, objClass); + if (isSameTag && !(objIsArr || objIsObj)) { + return equalByTag(object, other, objTag); } var valWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), othWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); @@ -2168,7 +2145,7 @@ if (valWrapped || othWrapped) { return equalFunc(valWrapped ? object.value() : object, othWrapped ? other.value() : other, customizer, isWhere, stackA, stackB); } - if (!isSameClass) { + if (!isSameTag) { return false; } // Assume cyclic structures are equal. @@ -2323,11 +2300,14 @@ value = object[key]; if (!(isArr || isObj)) { - result = customizer ? customizer(value, srcValue, key, object, source) : undefined; - if (typeof result == 'undefined') { + var result = customizer ? customizer(value, srcValue, key, object, source) : undefined, + isCommon = typeof result == 'undefined'; + + if (isCommon) { result = srcValue; } - if (isSrcArr || typeof result != 'undefined') { + if ((isSrcArr || typeof result != 'undefined') && + (isCommon || (result === result ? result !== value : value === value))) { object[key] = result; } return; @@ -2343,10 +2323,10 @@ return; } } - var result = customizer ? customizer(value, srcValue, key, object, source) : undefined, - isDeep = typeof result == 'undefined'; + result = customizer ? customizer(value, srcValue, key, object, source) : undefined; + isCommon = typeof result == 'undefined'; - if (isDeep) { + if (isCommon) { result = isArr ? (isArray(value) ? value : []) : (isPlainObject(value) ? value : {}); @@ -2357,10 +2337,11 @@ stackB.push(result); // Recursively merge objects and arrays (susceptible to call stack limits). - if (isDeep) { - baseMerge(result, srcValue, customizer, stackA, stackB); + if (isCommon) { + object[key] = baseMerge(result, srcValue, customizer, stackA, stackB); + } else if (result === result ? result !== value : value === value) { + object[key] = result; } - object[key] = result; }); return object; } @@ -2369,7 +2350,7 @@ * The base implementation of `_.property` which does not coerce `key` to a string. * * @private - * @param {string} key The name of the property to retrieve. + * @param {string} key The name of the property to get. * @returns {Function} Returns the new function. */ function baseProperty(key) { @@ -2564,49 +2545,87 @@ while (++index < length) { var args = [result], - action = actions[index], - object = action.object; + action = actions[index]; push.apply(args, action.args); - result = object[action.name].apply(object, args); + result = action.func.apply(action.thisArg, args); } return result; } /** * Performs a binary search of `array` to determine the index at which `value` - * should be inserted into `array` in order to maintain its sort order. If - * `iteratee` is provided it is invoked for `value` and each element of - * `array` to compute their sort ranking. The iteratee is invoked with one - * argument; (value). + * should be inserted into `array` in order to maintain its sort order. * * @private * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. - * @param {Function} [iteratee] The function invoked per iteration. * @param {boolean} [retHighest] Specify returning the highest, instead * of the lowest, index at which a value should be inserted into `array`. * @returns {number} Returns the index at which `value` should be inserted * into `array`. */ - function binaryIndex(array, value, iteratee, retHighest) { + function binaryIndex(array, value, retHighest) { var low = 0, high = array ? array.length : low; - if (high && (iteratee || value !== value || typeof value == 'undefined' || high > HALF_MAX_ARRAY_LENGTH)) { - return baseBinaryIndex(array, value, iteratee, retHighest); - } - while (low < high) { - var mid = (low + high) >>> 1, - computed = array[mid]; + if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) { + while (low < high) { + var mid = (low + high) >>> 1, + computed = array[mid]; - if (retHighest ? (computed <= value) : (computed < value)) { + if (retHighest ? (computed <= value) : (computed < value)) { + low = mid + 1; + } else { + high = mid; + } + } + return high; + } + return binaryIndexBy(array, value, identity, retHighest); + } + + /** + * This function is like `binaryIndex` except that it invokes `iteratee` for + * `value` and each element of `array` to compute their sort ranking. The + * iteratee is invoked with one argument; (value). + * + * @private + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {Function} iteratee The function invoked per iteration. + * @param {boolean} [retHighest] Specify returning the highest, instead + * of the lowest, index at which a value should be inserted into `array`. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + */ + function binaryIndexBy(array, value, iteratee, retHighest) { + value = iteratee(value); + + var low = 0, + high = array ? array.length : 0, + valIsNaN = value !== value, + valIsUndef = typeof value == 'undefined'; + + while (low < high) { + var mid = floor((low + high) / 2), + computed = iteratee(array[mid]), + isReflexive = computed === computed; + + if (valIsNaN) { + var setLow = isReflexive || retHighest; + } else if (valIsUndef) { + setLow = isReflexive && (retHighest || typeof computed != 'undefined'); + } else { + setLow = retHighest ? (computed <= value) : (computed < value); + } + if (setLow) { low = mid + 1; } else { high = mid; } } - return high; + return nativeMin(high, MAX_ARRAY_INDEX); } /** @@ -2752,9 +2771,8 @@ /** * Creates a function that aggregates a collection, creating an accumulator * object composed from the results of running each element in the collection - * through `iteratee`. The given setter function sets the keys and values of - * the accumulator object. If `initializer` is provided it is used to initialize - * the accumulator object. + * through an iteratee. The `setter` sets the keys and values of the accumulator + * object. If `initializer` is provided initializes the accumulator object. * * @private * @param {Function} setter The function to set keys and values of the accumulator object. @@ -2788,7 +2806,7 @@ * destination object. * * @private - * @param {Function} assigner The function to handle assigning values. + * @param {Function} assigner The function to assign values. * @returns {Function} Returns the new assigner function. */ function createAssigner(assigner) { @@ -2850,7 +2868,7 @@ * given string. * * @private - * @param {Function} callback The function invoked to combine each word. + * @param {Function} callback The function to combine each word. * @returns {Function} Returns the new compounder function. */ function createCompounder(callback) { @@ -2886,6 +2904,39 @@ }; } + /** + * Creates a function that gets the extremum value of a collection. + * + * @private + * @param {Function} arrayFunc The function to get the extremum value from an array. + * @param {boolean} [isMin] Specify returning the minimum, instead of the maximum, + * extremum value. + * @returns {Function} Returns the new extremum function. + */ + function createExtremum(arrayFunc, isMin) { + return function(collection, iteratee, thisArg) { + if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { + iteratee = null; + } + var func = getCallback(), + noIteratee = iteratee == null; + + if (!(func === baseCallback && noIteratee)) { + noIteratee = false; + iteratee = func(iteratee, thisArg, 3); + } + if (noIteratee) { + var isArr = isArray(collection); + if (!isArr && isString(collection)) { + iteratee = charAtCallback; + } else { + return arrayFunc(isArr ? collection : toIterable(collection)); + } + } + return extremumBy(collection, iteratee, isMin); + }; + } + /** * Creates a function that wraps `func` and invokes it with optional `this` * binding of, partial application, and currying. @@ -2988,7 +3039,7 @@ return ''; } var padLength = length - strLength; - chars = chars == null ? ' ' : String(chars); + chars = chars == null ? ' ' : (chars + ''); return repeat(chars, ceil(padLength / chars.length)).slice(0, padLength); } @@ -3063,9 +3114,7 @@ bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG); partials = holders = null; } - holders = (partials && !holders) ? [] : holders; length -= (holders ? holders.length : 0); - if (bitmask & PARTIAL_RIGHT_FLAG) { var partialsRight = partials, holdersRight = holders; @@ -3077,12 +3126,13 @@ if (data && data !== true) { mergeData(newData, data); + bitmask = newData[1]; + arity = newData[9]; } - newData[9] = newData[9] == null - ? (isBindKey ? 0 : newData[0].length) - : (nativeMax(newData[9] - length, 0) || 0); + newData[9] = arity == null + ? (isBindKey ? 0 : func.length) + : (nativeMax(arity - length, 0) || 0); - bitmask = newData[1]; if (bitmask == BIND_FLAG) { var result = createBindWrapper(newData[0], newData[2]); } else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !newData[4].length) { @@ -3148,40 +3198,40 @@ /** * A specialized version of `baseIsEqualDeep` for comparing objects of - * the same `[[Class]]`. + * the same `toStringTag`. * - * **Note:** This function only supports comparing values with `[[Class]]` + * **Note:** This function only supports comparing values with `toStringTag` * values of `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. * * @private * @param {Object} value The object to compare to `other`. * @param {Object} other The object to compare to `object`. - * @param {string} className The `[[Class]]` of the objects to compare. + * @param {string} tag The `toStringTag` of the objects to compare. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ - function equalByClass(object, other, className) { - switch (className) { - case boolClass: - case dateClass: + function equalByTag(object, other, tag) { + switch (tag) { + case boolTag: + case dateTag: // Coerce dates and booleans to numbers, dates to milliseconds and booleans // to `1` or `0` treating invalid dates coerced to `NaN` as not equal. return +object == +other; - case errorClass: + case errorTag: return object.name == other.name && object.message == other.message; - case numberClass: + case numberTag: // Treat `NaN` vs. `NaN` as equal. return (object != +object) ? other != +other // But, treat `-0` vs. `+0` as not equal. : (object == 0 ? ((1 / object) == (1 / other)) : object == +other); - case regexpClass: - case stringClass: + case regexpTag: + case stringTag: // Coerce regexes to strings (http://es5.github.io/#x15.10.6.4) and // treat strings primitives and string objects as equal. - return object == String(other); + return object == (other + ''); } return false; } @@ -3248,6 +3298,33 @@ return true; } + /** + * Gets the extremum value of `collection` invoking `iteratee` for each value + * in `collection` to generate the criterion by which the value is ranked. + * The `iteratee` is invoked with three arguments; (value, index, collection). + * + * @private + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {boolean} [isMin] Specify returning the minimum, instead of the + * maximum, extremum value. + * @returns {*} Returns the extremum value. + */ + function extremumBy(collection, iteratee, isMin) { + var exValue = isMin ? POSITIVE_INFINITY : NEGATIVE_INFINITY, + computed = exValue, + result = computed; + + baseEach(collection, function(value, index, collection) { + var current = iteratee(value, index, collection); + if ((isMin ? current < computed : current > computed) || (current === exValue && current === result)) { + computed = current; + result = value; + } + }); + return result; + } + /** * Gets the appropriate "callback" function. If the `_.callback` method is * customized this function returns the custom method, otherwise it returns @@ -3357,9 +3434,9 @@ return null; } var Ctor = object.constructor, - className = toString.call(object), - isArgs = className == argsClass, - isObj = className == objectClass; + tag = objToString.call(object), + isArgs = tag == argsTag, + isObj = tag == objectTag; if (isObj && !(typeof Ctor == 'function' && Ctor instanceof Ctor)) { Ctor = Object; @@ -3371,25 +3448,25 @@ } return result; } - switch (className) { - case arrayBufferClass: + switch (tag) { + case arrayBufferTag: return bufferClone(object); - case boolClass: - case dateClass: + case boolTag: + case dateTag: return new Ctor(+object); - case float32Class: case float64Class: - case int8Class: case int16Class: case int32Class: - case uint8Class: case uint8ClampedClass: case uint16Class: case uint32Class: + case float32Tag: case float64Tag: + case int8Tag: case int16Tag: case int32Tag: + case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: var buffer = object.buffer; return new Ctor(isDeep ? bufferClone(buffer) : buffer, object.byteOffset, object.length); - case numberClass: - case stringClass: + case numberTag: + case stringTag: return new Ctor(object); - case regexpClass: + case regexpTag: result = new Ctor(object.source, reFlags.exec(object)); result.lastIndex = object.lastIndex; } @@ -3405,7 +3482,7 @@ */ function isArrayLike(value) { return (isObjectLike(value) && isLength(value.length) && - (arrayLikeClasses[toString.call(value)])) || false; + (arrayLikeTags[objToString.call(value)])) || false; } /** @@ -3441,7 +3518,7 @@ * @returns {boolean} Returns `true` if `value` is cloneable, else `false`. */ function isCloneable(value) { - return (value && cloneableClasses[toString.call(value)]) || false; + return (value && cloneableTags[objToString.call(value)]) || false; } /** @@ -3475,7 +3552,7 @@ * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. */ function isLength(value) { - return typeof value == 'number' && value > -1 && value <= MAX_SAFE_INTEGER; + return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** @@ -3682,7 +3759,7 @@ support = lodash.support; // Exit early for non `Object` objects. - if (!(isObjectLike(value) && toString.call(value) == objectClass) || + if (!(isObjectLike(value) && objToString.call(value) == objectTag) || (!hasOwnProperty.call(value, 'constructor') && (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor)))) { return false; @@ -3757,6 +3834,21 @@ return isObject(value) ? value : Object(value); } + /** + * Converts `value` to a string if it is not one. An empty string is + * returned for `null` or `undefined` values. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ + function toString(value) { + if (typeof value == 'string') { + return value; + } + return value == null ? '' : (value + ''); + } + /*------------------------------------------------------------------------*/ /** @@ -3798,7 +3890,7 @@ /** * Creates an array with all falsey values removed. The values `false`, `null`, - * `0`, `""`, `undefined`, and `NaN` are all falsey. + * `0`, `""`, `undefined`, and `NaN` are falsey. * * @static * @memberOf _ @@ -3871,7 +3963,7 @@ * @returns {Array} Returns the slice of `array`. * @example * - * _.drop([1, 2, 3], 1); + * _.drop([1, 2, 3]); * // => [2, 3] * * _.drop([1, 2, 3], 2); @@ -3903,7 +3995,7 @@ * @returns {Array} Returns the slice of `array`. * @example * - * _.dropRight([1, 2, 3], 1); + * _.dropRight([1, 2, 3]); * // => [1, 2] * * _.dropRight([1, 2, 3], 2); @@ -3928,12 +4020,12 @@ * Elements are dropped until `predicate` returns falsey. The predicate is * bound to `thisArg` and invoked with three arguments; (value, index, array). * - * If a property name is provided for `predicate` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `predicate` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -3955,11 +4047,11 @@ * { 'user': 'pebbles', 'status': 'away', 'active': true } * ]; * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.pluck(_.dropRightWhile(users, 'active'), 'user'); * // => ['barney'] * - * // using "_.where" callback shorthand + * // using the "_.matches" callback shorthand * _.pluck(_.dropRightWhile(users, { 'status': 'away' }), 'user'); * // => ['barney', 'fred'] */ @@ -3976,12 +4068,12 @@ * Elements are dropped until `predicate` returns falsey. The predicate is * bound to `thisArg` and invoked with three arguments; (value, index, array). * - * If a property name is provided for `predicate` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `predicate` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -4003,11 +4095,11 @@ * { 'user': 'pebbles', 'status': 'away', 'active': true } * ]; * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.pluck(_.dropWhile(users, 'active'), 'user'); * // => ['fred', 'pebbles'] * - * // using "_.where" callback shorthand + * // using the "_.matches" callback shorthand * _.pluck(_.dropWhile(users, { 'status': 'busy' }), 'user'); * // => ['pebbles'] */ @@ -4024,12 +4116,12 @@ * This method is like `_.find` except that it returns the index of the first * element `predicate` returns truthy for, instead of the element itself. * - * If a property name is provided for `predicate` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `predicate` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -4037,7 +4129,7 @@ * @param {Array} array The array to search. * @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. + * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {number} Returns the index of the found element, else `-1`. * @example @@ -4051,11 +4143,11 @@ * _.findIndex(users, function(chr) { return chr.age < 40; }); * // => 0 * - * // using "_.where" callback shorthand + * // using the "_.matches" callback shorthand * _.findIndex(users, { 'age': 1 }); * // => 2 * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.findIndex(users, 'active'); * // => 1 */ @@ -4076,12 +4168,12 @@ * This method is like `_.findIndex` except that it iterates over elements * of `collection` from right to left. * - * If a property name is provided for `predicate` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `predicate` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -4089,7 +4181,7 @@ * @param {Array} array The array to search. * @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. + * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {number} Returns the index of the found element, else `-1`. * @example @@ -4103,11 +4195,11 @@ * _.findLastIndex(users, function(chr) { return chr.age < 40; }); * // => 2 * - * // using "_.where" callback shorthand + * // using the "_.matches" callback shorthand * _.findLastIndex(users, { 'age': 40 }); * // => 1 * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.findLastIndex(users, 'active'); * // => 0 */ @@ -4368,7 +4460,7 @@ if (typeof fromIndex == 'number') { index = (fromIndex < 0 ? nativeMax(length + fromIndex, 0) : nativeMin(fromIndex || 0, length - 1)) + 1; } else if (fromIndex) { - index = binaryIndex(array, value, null, true) - 1; + index = binaryIndex(array, value, true) - 1; var other = array[index]; return (value === value ? value === other : other !== other) ? index : -1; } @@ -4460,12 +4552,12 @@ * and returns an array of the removed elements. The predicate is bound to * `thisArg` and invoked with three arguments; (value, index, array). * - * If a property name is provided for `predicate` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `predicate` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * **Note:** Unlike `_.filter`, this method mutates `array`. * @@ -4475,7 +4567,7 @@ * @param {Array} array The array to modify. * @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. + * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {Array} Returns the new array of removed elements. * @example @@ -4574,12 +4666,12 @@ * to compute their sort ranking. The iteratee is bound to `thisArg` and * invoked with one argument; (value). * - * If a property name is provided for `iteratee` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `iteratee` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -4588,7 +4680,7 @@ * @param {*} value The value to evaluate. * @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. + * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {number} Returns the index at which `value` should be inserted * into `array`. @@ -4608,13 +4700,15 @@ * }, dict); * // => 1 * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.sortedIndex([{ 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x'); * // => 1 */ function sortedIndex(array, value, iteratee, thisArg) { - iteratee = iteratee == null ? iteratee : getCallback(iteratee, thisArg, 1); - return binaryIndex(array, value, iteratee); + var func = getCallback(iteratee); + return (func === baseCallback && iteratee == null) + ? binaryIndex(array, value) + : binaryIndexBy(array, value, func(iteratee, thisArg, 1)); } /** @@ -4629,7 +4723,7 @@ * @param {*} value The value to evaluate. * @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. + * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {number} Returns the index at which `value` should be inserted * into `array`. @@ -4639,8 +4733,10 @@ * // => 4 */ function sortedLastIndex(array, value, iteratee, thisArg) { - iteratee = iteratee == null ? iteratee : getCallback(iteratee, thisArg, 1); - return binaryIndex(array, value, iteratee, true); + var func = getCallback(iteratee); + return (func === baseCallback && iteratee == null) + ? binaryIndex(array, value, true) + : binaryIndexBy(array, value, func(iteratee, thisArg, 1), true); } /** @@ -4656,7 +4752,7 @@ * @returns {Array} Returns the slice of `array`. * @example * - * _.take([1, 2, 3], 1); + * _.take([1, 2, 3]); * // => [1] * * _.take([1, 2, 3], 2); @@ -4688,7 +4784,7 @@ * @returns {Array} Returns the slice of `array`. * @example * - * _.takeRight([1, 2, 3], 1); + * _.takeRight([1, 2, 3]); * // => [3] * * _.takeRight([1, 2, 3], 2); @@ -4713,12 +4809,12 @@ * taken until `predicate` returns falsey. The predicate is bound to `thisArg` * and invoked with three arguments; (value, index, array). * - * If a property name is provided for `predicate` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `predicate` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -4740,11 +4836,11 @@ * { 'user': 'pebbles', 'status': 'away', 'active': true } * ]; * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.pluck(_.takeRightWhile(users, 'active'), 'user'); * // => ['fred', 'pebbles'] * - * // using "_.where" callback shorthand + * // using the "_.matches" callback shorthand * _.pluck(_.takeRightWhile(users, { 'status': 'away' }), 'user'); * // => ['pebbles'] */ @@ -4761,12 +4857,12 @@ * are taken until `predicate` returns falsey. The predicate is bound to * `thisArg` and invoked with three arguments; (value, index, array). * - * If a property name is provided for `predicate` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `predicate` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -4788,11 +4884,11 @@ * { 'user': 'pebbles', 'status': 'away', 'active': true } * ]; * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.pluck(_.takeWhile(users, 'active'), 'user'); * // => ['barney'] * - * // using "_.where" callback shorthand + * // using the "_.matches" callback shorthand * _.pluck(_.takeWhile(users, { 'status': 'busy' }), 'user'); * // => ['barney', 'fred'] */ @@ -4836,12 +4932,12 @@ * uniqueness is computed. The `iteratee` is bound to `thisArg` and invoked * with three arguments; (value, index, array). * - * If a property name is provided for `iteratee` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `iteratee` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * **Note:** `SameValueZero` comparisons are like strict equality comparisons, * e.g. `===`, except that `NaN` matches `NaN`. See the @@ -4855,8 +4951,8 @@ * @param {Array} array The array to inspect. * @param {boolean} [isSorted] Specify the array is sorted. * @param {Function|Object|string} [iteratee] 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. + * If a property name or object is provided it is used to create a "_.property" + * or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Array} Returns the new duplicate-value-free array. * @example @@ -4872,7 +4968,7 @@ * _.uniq([1, 2.5, 1.5, 2], function(n) { return this.floor(n); }, Math); * // => [1, 2.5] * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); * // => [{ 'x': 1 }, { 'x': 2 }] */ @@ -4887,10 +4983,10 @@ iteratee = isIterateeCall(array, isSorted, thisArg) ? null : isSorted; isSorted = false; } - iteratee = iteratee == null - ? iteratee - : getCallback(iteratee, thisArg, 3); - + var func = getCallback(); + if (!(func === baseCallback && iteratee == null)) { + iteratee = func(iteratee, thisArg, 3); + } return (isSorted && getIndexOf() == baseIndexOf) ? sortedUniq(array, iteratee) : baseUniq(array, iteratee); @@ -5029,7 +5125,7 @@ length = props ? props.length : 0, result = {}; - if (!values && length && !isArray(props[0])) { + if (length && !values && !isArray(props[0])) { values = []; } while (++index < length) { @@ -5195,7 +5291,7 @@ * // => '1,2,3' */ function wrapperToString() { - return String(this.value()); + return (this.value() + ''); } /** @@ -5303,12 +5399,12 @@ * The `iteratee` is bound to `thisArg` and invoked with three arguments; * (value, index|key, collection). * - * If a property name is provided for `iteratee` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `iteratee` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -5316,7 +5412,7 @@ * @param {Array|Object|string} collection The collection to iterate over. * @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. + * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Object} Returns the composed aggregate object. * @example @@ -5339,12 +5435,12 @@ * The predicate is bound to `thisArg` and invoked with three arguments; * (value, index|key, collection). * - * If a property name is provided for `predicate` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `predicate` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -5353,7 +5449,7 @@ * @param {Array|Object|string} collection The collection to iterate over. * @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. + * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {boolean} Returns `true` if all elements pass the predicate check, * else `false`. @@ -5367,11 +5463,11 @@ * { 'user': 'fred', 'age': 40 } * ]; * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.every(users, 'age'); * // => true * - * // using "_.where" callback shorthand + * // using the "_.matches" callback shorthand * _.every(users, { 'age': 36 }); * // => false */ @@ -5388,12 +5484,12 @@ * `predicate` returns truthy for. The predicate is bound to `thisArg` and * invoked with three arguments; (value, index|key, collection). * - * If a property name is provided for `predicate` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `predicate` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -5402,7 +5498,7 @@ * @param {Array|Object|string} collection The collection to iterate over. * @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. + * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {Array} Returns the new filtered array. * @example @@ -5415,11 +5511,11 @@ * { 'user': 'fred', 'age': 40, 'active': true } * ]; * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.pluck(_.filter(users, 'active'), 'user'); * // => ['fred'] * - * // using "_.where" callback shorthand + * // using the "_.matches" callback shorthand * _.pluck(_.filter(users, { 'age': 36 }), 'user'); * // => ['barney'] */ @@ -5435,12 +5531,12 @@ * `predicate` returns truthy for. The predicate is bound to `thisArg` and * invoked with three arguments; (value, index|key, collection). * - * If a property name is provided for `predicate` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `predicate` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -5449,7 +5545,7 @@ * @param {Array|Object|string} collection The collection to search. * @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. + * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {*} Returns the matched element, else `undefined`. * @example @@ -5463,11 +5559,11 @@ * _.result(_.find(users, function(chr) { return chr.age < 40; }), 'user'); * // => 'barney' * - * // using "_.where" callback shorthand + * // using the "_.matches" callback shorthand * _.result(_.find(users, { 'age': 1 }), 'user'); * // => 'pebbles' * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.result(_.find(users, 'active'), 'user'); * // => 'fred' */ @@ -5490,7 +5586,7 @@ * @param {Array|Object|string} collection The collection to search. * @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. + * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {*} Returns the matched element, else `undefined`. * @example @@ -5593,12 +5689,12 @@ * The `iteratee` is bound to `thisArg` and invoked with three arguments; * (value, index|key, collection). * - * If a property name is provided for `iteratee` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `iteratee` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -5606,7 +5702,7 @@ * @param {Array|Object|string} collection The collection to iterate over. * @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. + * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Object} Returns the composed aggregate object. * @example @@ -5617,7 +5713,7 @@ * _.groupBy([4.2, 6.1, 6.4], function(n) { return this.floor(n); }, Math); * // => { '4': [4.2], '6': [6.1, 6.4] } * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.groupBy(['one', 'two', 'three'], 'length'); * // => { '3': ['one', 'two'], '5': ['three'] } */ @@ -5636,12 +5732,12 @@ * iteratee function is bound to `thisArg` and invoked with three arguments; * (value, index|key, collection). * - * If a property name is provided for `iteratee` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `iteratee` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -5649,7 +5745,7 @@ * @param {Array|Object|string} collection The collection to iterate over. * @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. + * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Object} Returns the composed aggregate object. * @example @@ -5703,12 +5799,12 @@ * `iteratee`. The `iteratee` is bound to `thisArg` and invoked with three * arguments; (value, index|key, collection). * - * If a property name is provided for `iteratee` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `iteratee` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -5717,7 +5813,7 @@ * @param {Array|Object|string} collection The collection to iterate over. * @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. + * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Array} Returns the new mapped array. * @example @@ -5733,7 +5829,7 @@ * { 'user': 'fred' } * ]; * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.map(users, 'user'); * // => ['barney', 'fred'] */ @@ -5745,26 +5841,26 @@ } /** - * Retrieves the maximum value of `collection`. If `collection` is empty or - * falsey `-Infinity` is returned. If an iteratee function is provided it is - * invoked for each value in `collection` to generate the criterion by which - * the value is ranked. The `iteratee` is bound to `thisArg` and invoked with - * three arguments; (value, index, collection). + * Gets the maximum value of `collection`. If `collection` is empty or falsey + * `-Infinity` is returned. If an iteratee function is provided it is invoked + * for each value in `collection` to generate the criterion by which the value + * is ranked. The `iteratee` is bound to `thisArg` and invoked with three + * arguments; (value, index, collection). * - * If a property name is provided for `iteratee` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `iteratee` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. * @param {Function|Object|string} [iteratee] 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. + * If a property name or object is provided it is used to create a "_.property" + * or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {*} Returns the maximum value. * @example @@ -5783,59 +5879,33 @@ * _.max(users, function(chr) { return chr.age; }); * // => { 'user': 'fred', 'age': 40 }; * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.max(users, 'age'); * // => { 'user': 'fred', 'age': 40 }; */ - function max(collection, iteratee, thisArg) { - if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { - iteratee = null; - } - var noIteratee = iteratee == null, - isArr = noIteratee && isArray(collection), - isStr = !isArr && isString(collection); - - if (noIteratee && !isStr) { - 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; - } + var max = createExtremum(arrayMax); /** - * Retrieves the minimum value of `collection`. If `collection` is empty or - * falsey `Infinity` is returned. If an iteratee function is provided it is - * invoked for each value in `collection` to generate the criterion by which - * the value is ranked. The `iteratee` is bound to `thisArg` and invoked with - * three arguments; (value, index, collection). + * Gets the minimum value of `collection`. If `collection` is empty or falsey + * `Infinity` is returned. If an iteratee function is provided it is invoked + * for each value in `collection` to generate the criterion by which the value + * is ranked. The `iteratee` is bound to `thisArg` and invoked with three + * arguments; (value, index, collection). * - * If a property name is provided for `iteratee` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `iteratee` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. * @param {Function|Object|string} [iteratee] 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. + * If a property name or object is provided it is used to create a "_.property" + * or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {*} Returns the minimum value. * @example @@ -5854,37 +5924,11 @@ * _.min(users, function(chr) { return chr.age; }); * // => { 'user': 'barney', 'age': 36 }; * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.min(users, 'age'); * // => { 'user': 'barney', 'age': 36 }; */ - function min(collection, iteratee, thisArg) { - if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { - iteratee = null; - } - var noIteratee = iteratee == null, - isArr = noIteratee && isArray(collection), - isStr = !isArr && isString(collection); - - if (noIteratee && !isStr) { - 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; - } + var min = createExtremum(arrayMin, true); /** * Creates an array of elements split into two groups, the first of which @@ -5892,12 +5936,12 @@ * contains elements `predicate` returns falsey for. The predicate is bound * to `thisArg` and invoked with three arguments; (value, index|key, collection). * - * If a property name is provided for `predicate` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `predicate` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -5905,7 +5949,7 @@ * @param {Array|Object|string} collection The collection to iterate over. * @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. + * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {Array} Returns the array of grouped elements. * @example @@ -5922,11 +5966,11 @@ * { 'user': 'pebbles', 'age': 1, 'active': false } * ]; * - * // using "_.where" callback shorthand + * // using the "_.matches" callback shorthand * _.map(_.partition(users, { 'age': 1 }), function(array) { return _.pluck(array, 'user'); }); * // => [['pebbles'], ['barney', 'fred']] * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.map(_.partition(users, 'active'), function(array) { return _.pluck(array, 'user'); }); * // => [['fred'], ['barney', 'pebbles']] */ @@ -5935,7 +5979,7 @@ }, function() { return [[], []]; }); /** - * Retrieves the value of a specified property from all elements in `collection`. + * Gets the value of a specified property from all elements in `collection`. * * @static * @memberOf _ @@ -6022,12 +6066,12 @@ * The opposite of `_.filter`; this method returns the elements of `collection` * that `predicate` does **not** return truthy for. * - * If a property name is provided for `predicate` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `predicate` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -6035,7 +6079,7 @@ * @param {Array|Object|string} collection The collection to iterate over. * @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. + * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {Array} Returns the new filtered array. * @example @@ -6048,11 +6092,11 @@ * { 'user': 'fred', 'age': 40, 'active': true } * ]; * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.pluck(_.reject(users, 'active'), 'user'); * // => ['barney'] * - * // using "_.where" callback shorthand + * // using the "_.matches" callback shorthand * _.pluck(_.reject(users, { 'age': 36 }), 'user'); * // => ['fred'] */ @@ -6066,7 +6110,7 @@ } /** - * Retrieves a random element or `n` random elements from a collection. + * Gets a random element or `n` random elements from a collection. * * @static * @memberOf _ @@ -6134,7 +6178,7 @@ * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to inspect. - * @returns {number} Returns `collection.length` or number of own enumerable properties. + * @returns {number} Returns the size of `collection`. * @example * * _.size([1, 2]); @@ -6157,12 +6201,12 @@ * over the entire collection. The predicate is bound to `thisArg` and invoked * with three arguments; (value, index|key, collection). * - * If a property name is provided for `predicate` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `predicate` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -6171,7 +6215,7 @@ * @param {Array|Object|string} collection The collection to iterate over. * @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. + * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {boolean} Returns `true` if any element passes the predicate check, * else `false`. @@ -6185,11 +6229,11 @@ * { 'user': 'fred', 'age': 40, 'active': true } * ]; * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.some(users, 'active'); * // => true * - * // using "_.where" callback shorthand + * // using the "_.matches" callback shorthand * _.some(users, { 'age': 1 }); * // => false */ @@ -6208,12 +6252,12 @@ * The `iteratee` is bound to `thisArg` and invoked with three arguments; * (value, index|key, collection). * - * If a property name is provided for `iteratee` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `iteratee` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -6221,7 +6265,7 @@ * @param {Array|Object|string} collection The collection to iterate over. * @param {Array|Function|Object|string} [iteratee=_.identity] The function * invoked per iteration. If a property name or an object is provided it is - * used to create a "_.pluck" or "_.where" style callback respectively. + * used to create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Array} Returns the new sorted array. * @example @@ -6238,7 +6282,7 @@ * { 'user': 'barney' } * ]; * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.pluck(_.sortBy(users, 'user'), 'user'); * // => ['barney', 'fred', 'pebbles'] */ @@ -6747,13 +6791,13 @@ * jQuery('#postbox').on('click', _.debounce(sendMail, 300, { * 'leading': true, * 'trailing': false - * }); + * })); * * // ensure `batchLog` is invoked once after 1 second of debounced calls * var source = new EventSource('/stream'); * jQuery(source).on('message', _.debounce(batchLog, 250, { * 'maxWait': 1000 - * }, false); + * })); * * // cancel a debounced call * var todoChanges = _.debounce(batchLog, 1000); @@ -7038,14 +7082,6 @@ * @returns {Function} Returns the new memoizing function. * @example * - * var fibonacci = _.memoize(function(n) { - * return n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2); - * }); - * - * fibonacci(9) - * // => 34 - * - * // modifying the result cache * var upperCase = _.memoize(function(string) { * return string.toUpperCase(); * }); @@ -7053,9 +7089,28 @@ * upperCase('fred'); * // => 'FRED' * + * // modifying the result cache * upperCase.cache.set('fred, 'BARNEY'); * upperCase('fred'); * // => 'BARNEY' + * + * // replacing `_.memoize.Cache` + * var object = { 'user': 'fred' }; + * var other = { 'user': 'barney' }; + * var identity = _.memoize(_.identity); + * + * identity(object); + * // => { 'user': 'fred' } + * identity(other); + * // => { 'user': 'fred' } + * + * _.memoize.Cache = WeakMap; + * var identity = _.memoize(_.identity); + * + * identity(object); + * // => { 'user': 'fred' } + * identity(other); + * // => { 'user': 'barney' } */ function memoize(func, resolver) { if (!isFunction(func) || (resolver && !isFunction(resolver))) { @@ -7314,7 +7369,7 @@ */ function wrap(value, wrapper) { wrapper = wrapper == null ? identity : wrapper; - return createWrapper(wrapper, PARTIAL_FLAG, null, [value]); + return createWrapper(wrapper, PARTIAL_FLAG, null, [value], []); } /*------------------------------------------------------------------------*/ @@ -7324,7 +7379,7 @@ * otherwise they are assigned by reference. If `customizer` is provided it is * invoked to produce the cloned values. If `customizer` returns `undefined` * cloning is handled by the method instead. The `customizer` is bound to - * `thisArg` and invoked with two argument; (value, index|key). + * `thisArg` and invoked with two argument; (value [, index|key, object]). * * **Note:** This method is loosely based on the structured clone algorithm. * The enumerable properties of `arguments` objects and objects created by @@ -7356,14 +7411,16 @@ * deep[0] === users[0]; * // => false * - * _.mixin({ - * 'clone': _.partialRight(_.clone, function(value) { - * return _.isElement(value) ? value.cloneNode(false) : undefined; - * }) + * // using a customizer callback + * var body = _.clone(document.body, function(value) { + * return _.isElement(value) ? value.cloneNode(false) : undefined; * }); * - * var clone = _.clone(document.body); - * clone.childNodes.length; + * body === document.body + * // => false + * body.nodeName + * // => BODY + * body.childNodes.length; * // => 0 */ function clone(value, isDeep, customizer, thisArg) { @@ -7381,7 +7438,7 @@ * Creates a deep clone of `value`. If `customizer` is provided it is invoked * to produce the cloned values. If `customizer` returns `undefined` cloning * is handled by the method instead. The `customizer` is bound to `thisArg` - * and invoked with two argument; (value, index|key). + * and invoked with two argument; (value [, index|key, object]). * * **Note:** This method is loosely based on the structured clone algorithm. * The enumerable properties of `arguments` objects and objects created by @@ -7408,17 +7465,17 @@ * deep[0] === users[0]; * // => false * - * var view = { - * 'label': 'docs', - * 'node': element - * }; - * - * var clone = _.cloneDeep(view, function(value) { + * // using a customizer callback + * var el = _.cloneDeep(document.body, function(value) { * return _.isElement(value) ? value.cloneNode(true) : undefined; * }); * - * clone.node == view.node; + * body === document.body * // => false + * body.nodeName + * // => BODY + * body.childNodes.length; + * // => 20 */ function cloneDeep(value, customizer, thisArg) { customizer = typeof customizer == 'function' && bindCallback(customizer, thisArg, 1); @@ -7443,7 +7500,7 @@ */ function isArguments(value) { var length = isObjectLike(value) ? value.length : undefined; - return (isLength(length) && toString.call(value) == argsClass) || false; + return (isLength(length) && objToString.call(value) == argsTag) || false; } /** @@ -7463,7 +7520,7 @@ * // => false */ var isArray = nativeIsArray || function(value) { - return (isObjectLike(value) && isLength(value.length) && toString.call(value) == arrayClass) || false; + return (isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag) || false; }; /** @@ -7483,7 +7540,7 @@ * // => false */ function isBoolean(value) { - return (value === true || value === false || isObjectLike(value) && toString.call(value) == boolClass) || false; + return (value === true || value === false || isObjectLike(value) && objToString.call(value) == boolTag) || false; } /** @@ -7503,7 +7560,7 @@ * // => false */ function isDate(value) { - return (isObjectLike(value) && toString.call(value) == dateClass) || false; + return (isObjectLike(value) && objToString.call(value) == dateTag) || false; } /** @@ -7524,7 +7581,7 @@ */ function isElement(value) { return (value && value.nodeType === 1 && isObjectLike(value) && - toString.call(value).indexOf('Element') > -1) || false; + objToString.call(value).indexOf('Element') > -1) || false; } // Fallback for environments without DOM support. if (!support.dom) { @@ -7577,7 +7634,7 @@ * equivalent. If `customizer` is provided it is invoked to compare values. * If `customizer` returns `undefined` comparisons are handled by the method * instead. The `customizer` is bound to `thisArg` and invoked with three - * arguments; (value, other, key). + * arguments; (value, other [, index|key]). * * **Note:** This method supports comparing arrays, booleans, `Date` objects, * numbers, `Object` objects, regexes, and strings. Functions and DOM nodes @@ -7603,10 +7660,11 @@ * _.isEqual(object, other); * // => true * - * var words = ['hello', 'goodbye']; - * var otherWords = ['hi', 'goodbye']; + * // using a customizer callback + * var array = ['hello', 'goodbye']; + * var other = ['hi', 'goodbye']; * - * _.isEqual(words, otherWords, function(value, other) { + * _.isEqual(array, other, function(value, other) { * return _.every([value, other], RegExp.prototype.test, /^h(?:i|ello)$/) || undefined; * }); * // => true @@ -7638,14 +7696,14 @@ * // => false */ function isError(value) { - return (isObjectLike(value) && typeof value.message == 'string' && toString.call(value) == errorClass) || false; + return (isObjectLike(value) && typeof value.message == 'string' && objToString.call(value) == errorTag) || false; } /** * Checks if `value` is a finite primitive number. * * **Note:** This method is based on ES6 `Number.isFinite`. See the - * [ES6 spec](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isfinite) + * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isfinite) * for more details. * * @static @@ -7699,10 +7757,9 @@ if (isFunction(/x/) || (Uint8Array && !isFunction(Uint8Array))) { isFunction = function(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in older versions of Chrome and Safari which return 'function' for - // regexes and Safari 8 equivalents which return 'object' for typed - // array constructors. - return toString.call(value) == funcClass; + // in older versions of Chrome and Safari which return 'function' for regexes + // and Safari 8 equivalents which return 'object' for typed array constructors. + return objToString.call(value) == funcTag; }; } @@ -7740,7 +7797,7 @@ * `object` contains equivalent property values. If `customizer` is provided * it is invoked to compare values. If `customizer` returns `undefined` * comparisons are handled by the method instead. The `customizer` is bound - * to `thisArg` and invoked with three arguments; (value, other, key). + * to `thisArg` and invoked with three arguments; (value, other, index|key). * * **Note:** This method supports comparing properties of arrays, booleans, * `Date` objects, numbers, `Object` objects, regexes, and strings. Functions @@ -7765,6 +7822,7 @@ * _.isMatch(object, { 'age': 36 }); * // => false * + * // using a customizer callback * var object = { 'greeting': 'hello' }; * var source = { 'greeting': 'hi' }; * @@ -7823,8 +7881,8 @@ * // => false */ function isNaN(value) { - // `NaN` as a primitive is the only value that is not equal to itself - // (perform the `[[Class]]` check first to avoid errors with some host objects in IE). + // An `NaN` primitive is the only value that is not equal to itself. + // Perform the `toStringTag` check first to avoid errors with some host objects in IE. return isNumber(value) && value != +value; } @@ -7848,7 +7906,7 @@ if (value == null) { return false; } - if (toString.call(value) == funcClass) { + if (objToString.call(value) == funcTag) { return reNative.test(fnToString.call(value)); } return (isObjectLike(value) && reHostCtor.test(value)) || false; @@ -7897,7 +7955,7 @@ * // => false */ function isNumber(value) { - return typeof value == 'number' || (isObjectLike(value) && toString.call(value) == numberClass) || false; + return typeof value == 'number' || (isObjectLike(value) && objToString.call(value) == numberTag) || false; } /** @@ -7932,7 +7990,7 @@ * // => true */ var isPlainObject = !getPrototypeOf ? shimIsPlainObject : function(value) { - if (!(value && toString.call(value) == objectClass)) { + if (!(value && objToString.call(value) == objectTag)) { return false; } var valueOf = value.valueOf, @@ -7960,7 +8018,7 @@ * // => false */ function isRegExp(value) { - return (isObjectLike(value) && toString.call(value) == regexpClass) || false; + return (isObjectLike(value) && objToString.call(value) == regexpTag) || false; } /** @@ -7980,7 +8038,7 @@ * // => false */ function isString(value) { - return typeof value == 'string' || (isObjectLike(value) && toString.call(value) == stringClass) || false; + return typeof value == 'string' || (isObjectLike(value) && objToString.call(value) == stringTag) || false; } /** @@ -8020,12 +8078,13 @@ * @param {...Object} [sources] The source objects. * @param {Function} [customizer] The function to customize assigning values. * @param {*} [thisArg] The `this` binding of `customizer`. - * @returns {Object} Returns the destination object. + * @returns {Object} Returns `object`. * @example * * _.assign({ 'user': 'barney' }, { 'age': 40 }, { 'user': 'fred', 'status': 'busy' }); * // => { 'user': 'fred', 'age': 40, 'status': 'busy' } * + * // using a customizer callback * var defaults = _.partialRight(_.assign, function(value, other) { * return typeof value == 'undefined' ? other : value; * }); @@ -8085,7 +8144,7 @@ * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. - * @returns {Object} Returns the destination object. + * @returns {Object} Returns `object`. * @example * * _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred', 'status': 'busy' }); @@ -8104,12 +8163,12 @@ * This method is like `_.findIndex` except that it returns the key of the * first element `predicate` returns truthy for, instead of the element itself. * - * If a property name is provided for `predicate` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `predicate` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -8117,7 +8176,7 @@ * @param {Object} object The object to search. * @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. + * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {string|undefined} Returns the key of the matched element, else `undefined`. * @example @@ -8131,11 +8190,11 @@ * _.findKey(users, function(chr) { return chr.age < 40; }); * // => 'barney' (iteration order is not guaranteed) * - * // using "_.where" callback shorthand + * // using the "_.matches" callback shorthand * _.findKey(users, { 'age': 1 }); * // => 'pebbles' * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.findKey(users, 'active'); * // => 'barney' */ @@ -8148,12 +8207,12 @@ * This method is like `_.findKey` except that it iterates over elements of * a collection in the opposite order. * - * If a property name is provided for `predicate` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `predicate` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `predicate` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `predicate` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -8161,7 +8220,7 @@ * @param {Object} object The object to search. * @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. + * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `predicate`. * @returns {string|undefined} Returns the key of the matched element, else `undefined`. * @example @@ -8175,11 +8234,11 @@ * _.findLastKey(users, function(chr) { return chr.age < 40; }); * // => returns `pebbles` assuming `_.findKey` returns `barney` * - * // using "_.where" callback shorthand + * // using the "_.matches" callback shorthand * _.findLastKey(users, { 'age': 40 }); * // => 'fred' * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.findLastKey(users, 'active'); * // => 'pebbles' */ @@ -8395,6 +8454,10 @@ /** * Creates an array of the own enumerable property names of `object`. * + * **Note:** Non-object values are coerced to objects. See the + * [ES6 spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.keys) + * for more details. + * * @static * @memberOf _ * @category Object @@ -8411,6 +8474,9 @@ * * _.keys(new Shape); * // => ['x', 'y'] (iteration order is not guaranteed) + * + * _.keys('hi'); + * // => ['0', '1'] */ var keys = !nativeKeys ? shimKeys : function(object) { if (object) { @@ -8427,6 +8493,8 @@ /** * Creates an array of the own and inherited enumerable property names of `object`. * + * **Note:** Non-object values are coerced to objects. + * * @static * @memberOf _ * @category Object @@ -8479,12 +8547,12 @@ * iteratee function is bound to `thisArg` and invoked with three arguments; * (value, key, object). * - * If a property name is provided for `iteratee` the created "_.pluck" style - * callback returns the property value of the given element. + * If a property name is provided for `iteratee` the created "_.property" + * style callback returns the property value of the given element. * - * If an object is provided for `iteratee` the created "_.where" style callback - * returns `true` for elements that have the properties of the given object, - * else `false`. + * If an object is provided for `iteratee` the created "_.matches" style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ @@ -8492,7 +8560,7 @@ * @param {Object} object The object to iterate over. * @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. + * create a "_.property" or "_.matches" style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Object} Returns the new mapped object. * @example @@ -8505,9 +8573,9 @@ * 'pebbles': { 'user': 'pebbles', 'age': 1 } * }; * - * // using "_.pluck" callback shorthand + * // using the "_.property" callback shorthand * _.mapValues(users, 'age'); - * // => { 'fred': 40, 'pebbles': 1 } + * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) */ function mapValues(object, iteratee, thisArg) { iteratee = getCallback(iteratee, thisArg, 3); @@ -8535,7 +8603,7 @@ * @param {...Object} [sources] The source objects. * @param {Function} [customizer] The function to customize merging properties. * @param {*} [thisArg] The `this` binding of `customizer`. - * @returns {Object} Returns the destination object. + * @returns {Object} Returns `object`. * @example * * var users = { @@ -8549,17 +8617,18 @@ * _.merge(users, ages); * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] } * - * var food = { + * // using a customizer callback + * var object = { * 'fruits': ['apple'], * 'vegetables': ['beet'] * }; * - * var otherFood = { + * var other = { * 'fruits': ['banana'], * 'vegetables': ['carrot'] * }; * - * _.merge(food, otherFood, function(a, b) { + * _.merge(object, other, function(a, b) { * return _.isArray(a) ? a.concat(b) : undefined; * }); * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] } @@ -8602,7 +8671,7 @@ var props = arrayMap(baseFlatten(arguments, false, false, 1), String); return pickByArray(object, baseDifference(keysIn(object), props)); } - predicate = getCallback(predicate, thisArg, 3); + predicate = bindCallback(predicate, thisArg, 3); return pickByCallback(object, function(value, key, object) { return !predicate(value, key, object); }); @@ -8666,7 +8735,7 @@ return {}; } return typeof predicate == 'function' - ? pickByCallback(object, getCallback(predicate, thisArg, 3)) + ? pickByCallback(object, bindCallback(predicate, thisArg, 3)) : pickByArray(object, baseFlatten(arguments, false, false, 1)); } @@ -8764,6 +8833,8 @@ /** * Creates an array of the own enumerable property values of `object`. * + * **Note:** Non-object values are coerced to objects. + * * @static * @memberOf _ * @category Object @@ -8780,6 +8851,9 @@ * * _.values(new Shape(2, 1)); * // => [2, 1] (iteration order is not guaranteed) + * + * _.values('hi'); + * // => ['h', 'i'] */ function values(object) { return baseValues(object, keys(object)); @@ -8789,6 +8863,8 @@ * Creates an array of the own and inherited enumerable property values * of `object`. * + * **Note:** Non-object values are coerced to objects. + * * @static * @memberOf _ * @category Object @@ -8869,7 +8945,7 @@ } if (floating || min % 1 || max % 1) { var rand = nativeRandom(); - return nativeMin(min + (rand * (max - min + parseFloat('1e-' + (String(rand).length - 1)))), max); + return nativeMin(min + (rand * (max - min + parseFloat('1e-' + ((rand + '').length - 1)))), max); } return baseRandom(min, max); } @@ -8887,14 +8963,14 @@ * @returns {string} Returns the camel cased string. * @example * - * _.camelCase('Hello world'); - * // => 'helloWorld' + * _.camelCase('Foo Bar'); + * // => 'fooBar' * - * _.camelCase('--hello-world'); - * // => 'helloWorld' + * _.camelCase('--foo-bar'); + * // => 'fooBar' * - * _.camelCase('__hello_world__'); - * // => 'helloWorld' + * _.camelCase('__foo_bar__'); + * // => 'fooBar' */ var camelCase = createCompounder(function(result, word, index) { word = word.toLowerCase(); @@ -8915,8 +8991,8 @@ * // => 'Fred' */ function capitalize(string) { - string = string == null ? '' : String(string); - return string ? (string.charAt(0).toUpperCase() + string.slice(1)) : string; + string = toString(string); + return string && (string.charAt(0).toUpperCase() + string.slice(1)); } /** @@ -8935,8 +9011,8 @@ * // => 'deja vu' */ function deburr(string) { - string = string == null ? '' : String(string); - return string ? string.replace(reLatin1, deburrLetter) : string; + string = toString(string); + return string && string.replace(reLatin1, deburrLetter); } /** @@ -8961,8 +9037,8 @@ * // => true */ function endsWith(string, target, position) { - string = string == null ? '' : String(string); - target = String(target); + string = toString(string); + target = (target + ''); var length = string.length; position = (typeof position == 'undefined' ? length : nativeMin(position < 0 ? 0 : (+position || 0), length)) - target.length; @@ -9003,7 +9079,7 @@ */ function escape(string) { // Reset `lastIndex` because in IE < 9 `String#replace` does not. - string = string == null ? '' : String(string); + string = toString(string); return (string && reHasUnescapedHtml.test(string)) ? string.replace(reUnescapedHtml, escapeHtmlChar) : string; @@ -9024,7 +9100,7 @@ * // => '\[lodash\]\(https://lodash\.com/\)' */ function escapeRegExp(string) { - string = string == null ? '' : String(string); + string = toString(string); return (string && reHasRegExpChars.test(string)) ? string.replace(reRegExpChars, '\\$&') : string; @@ -9042,14 +9118,14 @@ * @returns {string} Returns the kebab cased string. * @example * - * _.kebabCase('Hello world'); - * // => 'hello-world' + * _.kebabCase('Foo Bar'); + * // => 'foo-bar' * - * _.kebabCase('helloWorld'); - * // => 'hello-world' + * _.kebabCase('fooBar'); + * // => 'foo-bar' * - * _.kebabCase('__hello_world__'); - * // => 'hello-world' + * _.kebabCase('__foo_bar__'); + * // => 'foo-bar' */ var kebabCase = createCompounder(function(result, word, index) { return result + (index ? '-' : '') + word.toLowerCase(); @@ -9079,7 +9155,7 @@ * // => 'abc' */ function pad(string, length, chars) { - string = string == null ? '' : String(string); + string = toString(string); length = +length; var strLength = string.length; @@ -9118,8 +9194,8 @@ * // => 'abc' */ function padLeft(string, length, chars) { - string = string == null ? '' : String(string); - return string ? (createPad(string, length, chars) + string) : string; + string = toString(string); + return string && (createPad(string, length, chars) + string); } /** @@ -9146,8 +9222,8 @@ * // => 'abc' */ function padRight(string, length, chars) { - string = string == null ? '' : String(string); - return string ? (string + createPad(string, length, chars)) : string; + string = toString(string); + return string && (string + createPad(string, length, chars)); } /** @@ -9169,6 +9245,9 @@ * * _.parseInt('08'); * // => 8 + * + * _.map(['6', '08', '10'], _.parseInt); + * // => [6, 8, 10] */ function parseInt(string, radix, guard) { if (guard && isIterateeCall(string, radix, guard)) { @@ -9182,7 +9261,11 @@ // Firefox < 21 and Opera < 15 follow ES3 for `parseInt` and // Chrome fails to trim leading whitespace characters. // See https://code.google.com/p/v8/issues/detail?id=3109. - radix = (guard && isIterateeCall(string, radix, guard)) ? 0 : +radix; + if (guard ? isIterateeCall(string, radix, guard) : radix == null) { + radix = 0; + } else if (radix) { + radix = +radix; + } string = trim(string); return nativeParseInt(string, radix || (reHexPrefix.test(string) ? 16 : 10)); }; @@ -9215,7 +9298,7 @@ if (n < 1 || string == null || !nativeIsFinite(n)) { return result; } - string = String(string); + string = (string + ''); // Leverage the exponentiation by squaring algorithm for a faster repeat. // See http://en.wikipedia.org/wiki/Exponentiation_by_squaring. @@ -9241,14 +9324,14 @@ * @returns {string} Returns the snake cased string. * @example * - * _.snakeCase('Hello world'); - * // => 'hello_world' + * _.snakeCase('Foo Bar'); + * // => 'foo_bar' * - * _.snakeCase('--hello-world'); - * // => 'hello_world' + * _.snakeCase('--foo-bar'); + * // => 'foo_bar' * - * _.snakeCase('helloWorld'); - * // => 'hello_world' + * _.snakeCase('fooBar'); + * // => 'foo_bar' */ var snakeCase = createCompounder(function(result, word, index) { return result + (index ? '_' : '') + word.toLowerCase(); @@ -9276,8 +9359,8 @@ * // => true */ function startsWith(string, target, position) { - string = string == null ? '' : String(string); - position = typeof position == 'undefined' ? 0 : nativeMin(position < 0 ? 0 : (+position || 0), string.length); + string = toString(string); + position = position == null ? 0 : nativeMin(position < 0 ? 0 : (+position || 0), string.length); return string.lastIndexOf(target, position) == position; } @@ -9385,7 +9468,7 @@ if (otherOptions && isIterateeCall(string, options, otherOptions)) { options = otherOptions = null; } - string = String(string == null ? '' : string); + string = toString(string); options = baseAssign(baseAssign({}, otherOptions || options), settings, assignOwnDefaults); var imports = baseAssign(baseAssign({}, options.imports), settings.imports, assignOwnDefaults), @@ -9411,7 +9494,7 @@ var sourceURL = '//# sourceURL=' + ('sourceURL' in options ? options.sourceURL - : ('/lodash/template/source[' + (++templateCounter) + ']') + : ('lodash.templateSources[' + (++templateCounter) + ']') ) + '\n'; string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) { @@ -9496,22 +9579,25 @@ * @returns {string} Returns the trimmed string. * @example * - * _.trim(' fred '); - * // => 'fred' + * _.trim(' abc '); + * // => 'abc' * - * _.trim('-_-fred-_-', '_-'); - * // => 'fred' + * _.trim('-_-abc-_-', '_-'); + * // => 'abc' + * + * _.map([' foo ', ' bar '], _.trim); + * // => ['foo', 'bar] */ function trim(string, chars, guard) { var value = string; - string = string == null ? '' : String(string); + string = toString(string); if (!string) { return string; } if (guard ? isIterateeCall(value, chars, guard) : chars == null) { return string.slice(trimmedLeftIndex(string), trimmedRightIndex(string) + 1); } - chars = String(chars); + chars = (chars + ''); return string.slice(charsLeftIndex(string, chars), charsRightIndex(string, chars) + 1); } @@ -9527,23 +9613,22 @@ * @returns {string} Returns the trimmed string. * @example * - * _.trimLeft(' fred '); - * // => 'fred ' + * _.trimLeft(' abc '); + * // => 'abc ' * - * _.trimLeft('-_-fred-_-', '_-'); - * // => 'fred-_-' + * _.trimLeft('-_-abc-_-', '_-'); + * // => 'abc-_-' */ function trimLeft(string, chars, guard) { var value = string; - string = string == null ? '' : String(string); + string = toString(string); if (!string) { return string; } if (guard ? isIterateeCall(value, chars, guard) : chars == null) { return string.slice(trimmedLeftIndex(string)) } - chars = String(chars); - return string.slice(charsLeftIndex(string, chars)); + return string.slice(charsLeftIndex(string, (chars + ''))); } /** @@ -9558,23 +9643,22 @@ * @returns {string} Returns the trimmed string. * @example * - * _.trimRight(' fred '); - * // => ' fred' + * _.trimRight(' abc '); + * // => ' abc' * - * _.trimRight('-_-fred-_-', '_-'); - * // => '-_-fred' + * _.trimRight('-_-abc-_-', '_-'); + * // => '-_-abc' */ function trimRight(string, chars, guard) { var value = string; - string = string == null ? '' : String(string); + string = toString(string); if (!string) { return string; } if (guard ? isIterateeCall(value, chars, guard) : chars == null) { return string.slice(0, trimmedRightIndex(string) + 1) } - chars = String(chars); - return string.slice(0, charsRightIndex(string, chars) + 1); + return string.slice(0, charsRightIndex(string, (chars + '')) + 1); } /** @@ -9616,15 +9700,16 @@ var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION; - if (isObject(options)) { - var separator = 'separator' in options ? options.separator : separator; - length = 'length' in options ? +options.length || 0 : length; - omission = 'omission' in options ? String(options.omission) : omission; + if (options != null) { + if (isObject(options)) { + var separator = 'separator' in options ? options.separator : separator; + length = 'length' in options ? +options.length || 0 : length; + omission = 'omission' in options ? (options.omission + '') : omission; + } else { + length = +options || 0; + } } - else if (options != null) { - length = +options || 0; - } - string = string == null ? '' : String(string); + string = toString(string); if (length >= string.length) { return string; } @@ -9679,7 +9764,7 @@ * // => 'fred, barney, & pebbles' */ function unescape(string) { - string = string == null ? '' : String(string); + string = toString(string); return (string && reHasEscapedHtml.test(string)) ? string.replace(reEscapedHtml, unescapeHtmlChar) : string; @@ -9707,8 +9792,8 @@ if (guard && isIterateeCall(string, pattern, guard)) { pattern = null; } - string = string != null && String(string); - return (string && string.match(pattern || reWords)) || []; + string = toString(string); + return string.match(pattern || reWords) || []; } /*------------------------------------------------------------------------*/ @@ -9823,7 +9908,7 @@ } /** - * Creates a "_.where" style predicate function which performs a deep comparison + * Creates a "_.matches" style predicate function which performs a deep comparison * between a given object and `source`, returning `true` if the given object * has equivalent property values, else `false`. * @@ -9885,48 +9970,51 @@ * // => ['e'] */ function mixin(object, source, options) { - var chain = true, - isObj = isObject(source), - noOpts = options == null, - props = noOpts && isObj && keys(source), - methodNames = props && baseFunctions(source, props); + if (options == null) { + var isObj = isObject(source), + props = isObj && keys(source), + methodNames = props && props.length && baseFunctions(source, props); - if ((props && props.length && !methodNames.length) || (noOpts && !isObj)) { - if (noOpts) { + if (!(methodNames ? methodNames.length : isObj)) { + methodNames = false; options = source; + source = object; + object = this; } - methodNames = false; - source = object; - object = this; } - methodNames || (methodNames = baseFunctions(source, keys(source))); + if (!methodNames) { + methodNames = baseFunctions(source, keys(source)); + } + var chain = true, + index = -1, + isFunc = isFunction(object), + length = methodNames.length; + if (options === false) { chain = false; } else if (isObject(options) && 'chain' in options) { chain = options.chain; } - var index = -1, - isFunc = isFunction(object), - length = methodNames.length; - while (++index < length) { - var methodName = methodNames[index]; - object[methodName] = source[methodName]; + var methodName = methodNames[index], + func = source[methodName]; + + object[methodName] = func; if (isFunc) { - object.prototype[methodName] = (function(methodName) { + object.prototype[methodName] = (function(func) { return function() { var chainAll = this.__chain__; if (chain || chainAll) { var result = object(this.__wrapped__); - (result.__actions__ = baseSlice(this.__actions__)).push({ 'args': arguments, 'object': object, 'name': methodName }); + (result.__actions__ = baseSlice(this.__actions__)).push({ 'func': func, 'args': arguments, 'thisArg': object }); result.__chain__ = chainAll; return result; } var args = [this.value()]; push.apply(args, arguments); - return object[methodName].apply(object, args); + return func.apply(object, args); }; - }(methodName)); + }(func)); } } return object; @@ -9966,13 +10054,13 @@ } /** - * Creates a "_.pluck" style function which returns the property value + * Creates a "_.property" style function which returns the property value * of `key` on a given object. * * @static * @memberOf _ * @category Utility - * @param {string} key The name of the property to retrieve. + * @param {string} key The name of the property to get. * @returns {Function} Returns the new function. * @example * @@ -9990,7 +10078,7 @@ * // => ['barney', 'fred'] */ function property(key) { - return baseProperty(String(key)); + return baseProperty(key + ''); } /** @@ -10139,7 +10227,7 @@ */ function uniqueId(prefix) { var id = ++idCounter; - return String(prefix == null ? '' : prefix) + id; + return toString(prefix) + id; } /*------------------------------------------------------------------------*/ @@ -10379,10 +10467,10 @@ lodash.prototype.sample = function(n) { if (!this.__chain__ && n == null) { - return lodash.sample(this.value()); + return sample(this.value()); } return this.thru(function(value) { - return lodash.sample(value, n); + return sample(value, n); }); }; @@ -10536,7 +10624,7 @@ if (!retUnwrapped && (isHybrid || result.actions)) { var actions = result.actions || (result.actions = []); - actions.push({ 'args': [interceptor], 'object': lodash, 'name': 'thru' }); + actions.push({ 'func': thru, 'args': [interceptor], 'thisArg': lodash }); } return new LodashWrapper(result, chainAll); } diff --git a/dist/lodash.min.js b/dist/lodash.min.js index 5b6b0126e..e2f1bd09f 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -4,81 +4,82 @@ * 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(nt||!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 A(n,t){for(var r=-1,e=n.length,u=-1,o=[];++re&&(e=u)}return e}function Jt(n){for(var t=-1,r=n.length,e=uo;++to(t,a)&&e.push(a);return e}function ir(n,t){var r=n?n.length:0;if(!re(r))return vr(n,t);for(var e=-1,u=le(n);++ee(a,s)&&((t||i)&&a.push(s),l.push(c))}return l}function Cr(n,t){for(var r=-1,e=t.length,u=gu(e);++rao)){u=r,u=null==u?lu:u,t=u(t),o=0,r=n.length;for(var i=t!==t,a=typeof t=="undefined";o>>1,i=n[r],(e?i<=t:it||null==r)return r;if(3=o&&r<=i&&(e=L&&t>u||e>u&&t>=L)||o)&&(t&C&&(n[2]=h[2],r|=e&C?0:T),(e=h[3])&&(u=n[3],n[3]=u?Ur(u,e,h[4]):l(e),n[4]=u?A(n[3],Y):l(h[4])),(e=h[5])&&(u=n[5],n[5]=u?Lr(u,e,h[6]):l(e),n[6]=u?A(n[5],Y):l(h[6])),(e=h[7])&&(n[7]=l(e)),t&$&&(n[8]=null==n[8]?h[8]:Hu(n[8],h[8])),null==n[9]&&(n[9]=h[9]),n[0]=h[0],n[1]=r)}return n[9]=null==n[9]?f?0:n[0].length:Xu(n[9]-c,0)||0,t=n[1],(h?ho:yo)(t==C?zr(n[0],n[2]):t!=F&&t!=(C|F)||n[4].length?qr.apply(null,n):Kr.apply(null,n),n)}function Yr(n,t,r,e,u,o,i){var a=-1,f=n.length,l=t.length,c=true; -if(f!=l&&(!u||l<=f))return false;for(;c&&++at?0:t)}function se(n,t,r){return(r?te(n,t,r):null==t)&&(t=1),t=n?n.length-(+t||0):0,de(n,0,0>t?0:t)}function pe(n,t,r){var e=-1,u=n?n.length:0;for(t=Jr(t,r,3);++er?Xu(e+r,0):r||0;else if(r)return r=Tr(n,t),n=n[r],(t===t?t===n:n!==n)?r:-1;return f(n,t,r)}function ve(n){return ce(n,1) -}function de(n,t,r){var e=-1,u=n?n.length:0,o=typeof r;if(r&&"number"!=o&&te(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 l(n);for(u=t>r?0:r-t,r=gu(u);++e>>0,u=gu(r);++tr?Xu(e+r,0):r||0:0,typeof n=="string"||!Ao(n)&&Je(n)?rarguments.length,ir)}function Oe(n,t,r,e){return(Ao(n)?o:kr)(n,Jr(t,e,4),r,3>arguments.length,ar)}function Ce(n){n=fe(n);for(var t=-1,r=n.length,e=gu(r);++t=r||r>t?(a&&Lu(a),r=p,a=s=p=I,r&&(h=xo(),f=n.apply(c,i),s||a||(i=c=null))):s=qu(e,r)}function u(){s&&Lu(s),a=s=p=I,(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||!d),false===g)var r=d&&!s;else{a||d||(h=l);var o=g-(l-h),y=0>=o||o>g;y?(a&&(a=Lu(a)),h=l,f=n.apply(c,i)):a||(a=qu(u,o))}return y&&s?s=Lu(s):s||t===g||(s=qu(e,t)),r&&(y=true,f=n.apply(c,i)),!y||s||a||(i=c=null),f}var i,a,f,l,c,s,p,h=0,g=false,v=true;if(!Ke(n))throw new Au(V);if(t=0>t?0:t,true===r)var d=true,v=false; -else Ve(r)&&(d=r.leading,g="maxWait"in r&&Xu(+r.maxWait||0,t),v="trailing"in r?r.trailing:v);return o.cancel=function(){s&&Lu(s),a&&Lu(a),a=s=p=I},o}function $e(){var n=arguments,r=n.length-1;if(0>r)return function(){};if(!t(n,Ke))throw new Au(V);return function(){for(var t=r,e=n[t].apply(this,arguments);t--;)e=n[t].call(this,e);return e}}function Be(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(!Ke(n)||t&&!Ke(t))throw new Au(V);return r.cache=new Be.Cache,r}function ze(n){var t=de(arguments,1),r=A(t,ze.placeholder);return Vr(n,F,null,t,r)}function De(n){var t=de(arguments,1),r=A(t,De.placeholder);return Vr(n,U,null,t,r)}function Me(n){return re(w(n)?n.length:I)&&Tu.call(n)==mt||false}function qe(n){return n&&1===n.nodeType&&w(n)&&-1t||null==n||!Gu(t))return r;n=xu(n);do t%2&&(r+=n),t=$u(t/2),n+=n;while(t);return r}function uu(n,t,r){var e=n;return(n=null==n?"":xu(n))?(r?te(e,t,r):null==t)?n.slice(j(n),E(n)+1):(t=xu(t),n.slice(p(n,t),h(n,t)+1)):n -}function ou(n,t,r){return r&&te(n,t,r)&&(t=null),(n=null!=n&&xu(n))&&n.match(t||vt)||[]}function iu(n){try{return n()}catch(t){return Pe(t)?t:du(t)}}function au(n,t,r){return r&&te(n,t,r)&&(t=null),rr(n,t)}function fu(n){return function(){return n}}function lu(n){return n}function cu(n){return Ar(n,true)}function su(n,t,r){var e=true,u=Ve(t),o=null==r,i=o&&u&&ko(t),a=i&&yr(t,i);(i&&i.length&&!a.length||o&&!u)&&(o&&(r=t),a=false,t=n,n=this),a||(a=yr(t,ko(t))),false===r?e=false:Ve(r)&&"chain"in r&&(e=r.chain),r=-1,u=Ke(n); -for(o=a.length;++r>>1,fo=Yu?Yu.BYTES_PER_ELEMENT:0,lo=mu.pow(2,53)-1,co=Vu&&new Vu,so=Dt.support={};!function(n){so.funcDecomp=!Ye(x.WinRTError)&&ht.test(k),so.funcNames=typeof yu.name=="string";try{so.dom=11===Ru.createDocumentFragment().nodeType}catch(t){so.dom=false -}try{so.nonEnumArgs=!Du.call(arguments,1)}catch(r){so.nonEnumArgs=true}}(0,0),Dt.templateSettings={escape:tt,evaluate:rt,interpolate:et,variable:"",imports:{_:Dt}};var po=function(){function n(){}return function(t){if(Ve(t)){n.prototype=t;var r=new n;n.prototype=null}return r||x.Object()}}(),ho=co?function(n,t){return co.set(n,t),n}:lu;Fu||(Nr=Nu&&Ku?function(n){var t=n.byteLength,r=Yu?$u(t/fo):0,e=r*fo,u=new Nu(t);if(r){var o=new Yu(u,0,r);o.set(new Yu(n,0,r))}return t!=e&&(o=new Ku(u,e),o.set(new Ku(n,e))),u -}:fu(null));var go=Mu?function(n){return new Kt(n)}:fu(null),vo=co?function(n){return co.get(n)}:pu,yo=function(){var n=0,t=0;return function(r,e){var u=xo(),o=M-(u-t);if(t=u,0=D)return r}else n=0;return ho(r,e)}}(),mo=$r(function(n,t,r){Ou.call(n,r)?++n[r]:n[r]=1}),_o=$r(function(n,t,r){Ou.call(n,r)?n[r].push(t):n[r]=[t]}),bo=$r(function(n,t,r){n[r]=t}),wo=$r(function(n,t,r){n[r?0:1].push(t)},function(){return[[],[]]}),xo=Qu||function(){return(new vu).getTime()},Ao=Zu||function(n){return w(n)&&re(n.length)&&Tu.call(n)==_t||false -};so.dom||(qe=function(n){return n&&1===n.nodeType&&w(n)&&!Eo(n)||false});var jo=no||function(n){return typeof n=="number"&&Gu(n)};(Ke(/x/)||Ku&&!Ke(Ku))&&(Ke=function(n){return Tu.call(n)==At});var Eo=Bu?function(n){if(!n||Tu.call(n)!=Et)return false;var t=n.valueOf,r=Ye(t)&&(r=Bu(t))&&Bu(r);return r?n==r||Bu(n)==r:ie(n)}:ie,Ro=Br(nr),ko=Ju?function(n){if(n)var t=n.constructor,r=n.length;return typeof t=="function"&&t.prototype===n||typeof n!="function"&&r&&re(r)?ae(n):Ve(n)?Ju(n):[]}:ae,Io=Br(jr),Oo=Dr(function(n,t,r){return t=t.toLowerCase(),r?n+t.charAt(0).toUpperCase()+t.slice(1):t -}),Co=Dr(function(n,t,r){return n+(r?"-":"")+t.toLowerCase()});8!=to(dt+"08")&&(ru=function(n,t,r){return t=r&&te(n,t,r)?0:+t,n=uu(n),to(n,t||(at.test(n)?16:10))});var So=Dr(function(n,t,r){return n+(r?"_":"")+t.toLowerCase()});return Mt.prototype=Dt.prototype,Pt.prototype["delete"]=function(n){return this.has(n)&&delete this.__data__[n]},Pt.prototype.get=function(n){return"__proto__"==n?I:this.__data__[n]},Pt.prototype.has=function(n){return"__proto__"!=n&&Ou.call(this.__data__,n)},Pt.prototype.set=function(n,t){return"__proto__"!=n&&(this.__data__[n]=t),this -},Kt.prototype.push=function(n){var t=this.data,r=typeof n;"number"==r?t[r][n]=true:t.set.add(n)},Be.Cache=Pt,Dt.after=function(n,t){if(!Ke(t)){if(!Ke(n))throw new Au(V);var r=n;n=t,t=r}return n=Gu(n=+n)?n:0,function(){return 1>--n?t.apply(this,arguments):void 0}},Dt.ary=function(n,t,r){return r&&te(n,t,r)&&(t=null),t=null==t?n.length:+t||0,Vr(n,$,null,null,null,null,t)},Dt.assign=Ro,Dt.at=function(n){return re(n?n.length:0)&&(n=fe(n)),tr(n,sr(arguments,false,false,1))},Dt.before=Te,Dt.bind=We,Dt.bindAll=function(n){for(var t=n,r=1(s?Yt(s,i):u(c,i))){for(t=r;--t;){var p=e[t];if(0>(p?Yt(p,i):u(n[t],i)))continue n}s&&s.push(i),c.push(i)}return c},Dt.invert=function(n,t,r){r&&te(n,t,r)&&(t=null),r=-1;for(var e=ko(n),u=e.length,o={};++rt?0:t)},Dt.takeRight=function(n,t,r){return(r?te(n,t,r):null==t)&&(t=1),t=n?n.length-(+t||0):0,de(n,0>t?0:t) -},Dt.takeRightWhile=function(n,t,r){var e=n?n.length:0;for(t=Jr(t,r,3);e--&&t(n[e],e,n););return de(n,e+1)},Dt.takeWhile=function(n,t,r){var e=-1,u=n?n.length:0;for(t=Jr(t,r,3);++en||!Gu(n))return[];var e=-1,u=gu(Hu(n,oo));for(t=Wr(t,r,1);++er?0:+r||0,e))-t.length,0<=r&&n.indexOf(t,r)==r},Dt.escape=function(n){return(n=null==n?"":xu(n))&&nt.test(n)?n.replace(H,y):n},Dt.escapeRegExp=tu,Dt.every=xe,Dt.find=je,Dt.findIndex=pe,Dt.findKey=function(n,t,r){return t=Jr(t,r,3),cr(n,t,vr,true) -},Dt.findLast=function(n,t,r){return t=Jr(t,r,3),cr(n,t,ar)},Dt.findLastIndex=function(n,t,r){var e=n?n.length:0;for(t=Jr(t,r,3);e--;)if(t(n[e],e,n))return e;return-1},Dt.findLastKey=function(n,t,r){return t=Jr(t,r,3),cr(n,t,dr,true)},Dt.findWhere=function(n,t){return je(n,cu(t))},Dt.first=he,Dt.has=function(n,t){return n?Ou.call(n,t):false},Dt.identity=lu,Dt.includes=we,Dt.indexOf=ge,Dt.isArguments=Me,Dt.isArray=Ao,Dt.isBoolean=function(n){return true===n||false===n||w(n)&&Tu.call(n)==bt||false},Dt.isDate=function(n){return w(n)&&Tu.call(n)==wt||false -},Dt.isElement=qe,Dt.isEmpty=function(n){if(null==n)return true;var t=n.length;return re(t)&&(Ao(n)||Je(n)||Me(n)||w(n)&&Ke(n.splice))?!t:!ko(n).length},Dt.isEqual=function(n,t,r,e){return r=typeof r=="function"&&Wr(r,e,3),!r&&ee(n)&&ee(t)?n===t:(e=r?r(n,t):I,typeof e=="undefined"?_r(n,t,r):!!e)},Dt.isError=Pe,Dt.isFinite=jo,Dt.isFunction=Ke,Dt.isMatch=function(n,t,r,e){var u=ko(t),o=u.length;if(r=typeof r=="function"&&Wr(r,e,3),!r&&1==o){var i=u[0];if(e=t[i],ee(e))return null!=n&&e===n[i]&&Ou.call(n,i) -}for(var i=gu(o),a=gu(o);o--;)e=i[o]=t[u[o]],a[o]=ee(e);return wr(n,u,i,a,r)},Dt.isNaN=function(n){return Ze(n)&&n!=+n},Dt.isNative=Ye,Dt.isNull=function(n){return null===n},Dt.isNumber=Ze,Dt.isObject=Ve,Dt.isPlainObject=Eo,Dt.isRegExp=Ge,Dt.isString=Je,Dt.isUndefined=function(n){return typeof n=="undefined"},Dt.kebabCase=Co,Dt.last=function(n){var t=n?n.length:0;return t?n[t-1]:I},Dt.lastIndexOf=function(n,t,r){var e=n?n.length:0;if(!e)return-1;var u=e;if(typeof r=="number")u=(0>r?Xu(e+r,0):Hu(r||0,e-1))+1; -else if(r)return u=Tr(n,t,null,true)-1,n=n[u],(t===t?t===n:n!==n)?u:-1;if(t!==t)return _(n,u,true);for(;u--;)if(n[u]===t)return u;return-1},Dt.max=function(n,t,r){r&&te(n,t,r)&&(t=null);var e=null==t,u=e&&Ao(n),o=!u&&Je(n);if(e&&!o)return Gt(u?n:fe(n));var i=eo,a=i;return t=e&&o?s:Jr(t,r,3),ir(n,function(n,r,e){r=t(n,r,e),(r>i||r===eo&&r===a)&&(i=r,a=n)}),a},Dt.min=function(n,t,r){r&&te(n,t,r)&&(t=null);var e=null==t,u=e&&Ao(n),o=!u&&Je(n);if(e&&!o)return Jt(u?n:fe(n));var i=uo,a=i;return t=e&&o?s:Jr(t,r,3),ir(n,function(n,r,e){r=t(n,r,e),(rr?0:+r||0,n.length),n.lastIndexOf(t,r)==r -},Dt.template=function(n,t,r){var e=Dt.templateSettings;r&&te(n,t,r)&&(t=r=null),n=xu(null==n?"":n),t=nr(nr({},r||t),e,Qt),r=nr(nr({},t.imports),e.imports,Qt);var u,o,i=ko(r),a=Cr(r,i),f=0;r=t.interpolate||ct;var l="__p+='";r=wu((t.escape||ct).source+"|"+r.source+"|"+(r===et?ut:ct).source+"|"+(t.evaluate||ct).source+"|$","g");var c="sourceURL"in t?"//# sourceURL="+t.sourceURL+"\n":"";if(n.replace(r,function(t,r,e,i,a,c){return e||(e=i),l+=n.slice(f,c).replace(gt,m),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(Z,""):l).replace(G,"$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=iu(function(){return yu(i,c+"return "+l).apply(I,a)}),t.source=l,Pe(t))throw t;return t},Dt.trim=uu,Dt.trimLeft=function(n,t,r){var e=n;return(n=null==n?"":xu(n))?(r?te(e,t,r):null==t)?n.slice(j(n)):(t=xu(t),n.slice(p(n,t))):n -},Dt.trimRight=function(n,t,r){var e=n;return(n=null==n?"":xu(n))?(r?te(e,t,r):null==t)?n.slice(0,E(n)+1):(t=xu(t),n.slice(0,h(n,t)+1)):n},Dt.trunc=function(n,t,r){r&&te(n,t,r)&&(t=null);var e=B;if(r=z,Ve(t)){var u="separator"in t?t.separator:u,e="length"in t?+t.length||0:e;r="omission"in t?xu(t.omission):r}else null!=t&&(e=+t||0);if(n=null==n?"":xu(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(Ge(u)){if(n.slice(e).search(u)){var o,i=n.slice(0,e);for(u.global||(u=wu(u.source,(ot.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) -},Dt.prototype.sample=function(n){return this.__chain__||null!=n?this.thru(function(t){return Dt.sample(t,n)}):Dt.sample(this.value())},Dt.VERSION=O,n("bind bindKey curry curryRight partial partialRight".split(" "),function(n){Dt[n].placeholder=Dt}),n(["filter","map","takeWhile"],function(n,t){var r=t==q;qt.prototype[n]=function(n,e){n=Jr(n,e,3);var u=this.clone(),o=u.filtered,i=u.iteratees||(u.iteratees=[]);return u.filtered=o||r||t==K&&0>u.dir,i.push({iteratee:n,type:t}),u}}),n(["drop","take"],function(n,t){var r=n+"Count",e=n+"While"; -qt.prototype[n]=function(e){e=null==e?1:Xu(+e||0,0);var u=this.clone();if(u.filtered){var o=u[r];u[r]=t?Hu(o,e):o+e}else(u.views||(u.views=[])).push({size:e,type:n+(0>u.dir?"Right":"")});return u},qt.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()},qt.prototype[n+"RightWhile"]=function(n,t){return this.reverse()[e](n,t).reverse()}}),n(["first","last"],function(n,t){var r="take"+(t?"Right":"");qt.prototype[n]=function(){return this[r](1).value()[0]}}),n(["initial","rest"],function(n,t){var r="drop"+(t?"":"Right"); -qt.prototype[n]=function(){return this[r](1)}}),n(["pluck","where"],function(n,t){var r=t?"filter":"map",e=t?cu:hu;qt.prototype[n]=function(n){return this[r](e(n))}}),qt.prototype.dropWhile=function(n,t){n=Jr(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))})},qt.prototype.reject=function(n,t){return n=Jr(n,t,3),this.filter(function(t,r,e){return!n(t,r,e)})},qt.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},vr(qt.prototype,function(n,t){var r=/^(?:first|last)$/.test(t);Dt.prototype[t]=function(){function e(n){return n=[n],zu.apply(n,o),Dt[t].apply(Dt,n)}var u=this.__wrapped__,o=arguments,i=this.__chain__,a=!!this.__actions__.length,f=u instanceof qt,l=f&&!a;return r&&!i?l?n.call(u):Dt[t](this.value()):f||Ao(u)?(u=n.apply(l?u:new qt(this),o),r||!a&&!u.actions||(u.actions||(u.actions=[])).push({args:[e],object:Dt,name:"thru"}),new Mt(u,i)):this.thru(e) -}}),n("concat join pop push shift sort splice unshift".split(" "),function(n){var t=ju[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:join|pop|shift)$/.test(n);Dt.prototype[n]=function(){var n=arguments;return e&&!this.__chain__?t.apply(this.value(),n):this[r](function(r){return t.apply(r,n)})}}),qt.prototype.clone=function(){var n=this.actions,t=this.iteratees,r=this.views,e=new qt(this.wrapped);return e.actions=n?l(n):null,e.dir=this.dir,e.dropCount=this.dropCount,e.filtered=this.filtered,e.iteratees=t?l(t):null,e.takeCount=this.takeCount,e.views=r?l(r):null,e -},qt.prototype.reverse=function(){var n=this.filtered,t=n?new qt(this):this.clone();return t.dir=-1*this.dir,t.filtered=n,t},qt.prototype.value=function(){var n=this.wrapped.value();if(!Ao(n))return Sr(n,this.actions);var t,r=this.dir,e=0>r,u=n.length;t=u;for(var o=this.views,i=0,a=-1,f=o?o.length:0;++a"'`]/g,Q=RegExp(X.source),nt=RegExp(H.source),tt=/<%-([\s\S]+?)%>/g,rt=/<%([\s\S]+?)%>/g,et=/<%=([\s\S]+?)%>/g,ut=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ot=/\w*$/,it=/^\s*function[ \n\r\t]+\w/,at=/^0[xX]/,ft=/^\[object .+?Constructor\]$/,lt=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,ct=/($^)/,st=/[.*+?^${}()|[\]\/\\]/g,pt=RegExp(st.source),ht=/\bthis\b/,gt=/['\n\r\u2028\u2029\\]/g,vt=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"),dt=" \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",yt="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(" "),mt="[object Arguments]",_t="[object Array]",bt="[object Boolean]",wt="[object Date]",xt="[object Error]",At="[object Function]",jt="[object Number]",Et="[object Object]",Rt="[object RegExp]",kt="[object String]",It="[object ArrayBuffer]",Ot="[object Float32Array]",Ct="[object Float64Array]",St="[object Int8Array]",Tt="[object Int16Array]",Wt="[object Int32Array]",Nt="[object Uint8Array]",Ft="[object Uint8ClampedArray]",Ut="[object Uint16Array]",Lt="[object Uint32Array]",$t={}; -$t[mt]=$t[_t]=$t[Ot]=$t[Ct]=$t[St]=$t[Tt]=$t[Wt]=$t[Nt]=$t[Ft]=$t[Ut]=$t[Lt]=true,$t[It]=$t[bt]=$t[wt]=$t[xt]=$t[At]=$t["[object Map]"]=$t[jt]=$t[Et]=$t[Rt]=$t["[object Set]"]=$t[kt]=$t["[object WeakMap]"]=false;var Bt={};Bt[mt]=Bt[_t]=Bt[It]=Bt[bt]=Bt[wt]=Bt[Ot]=Bt[Ct]=Bt[St]=Bt[Tt]=Bt[Wt]=Bt[jt]=Bt[Et]=Bt[Rt]=Bt[kt]=Bt[Nt]=Bt[Ft]=Bt[Ut]=Bt[Lt]=true,Bt[xt]=Bt[At]=Bt["[object Map]"]=Bt["[object Set]"]=Bt["[object WeakMap]"]=false;var zt={leading:false,maxWait:0,trailing:false},Dt={"\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"},Mt={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},qt={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Pt={"function":true,object:true},Kt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Vt=Pt[typeof window]&&window!==(this&&this.window)?window:this,Yt=Pt[typeof exports]&&exports&&!exports.nodeType&&exports,Zt=Pt[typeof module]&&module&&!module.nodeType&&module,Gt=Yt&&Zt&&typeof global=="object"&&global; +}function k(x){function Dt(n){if(w(n)&&!Co(n)){if(n instanceof Mt)return n;if(Nu.call(n,"__wrapped__"))return new Mt(n.__wrapped__,n.__chain__,l(n.__actions__))}return new Mt(n)}function Mt(n,t,r){this.__actions__=r||[],this.__chain__=!!t,this.__wrapped__=n}function qt(n){this.actions=null,this.dir=1,this.dropCount=0,this.filtered=false,this.iteratees=null,this.takeCount=lo,this.views=null,this.wrapped=n}function Pt(){this.__data__={}}function Kt(n){var t=n?n.length:0;for(this.data={number:{},set:new Yu};t--;)this.push(n[t]) +}function Yt(n,t){var r=typeof t,e=n.data;return("number"==r?e[r][t]:e.set.has(t))?0:-1}function Zt(n){var t={length:0};return Ku.apply(t,n),t}function Gt(n){for(var t=-1,r=n.length,e=ao;++te&&(e=u)}return e}function Jt(n,t){return typeof n=="undefined"?t:n}function Ht(n,t,r,e){return typeof n!="undefined"&&Nu.call(e,r)?n:t}function Qt(n,t,r){for(var e=-1,u=No(t),o=u.length;++eo(t,f)&&e.push(f);return e}function or(n,t){var r=n?n.length:0;if(!ue(r))return gr(n,t);for(var e=-1,u=se(n);++ee(f,s)&&((t||i)&&f.push(s),l.push(c))}return l}function Or(n,t){for(var r=-1,e=t.length,u=mu(e);++r>>1,i=n[o];(r?i<=t:it||null==r)return r; +if(3=o&&f<=i&&(e=L&&t>u||e>u&&t>=L)||o)&&(t&C&&(r[2]=h[2],f|=e&C?0:T),(e=h[3])&&(u=r[3],r[3]=u?Ur(u,e,h[4]):l(e),r[4]=u?A(r[3],Y):l(h[4])),(e=h[5])&&(u=r[5],r[5]=u?Lr(u,e,h[6]):l(e),r[6]=u?A(r[5],Y):l(h[6])),(e=h[7])&&(r[7]=l(e)),t&$&&(r[8]=null==r[8]?h[8]:eo(r[8],h[8])),null==r[9]&&(r[9]=h[9]),r[0]=h[0],r[1]=f),t=r[1],f=r[9] +}return r[9]=null==f?a?0:n.length:ro(f-c,0)||0,(h?mo:xo)(t==C?zr(r[0],r[2]):t!=F&&t!=(C|F)||r[4].length?Pr.apply(null,r):Vr.apply(null,r),r)}function Zr(n,t,r,e,u,o,i){var f=-1,a=n.length,l=t.length,c=true;if(a!=l&&(!u||l<=a))return false;for(;c&&++fu)||i===e&&i===o)&&(u=i,o=n)}),o}function Hr(n,t,r){var e=Dt.callback||pu,e=e===pu?tr:e;return r?e(n,t,r):e}function Qr(n,t,r){var e=Dt.indexOf||ye,e=e===ye?a:e;return n?e(n,t,r):e}function ne(n,t){var r=-1,e=n.length,u=new n.constructor(e);if(!t)for(;++rt?0:t)}function ge(n,t,r){return(r?ee(n,t,r):null==t)&&(t=1),t=n?n.length-(+t||0):0,me(n,0,0>t?0:t) +}function ve(n,t,r){var e=-1,u=n?n.length:0;for(t=Hr(t,r,3);++er?ro(e+r,0):r||0;else if(r)return r=Sr(n,t),n=n[r],(t===t?t===n:n!==n)?r:-1;return a(n,t,r)}function _e(n){return he(n,1)}function me(n,t,r){var e=-1,u=n?n.length:0,o=typeof r;if(r&&"number"!=o&&ee(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 l(n); +for(u=t>r?0:r-t,r=mu(u);++e>>0,u=mu(r);++tr?ro(e+r,0):r||0:0,typeof n=="string"||!Co(n)&&tu(n)?rarguments.length,or)}function We(n,t,r,e){return(Co(n)?o:Rr)(n,Hr(t,e,4),r,3>arguments.length,ir)}function Ne(n,t,r){return(r?ee(n,t,r):null==t)?(n=ce(n),t=n.length,0t?0:+t||0,n.length),n) +}function Fe(n){n=ce(n);for(var t=-1,r=n.length,e=mu(r);++t=r||r>t?(f&&Mu(f),r=p,f=s=p=I,r&&(h=Oo(),a=n.apply(c,i),s||f||(i=c=null))):s=Zu(e,r)}function u(){s&&Mu(s),f=s=p=I,(v||g!==t)&&(h=Oo(),a=n.apply(c,i),s||f||(i=c=null)) +}function o(){if(i=arguments,l=Oo(),c=this,p=v&&(s||!d),false===g)var r=d&&!s;else{f||d||(h=l);var o=g-(l-h),y=0>=o||o>g;y?(f&&(f=Mu(f)),h=l,a=n.apply(c,i)):f||(f=Zu(u,o))}return y&&s?s=Mu(s):s||t===g||(s=Zu(e,t)),r&&(y=true,a=n.apply(c,i)),!y||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 Iu(V);if(t=0>t?0:t,true===r)var d=true,v=false;else Xe(r)&&(d=r.leading,g="maxWait"in r&&ro(+r.maxWait||0,t),v="trailing"in r?r.trailing:v);return o.cancel=function(){s&&Mu(s),f&&Mu(f),f=s=p=I},o}function qe(){var n=arguments,r=n.length-1; +if(0>r)return function(){};if(!t(n,Je))throw new Iu(V);return function(){for(var t=r,e=n[t].apply(this,arguments);t--;)e=n[t].call(this,e);return e}}function Pe(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(!Je(n)||t&&!Je(t))throw new Iu(V);return r.cache=new Pe.Cache,r}function Ke(n){var t=me(arguments,1),r=A(t,Ke.placeholder);return Yr(n,F,null,t,r)}function Ve(n){var t=me(arguments,1),r=A(t,Ve.placeholder); +return Yr(n,U,null,t,r)}function Ye(n){return ue(w(n)?n.length:I)&&Uu.call(n)==_t||false}function Ze(n){return n&&1===n.nodeType&&w(n)&&-1t||null==n||!no(t))return r;n+="";do t%2&&(r+=n),t=qu(t/2),n+=n;while(t);return r}function lu(n,t,r){var e=n;return(n=pe(n))?(r?ee(e,t,r):null==t)?n.slice(j(n),E(n)+1):(t+="",n.slice(p(n,t),h(n,t)+1)):n}function cu(n,t,r){return r&&ee(n,t,r)&&(t=null),n=pe(n),n.match(t||vt)||[]}function su(n){try{return n()}catch(t){return Ge(t)?t:wu(t)}}function pu(n,t,r){return r&&ee(n,t,r)&&(t=null),tr(n,t) +}function hu(n){return function(){return n}}function gu(n){return n}function vu(n){return xr(n,true)}function du(n,t,r){if(null==r){var e=Xe(t),u=e&&No(t);((u=u&&u.length&&dr(t,u))?u.length:e)||(u=false,r=t,t=n,n=this)}u||(u=dr(t,No(t)));var o=true,e=-1,i=Je(n),f=u.length;false===r?o=false:Xe(r)&&"chain"in r&&(o=r.chain);for(;++e>>1,ho=Hu?Hu.BYTES_PER_ELEMENT:0,go=Au.pow(2,53)-1,vo=Xu&&new Xu,yo=Dt.support={};!function(n){yo.funcDecomp=!He(x.WinRTError)&&ht.test(k),yo.funcNames=typeof xu.name=="string";try{yo.dom=11===Su.createDocumentFragment().nodeType}catch(t){yo.dom=false +}try{yo.nonEnumArgs=!Vu.call(arguments,1)}catch(r){yo.nonEnumArgs=true}}(0,0),Dt.templateSettings={escape:tt,evaluate:rt,interpolate:et,variable:"",imports:{_:Dt}};var _o=function(){function n(){}return function(t){if(Xe(t)){n.prototype=t;var r=new n;n.prototype=null}return r||x.Object()}}(),mo=vo?function(n,t){return vo.set(n,t),n}:gu;zu||(Nr=Bu&&Ju?function(n){var t=n.byteLength,r=Hu?qu(t/ho):0,e=r*ho,u=new Bu(t);if(r){var o=new Hu(u,0,r);o.set(new Hu(n,0,r))}return t!=e&&(o=new Ju(u,e),o.set(new Ju(n,e))),u +}:hu(null));var bo=Yu?function(n){return new Kt(n)}:hu(null),wo=vo?function(n){return vo.get(n)}:yu,xo=function(){var n=0,t=0;return function(r,e){var u=Oo(),o=M-(u-t);if(t=u,0=D)return r}else n=0;return mo(r,e)}}(),Ao=$r(function(n,t,r){Nu.call(n,r)?++n[r]:n[r]=1}),jo=$r(function(n,t,r){Nu.call(n,r)?n[r].push(t):n[r]=[t]}),Eo=$r(function(n,t,r){n[r]=t}),Ro=qr(Gt),ko=qr(function(n){for(var t=-1,r=n.length,e=lo;++t--n?t.apply(this,arguments):void 0}},Dt.ary=function(n,t,r){return r&&ee(n,t,r)&&(t=null),t=null==t?n.length:+t||0,Yr(n,$,null,null,null,null,t) +},Dt.assign=Wo,Dt.at=function(n){return ue(n?n.length:0)&&(n=ce(n)),nr(n,cr(arguments,false,false,1))},Dt.before=Le,Dt.bind=$e,Dt.bindAll=function(n){for(var t=n,r=1(s?Yt(s,i):u(c,i))){for(t=r;--t;){var p=e[t];if(0>(p?Yt(p,i):u(n[t],i)))continue n}s&&s.push(i),c.push(i)}return c},Dt.invert=function(n,t,r){r&&ee(n,t,r)&&(t=null),r=-1;for(var e=No(n),u=e.length,o={};++rt?0:t)},Dt.takeRight=function(n,t,r){return(r?ee(n,t,r):null==t)&&(t=1),t=n?n.length-(+t||0):0,me(n,0>t?0:t)},Dt.takeRightWhile=function(n,t,r){var e=n?n.length:0;for(t=Hr(t,r,3);e--&&t(n[e],e,n););return me(n,e+1)},Dt.takeWhile=function(n,t,r){var e=-1,u=n?n.length:0;for(t=Hr(t,r,3);++en||!no(n))return[];var e=-1,u=mu(eo(n,co));for(t=Wr(t,r,1);++er?0:+r||0,e))-t.length,0<=r&&n.indexOf(t,r)==r},Dt.escape=function(n){return(n=pe(n))&&nt.test(n)?n.replace(H,y):n},Dt.escapeRegExp=iu,Dt.every=Re,Dt.find=Ie,Dt.findIndex=ve,Dt.findKey=function(n,t,r){return t=Hr(t,r,3),lr(n,t,gr,true)},Dt.findLast=function(n,t,r){return t=Hr(t,r,3),lr(n,t,ir)},Dt.findLastIndex=function(n,t,r){var e=n?n.length:0; +for(t=Hr(t,r,3);e--;)if(t(n[e],e,n))return e;return-1},Dt.findLastKey=function(n,t,r){return t=Hr(t,r,3),lr(n,t,vr,true)},Dt.findWhere=function(n,t){return Ie(n,vu(t))},Dt.first=de,Dt.has=function(n,t){return n?Nu.call(n,t):false},Dt.identity=gu,Dt.includes=Ee,Dt.indexOf=ye,Dt.isArguments=Ye,Dt.isArray=Co,Dt.isBoolean=function(n){return true===n||false===n||w(n)&&Uu.call(n)==bt||false},Dt.isDate=function(n){return w(n)&&Uu.call(n)==wt||false},Dt.isElement=Ze,Dt.isEmpty=function(n){if(null==n)return true;var t=n.length; +return ue(t)&&(Co(n)||tu(n)||Ye(n)||w(n)&&Je(n.splice))?!t:!No(n).length},Dt.isEqual=function(n,t,r,e){return r=typeof r=="function"&&Wr(r,e,3),!r&&oe(n)&&oe(t)?n===t:(e=r?r(n,t):I,typeof e=="undefined"?_r(n,t,r):!!e)},Dt.isError=Ge,Dt.isFinite=So,Dt.isFunction=Je,Dt.isMatch=function(n,t,r,e){var u=No(t),o=u.length;if(r=typeof r=="function"&&Wr(r,e,3),!r&&1==o){var i=u[0];if(e=t[i],oe(e))return null!=n&&e===n[i]&&Nu.call(n,i)}for(var i=mu(o),f=mu(o);o--;)e=i[o]=t[u[o]],f[o]=oe(e);return br(n,u,i,f,r) +},Dt.isNaN=function(n){return Qe(n)&&n!=+n},Dt.isNative=He,Dt.isNull=function(n){return null===n},Dt.isNumber=Qe,Dt.isObject=Xe,Dt.isPlainObject=To,Dt.isRegExp=nu,Dt.isString=tu,Dt.isUndefined=function(n){return typeof n=="undefined"},Dt.kebabCase=Lo,Dt.last=function(n){var t=n?n.length:0;return t?n[t-1]:I},Dt.lastIndexOf=function(n,t,r){var e=n?n.length:0;if(!e)return-1;var u=e;if(typeof r=="number")u=(0>r?ro(e+r,0):eo(r||0,e-1))+1;else if(r)return u=Sr(n,t,true)-1,n=n[u],(t===t?t===n:n!==n)?u:-1;if(t!==t)return m(n,u,true); +for(;u--;)if(n[u]===t)return u;return-1},Dt.max=Ro,Dt.min=ko,Dt.noConflict=function(){return x._=Lu,this},Dt.noop=yu,Dt.now=Oo,Dt.pad=function(n,t,r){n=pe(n),t=+t;var e=n.length;return er?0:+r||0,n.length),n.lastIndexOf(t,r)==r +},Dt.template=function(n,t,r){var e=Dt.templateSettings;r&&ee(n,t,r)&&(t=r=null),n=pe(n),t=Qt(Qt({},r||t),e,Ht),r=Qt(Qt({},t.imports),e.imports,Ht);var u,o,i=No(r),f=Or(r,i),a=0;r=t.interpolate||ct;var l="__p+='";r=Ru((t.escape||ct).source+"|"+r.source+"|"+(r===et?ut:ct).source+"|"+(t.evaluate||ct).source+"|$","g");var c="sourceURL"in t?"//# sourceURL="+t.sourceURL+"\n":"";if(n.replace(r,function(t,r,e,i,f,c){return e||(e=i),l+=n.slice(a,c).replace(gt,_),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(Z,""):l).replace(G,"$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=su(function(){return xu(i,c+"return "+l).apply(I,f)}),t.source=l,Ge(t))throw t;return t},Dt.trim=lu,Dt.trimLeft=function(n,t,r){var e=n;return(n=pe(n))?n.slice((r?ee(e,t,r):null==t)?j(n):p(n,t+"")):n},Dt.trimRight=function(n,t,r){var e=n; +return(n=pe(n))?(r?ee(e,t,r):null==t)?n.slice(0,E(n)+1):n.slice(0,h(n,t+"")+1):n},Dt.trunc=function(n,t,r){r&&ee(n,t,r)&&(t=null);var e=B;if(r=z,null!=t)if(Xe(t)){var u="separator"in t?t.separator:u,e="length"in t?+t.length||0:e;r="omission"in t?t.omission+"":r}else e=+t||0;if(n=pe(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(nu(u)){if(n.slice(e).search(u)){var o,i=n.slice(0,e);for(u.global||(u=Ru(u.source,(ot.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),-1u.dir,i.push({iteratee:n,type:t}),u}}),n(["drop","take"],function(n,t){var r=n+"Count",e=n+"While";qt.prototype[n]=function(e){e=null==e?1:ro(+e||0,0);var u=this.clone();if(u.filtered){var o=u[r]; +u[r]=t?eo(o,e):o+e}else(u.views||(u.views=[])).push({size:e,type:n+(0>u.dir?"Right":"")});return u},qt.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()},qt.prototype[n+"RightWhile"]=function(n,t){return this.reverse()[e](n,t).reverse()}}),n(["first","last"],function(n,t){var r="take"+(t?"Right":"");qt.prototype[n]=function(){return this[r](1).value()[0]}}),n(["initial","rest"],function(n,t){var r="drop"+(t?"":"Right");qt.prototype[n]=function(){return this[r](1)}}),n(["pluck","where"],function(n,t){var r=t?"filter":"map",e=t?vu:_u; +qt.prototype[n]=function(n){return this[r](e(n))}}),qt.prototype.dropWhile=function(n,t){n=Hr(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))})},qt.prototype.reject=function(n,t){return n=Hr(n,t,3),this.filter(function(t,r,e){return!n(t,r,e)})},qt.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},gr(qt.prototype,function(n,t){var r=/^(?:first|last)$/.test(t); +Dt.prototype[t]=function(){function e(n){return n=[n],Ku.apply(n,o),Dt[t].apply(Dt,n)}var u=this.__wrapped__,o=arguments,i=this.__chain__,f=!!this.__actions__.length,a=u instanceof qt,l=a&&!f;return r&&!i?l?n.call(u):Dt[t](this.value()):a||Co(u)?(u=n.apply(l?u:new qt(this),o),r||!f&&!u.actions||(u.actions||(u.actions=[])).push({func:je,args:[e],thisArg:Dt}),new Mt(u,i)):this.thru(e)}}),n("concat join pop push shift sort splice unshift".split(" "),function(n){var t=Ou[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:join|pop|shift)$/.test(n); +Dt.prototype[n]=function(){var n=arguments;return e&&!this.__chain__?t.apply(this.value(),n):this[r](function(r){return t.apply(r,n)})}}),qt.prototype.clone=function(){var n=this.actions,t=this.iteratees,r=this.views,e=new qt(this.wrapped);return e.actions=n?l(n):null,e.dir=this.dir,e.dropCount=this.dropCount,e.filtered=this.filtered,e.iteratees=t?l(t):null,e.takeCount=this.takeCount,e.views=r?l(r):null,e},qt.prototype.reverse=function(){var n=this.filtered,t=n?new qt(this):this.clone();return t.dir=-1*this.dir,t.filtered=n,t +},qt.prototype.value=function(){var n=this.wrapped.value();if(!Co(n))return Cr(n,this.actions);var t,r=this.dir,e=0>r,u=n.length;t=u;for(var o=this.views,i=0,f=-1,a=o?o.length:0;++f"'`]/g,Q=RegExp(X.source),nt=RegExp(H.source),tt=/<%-([\s\S]+?)%>/g,rt=/<%([\s\S]+?)%>/g,et=/<%=([\s\S]+?)%>/g,ut=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ot=/\w*$/,it=/^\s*function[ \n\r\t]+\w/,ft=/^0[xX]/,at=/^\[object .+?Constructor\]$/,lt=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,ct=/($^)/,st=/[.*+?^${}()|[\]\/\\]/g,pt=RegExp(st.source),ht=/\bthis\b/,gt=/['\n\r\u2028\u2029\\]/g,vt=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"),dt=" \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",yt="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(" "),_t="[object Arguments]",mt="[object Array]",bt="[object Boolean]",wt="[object Date]",xt="[object Error]",At="[object Function]",jt="[object Number]",Et="[object Object]",Rt="[object RegExp]",kt="[object String]",It="[object ArrayBuffer]",Ot="[object Float32Array]",Ct="[object Float64Array]",St="[object Int8Array]",Tt="[object Int16Array]",Wt="[object Int32Array]",Nt="[object Uint8Array]",Ft="[object Uint8ClampedArray]",Ut="[object Uint16Array]",Lt="[object Uint32Array]",$t={}; +$t[_t]=$t[mt]=$t[Ot]=$t[Ct]=$t[St]=$t[Tt]=$t[Wt]=$t[Nt]=$t[Ft]=$t[Ut]=$t[Lt]=true,$t[It]=$t[bt]=$t[wt]=$t[xt]=$t[At]=$t["[object Map]"]=$t[jt]=$t[Et]=$t[Rt]=$t["[object Set]"]=$t[kt]=$t["[object WeakMap]"]=false;var Bt={};Bt[_t]=Bt[mt]=Bt[It]=Bt[bt]=Bt[wt]=Bt[Ot]=Bt[Ct]=Bt[St]=Bt[Tt]=Bt[Wt]=Bt[jt]=Bt[Et]=Bt[Rt]=Bt[kt]=Bt[Nt]=Bt[Ft]=Bt[Ut]=Bt[Lt]=true,Bt[xt]=Bt[At]=Bt["[object Map]"]=Bt["[object Set]"]=Bt["[object WeakMap]"]=false;var zt={leading:false,maxWait:0,trailing:false},Dt={"\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"},Mt={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},qt={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Pt={"function":true,object:true},Kt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Vt=Pt[typeof window]&&window!==(this&&this.window)?window:this,Yt=Pt[typeof exports]&&exports&&!exports.nodeType&&exports,Zt=Pt[typeof module]&&module&&!module.nodeType&&module,Gt=Yt&&Zt&&typeof global=="object"&&global; !Gt||Gt.global!==Gt&&Gt.window!==Gt&&Gt.self!==Gt||(Vt=Gt);var Jt=Zt&&Zt.exports===Yt&&Yt,Xt=k();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Vt._=Xt, define(function(){return Xt})):Yt&&Zt?Jt?(Zt.exports=Xt)._=Xt:Yt._=Xt:Vt._=Xt}).call(this); \ No newline at end of file