From 9e23f5441bc1118d9c4aa601cfa26544c50d4d98 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sat, 17 Sep 2016 22:37:40 -0700 Subject: [PATCH] Bump to v4.16.0. --- README.md | 19 +- _Stack.js | 3 +- _arraySample.js | 16 + _arraySampleSize.js | 18 + _arrayShuffle.js | 15 + _assignMergeValue.js | 5 +- _assignValue.js | 5 +- _baseAssignValue.js | 26 ++ _baseClone.js | 4 - _baseIndexOf.js | 18 +- _baseIsEqualDeep.js | 5 +- _baseIsNative.js | 3 +- _basePickBy.js | 4 +- _baseRest.js | 26 +- _baseSetData.js | 2 +- _baseSetToString.js | 22 ++ _cacheHas.js | 2 +- _castRest.js | 14 + _copyObject.js | 13 +- _countHolders.js | 2 +- _createFlow.js | 7 +- _createOver.js | 10 +- _deburrLetter.js | 2 +- _defineProperty.js | 11 - _equalArrays.js | 7 +- _escapeHtmlChar.js | 3 +- _flatRest.js | 16 + _getTag.js | 3 +- _hasPath.js | 10 +- _hashClear.js | 1 + _hashDelete.js | 4 +- _hashSet.js | 1 + _insertWrapDetails.js | 8 +- _isHostObject.js | 20 -- _listCacheClear.js | 1 + _listCacheDelete.js | 1 + _listCacheSet.js | 1 + _mapCacheClear.js | 1 + _mapCacheDelete.js | 4 +- _mapCacheSet.js | 6 +- _memoizeCapped.js | 26 ++ _nativeDefineProperty.js | 6 + _overRest.js | 36 ++ _setData.js | 26 +- _setToString.js | 14 + _setWrapToString.js | 16 +- _shortOut.js | 37 +++ _shuffleSelf.js | 25 ++ _stackClear.js | 1 + _stackDelete.js | 6 +- _stackSet.js | 12 +- _strictIndexOf.js | 23 ++ _strictLastIndexOf.js | 21 ++ _stringToPath.js | 4 +- _unescapeHtmlChar.js | 3 +- _unicodeSize.js | 2 +- assign.js | 8 +- at.js | 7 +- bindAll.js | 10 +- concat.js | 11 +- core.js | 155 +++++---- core.min.js | 46 +-- countBy.js | 9 +- defer.js | 2 +- difference.js | 4 +- differenceBy.js | 5 +- differenceWith.js | 6 +- escape.js | 10 +- forEach.js | 2 +- fp/_mapping.js | 11 +- fp/rangeStep.js | 5 + fp/rangeStepRight.js | 5 + groupBy.js | 5 +- intersection.js | 4 +- intersectionBy.js | 5 +- intersectionWith.js | 6 +- isElement.js | 2 +- isEmpty.js | 8 +- isObject.js | 2 +- isObjectLike.js | 2 +- isPlainObject.js | 4 +- keyBy.js | 5 +- lastIndexOf.js | 19 +- lodash.js | 694 ++++++++++++++++++++++++--------------- lodash.min.js | 248 +++++++------- mapKeys.js | 5 +- mapValues.js | 5 +- memoize.js | 4 +- mergeWith.js | 2 +- omit.js | 7 +- overArgs.js | 3 +- package.json | 2 +- parseInt.js | 11 +- pick.js | 7 +- pullAt.js | 7 +- rearg.js | 9 +- sample.js | 7 +- sampleSize.js | 25 +- shuffle.js | 13 +- sortBy.js | 7 +- template.js | 3 +- unescape.js | 2 +- uniq.js | 5 +- uniqBy.js | 4 +- uniqWith.js | 5 +- wrapperAt.js | 6 +- xorBy.js | 5 +- xorWith.js | 5 +- 108 files changed, 1230 insertions(+), 816 deletions(-) create mode 100644 _arraySample.js create mode 100644 _arraySampleSize.js create mode 100644 _arrayShuffle.js create mode 100644 _baseAssignValue.js create mode 100644 _baseSetToString.js create mode 100644 _castRest.js delete mode 100644 _defineProperty.js create mode 100644 _flatRest.js delete mode 100644 _isHostObject.js create mode 100644 _memoizeCapped.js create mode 100644 _nativeDefineProperty.js create mode 100644 _overRest.js create mode 100644 _setToString.js create mode 100644 _shortOut.js create mode 100644 _shuffleSelf.js create mode 100644 _strictIndexOf.js create mode 100644 _strictLastIndexOf.js create mode 100644 fp/rangeStep.js create mode 100644 fp/rangeStepRight.js diff --git a/README.md b/README.md index 2052e053f..3b053df63 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ -# lodash v4.15.0 +# lodash v4.16.0 The [Lodash](https://lodash.com/) library exported as [Node.js](https://nodejs.org/) modules. ## Installation Using npm: -```bash -$ {sudo -H} npm i -g npm +```shell +$ npm i -g npm $ npm i --save lodash ``` @@ -16,25 +16,24 @@ In Node.js: var _ = require('lodash'); // Load the core build. var _ = require('lodash/core'); -// Load the fp build for immutable auto-curried iteratee-first data-last methods. +// Load the FP build for immutable auto-curried iteratee-first data-last methods. var fp = require('lodash/fp'); -// Load a method category. +// Load method categories. var array = require('lodash/array'); var object = require('lodash/fp/object'); -// Load a single method for smaller builds with browserify/rollup/webpack. +// Cherry-pick methods for smaller browserify/rollup/webpack bundles. var chunk = require('lodash/chunk'); var extend = require('lodash/fp/extend'); ``` -See the [package source](https://github.com/lodash/lodash/tree/4.15.0-npm) for more details. +See the [package source](https://github.com/lodash/lodash/tree/4.16.0-npm) for more details. **Note:**
-Don’t assign values to the [special variable](http://nodejs.org/api/repl.html#repl_repl_features) `_` in the Node.js < 6 REPL.
-Install [n_](https://www.npmjs.com/package/n_) for a REPL that includes `lodash` by default. +Install [n_](https://www.npmjs.com/package/n_) for Lodash use in the Node.js < 6 REPL. ## Support -Tested in Chrome 51-52, Firefox 47-48, IE 9-11, Edge 14, Safari 8-9, Node.js 0.10-6, & PhantomJS 2.1.1.
+Tested in Chrome 52-53, Firefox 47-48, IE 11, Edge 14, Safari 8-9, Node.js 4-6, & PhantomJS 2.1.1.
Automated [browser](https://saucelabs.com/u/lodash) & [CI](https://travis-ci.org/lodash/lodash/) test runs are available. diff --git a/_Stack.js b/_Stack.js index b9ba1af3e..80b2cf1b0 100644 --- a/_Stack.js +++ b/_Stack.js @@ -13,7 +13,8 @@ var ListCache = require('./_ListCache'), * @param {Array} [entries] The key-value pairs to cache. */ function Stack(entries) { - this.__data__ = new ListCache(entries); + var data = this.__data__ = new ListCache(entries); + this.size = data.size; } // Add methods to `Stack`. diff --git a/_arraySample.js b/_arraySample.js new file mode 100644 index 000000000..bcc2f5965 --- /dev/null +++ b/_arraySample.js @@ -0,0 +1,16 @@ +var baseRandom = require('./_baseRandom'); + +/** + * A specialized version of `_.sample` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} array The array to sample. + * @returns {*} Returns the random element. + */ +function arraySample(array) { + var length = array.length; + return length ? array[baseRandom(0, length - 1)] : undefined; +} + +module.exports = arraySample; diff --git a/_arraySampleSize.js b/_arraySampleSize.js new file mode 100644 index 000000000..1e452c552 --- /dev/null +++ b/_arraySampleSize.js @@ -0,0 +1,18 @@ +var arrayShuffle = require('./_arrayShuffle'), + baseClamp = require('./_baseClamp'); + +/** + * A specialized version of `_.sampleSize` for arrays. + * + * @private + * @param {Array} array The array to sample. + * @param {number} n The number of elements to sample. + * @returns {Array} Returns the random elements. + */ +function arraySampleSize(array, n) { + var result = arrayShuffle(array); + result.length = baseClamp(n, 0, result.length); + return result; +} + +module.exports = arraySampleSize; diff --git a/_arrayShuffle.js b/_arrayShuffle.js new file mode 100644 index 000000000..46313a39b --- /dev/null +++ b/_arrayShuffle.js @@ -0,0 +1,15 @@ +var copyArray = require('./_copyArray'), + shuffleSelf = require('./_shuffleSelf'); + +/** + * A specialized version of `_.shuffle` for arrays. + * + * @private + * @param {Array} array The array to shuffle. + * @returns {Array} Returns the new shuffled array. + */ +function arrayShuffle(array) { + return shuffleSelf(copyArray(array)); +} + +module.exports = arrayShuffle; diff --git a/_assignMergeValue.js b/_assignMergeValue.js index 61dd58329..fe8987556 100644 --- a/_assignMergeValue.js +++ b/_assignMergeValue.js @@ -1,4 +1,5 @@ -var eq = require('./eq'); +var baseAssignValue = require('./_baseAssignValue'), + eq = require('./eq'); /** * This function is like `assignValue` except that it doesn't assign @@ -12,7 +13,7 @@ var eq = require('./eq'); function assignMergeValue(object, key, value) { if ((value !== undefined && !eq(object[key], value)) || (typeof key == 'number' && value === undefined && !(key in object))) { - object[key] = value; + baseAssignValue(object, key, value); } } diff --git a/_assignValue.js b/_assignValue.js index aa1dc78e1..40839575b 100644 --- a/_assignValue.js +++ b/_assignValue.js @@ -1,4 +1,5 @@ -var eq = require('./eq'); +var baseAssignValue = require('./_baseAssignValue'), + eq = require('./eq'); /** Used for built-in method references. */ var objectProto = Object.prototype; @@ -20,7 +21,7 @@ function assignValue(object, key, value) { var objValue = object[key]; if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || (value === undefined && !(key in object))) { - object[key] = value; + baseAssignValue(object, key, value); } } diff --git a/_baseAssignValue.js b/_baseAssignValue.js new file mode 100644 index 000000000..0a937450a --- /dev/null +++ b/_baseAssignValue.js @@ -0,0 +1,26 @@ +/** Built-in value references. */ +var defineProperty = Object.defineProperty; + +/** + * The base implementation of `assignValue` and `assignMergeValue` without + * value checks. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ +function baseAssignValue(object, key, value) { + if (key == '__proto__' && defineProperty) { + defineProperty(object, key, { + 'configurable': true, + 'enumerable': true, + 'value': value, + 'writable': true + }); + } else { + object[key] = value; + } +} + +module.exports = baseAssignValue; diff --git a/_baseClone.js b/_baseClone.js index fce3c0c08..8ac0fec20 100644 --- a/_baseClone.js +++ b/_baseClone.js @@ -12,7 +12,6 @@ var Stack = require('./_Stack'), initCloneObject = require('./_initCloneObject'), isArray = require('./isArray'), isBuffer = require('./isBuffer'), - isHostObject = require('./_isHostObject'), isObject = require('./isObject'), keys = require('./keys'); @@ -100,9 +99,6 @@ function baseClone(value, isDeep, isFull, customizer, key, object, stack) { return cloneBuffer(value, isDeep); } if (tag == objectTag || tag == argsTag || (isFunc && !object)) { - if (isHostObject(value)) { - return object ? value : {}; - } result = initCloneObject(isFunc ? {} : value); if (!isDeep) { return copySymbols(value, baseAssign(result, value)); diff --git a/_baseIndexOf.js b/_baseIndexOf.js index c232d4330..167e706e7 100644 --- a/_baseIndexOf.js +++ b/_baseIndexOf.js @@ -1,5 +1,6 @@ var baseFindIndex = require('./_baseFindIndex'), - baseIsNaN = require('./_baseIsNaN'); + baseIsNaN = require('./_baseIsNaN'), + strictIndexOf = require('./_strictIndexOf'); /** * The base implementation of `_.indexOf` without `fromIndex` bounds checks. @@ -11,18 +12,9 @@ var baseFindIndex = require('./_baseFindIndex'), * @returns {number} Returns the index of the matched value, else `-1`. */ function baseIndexOf(array, value, fromIndex) { - if (value !== value) { - return baseFindIndex(array, baseIsNaN, fromIndex); - } - var index = fromIndex - 1, - length = array.length; - - while (++index < length) { - if (array[index] === value) { - return index; - } - } - return -1; + return value === value + ? strictIndexOf(array, value, fromIndex) + : baseFindIndex(array, baseIsNaN, fromIndex); } module.exports = baseIndexOf; diff --git a/_baseIsEqualDeep.js b/_baseIsEqualDeep.js index c18d6d1fc..8d9a49fc6 100644 --- a/_baseIsEqualDeep.js +++ b/_baseIsEqualDeep.js @@ -4,7 +4,6 @@ var Stack = require('./_Stack'), equalObjects = require('./_equalObjects'), getTag = require('./_getTag'), isArray = require('./isArray'), - isHostObject = require('./_isHostObject'), isTypedArray = require('./isTypedArray'); /** Used to compose bitmasks for comparison styles. */ @@ -50,8 +49,8 @@ function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) { othTag = getTag(other); othTag = othTag == argsTag ? objectTag : othTag; } - var objIsObj = objTag == objectTag && !isHostObject(object), - othIsObj = othTag == objectTag && !isHostObject(other), + var objIsObj = objTag == objectTag, + othIsObj = othTag == objectTag, isSameTag = objTag == othTag; if (isSameTag && !objIsObj) { diff --git a/_baseIsNative.js b/_baseIsNative.js index c79c77ccb..870233049 100644 --- a/_baseIsNative.js +++ b/_baseIsNative.js @@ -1,5 +1,4 @@ var isFunction = require('./isFunction'), - isHostObject = require('./_isHostObject'), isMasked = require('./_isMasked'), isObject = require('./isObject'), toSource = require('./_toSource'); @@ -41,7 +40,7 @@ function baseIsNative(value) { if (!isObject(value) || isMasked(value)) { return false; } - var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; + var pattern = isFunction(value) ? reIsNative : reIsHostCtor; return pattern.test(toSource(value)); } diff --git a/_basePickBy.js b/_basePickBy.js index fcc66105a..dc9b342e8 100644 --- a/_basePickBy.js +++ b/_basePickBy.js @@ -1,3 +1,5 @@ +var baseAssignValue = require('./_baseAssignValue'); + /** * The base implementation of `_.pickBy` without support for iteratee shorthands. * @@ -17,7 +19,7 @@ function basePickBy(object, props, predicate) { value = object[key]; if (predicate(value, key)) { - result[key] = value; + baseAssignValue(result, key, value); } } return result; diff --git a/_baseRest.js b/_baseRest.js index d8aa217c6..d0dc4bdd1 100644 --- a/_baseRest.js +++ b/_baseRest.js @@ -1,7 +1,6 @@ -var apply = require('./_apply'); - -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeMax = Math.max; +var identity = require('./identity'), + overRest = require('./_overRest'), + setToString = require('./_setToString'); /** * The base implementation of `_.rest` which doesn't validate or coerce arguments. @@ -12,24 +11,7 @@ var nativeMax = Math.max; * @returns {Function} Returns the new function. */ function baseRest(func, start) { - start = nativeMax(start === undefined ? (func.length - 1) : start, 0); - return function() { - var args = arguments, - index = -1, - length = nativeMax(args.length - start, 0), - array = Array(length); - - while (++index < length) { - array[index] = args[start + index]; - } - index = -1; - var otherArgs = Array(start + 1); - while (++index < start) { - otherArgs[index] = args[index]; - } - otherArgs[start] = array; - return apply(func, this, otherArgs); - }; + return setToString(overRest(func, start, identity), func + ''); } module.exports = baseRest; diff --git a/_baseSetData.js b/_baseSetData.js index e689df2cc..c409947dd 100644 --- a/_baseSetData.js +++ b/_baseSetData.js @@ -2,7 +2,7 @@ var identity = require('./identity'), metaMap = require('./_metaMap'); /** - * The base implementation of `setData` without support for hot loop detection. + * The base implementation of `setData` without support for hot loop shorting. * * @private * @param {Function} func The function to associate metadata with. diff --git a/_baseSetToString.js b/_baseSetToString.js new file mode 100644 index 000000000..224a65af3 --- /dev/null +++ b/_baseSetToString.js @@ -0,0 +1,22 @@ +var constant = require('./constant'), + identity = require('./identity'), + nativeDefineProperty = require('./_nativeDefineProperty'); + +/** + * The base implementation of `setToString` without support for hot loop shorting. + * + * @private + * @param {Function} func The function to modify. + * @param {Function} string The `toString` result. + * @returns {Function} Returns `func`. + */ +var baseSetToString = !nativeDefineProperty ? identity : function(func, string) { + return nativeDefineProperty(func, 'toString', { + 'configurable': true, + 'enumerable': false, + 'value': constant(string), + 'writable': true + }); +}; + +module.exports = baseSetToString; diff --git a/_cacheHas.js b/_cacheHas.js index c4c6b6504..2dec89268 100644 --- a/_cacheHas.js +++ b/_cacheHas.js @@ -1,5 +1,5 @@ /** - * Checks if a cache value for `key` exists. + * Checks if a `cache` value for `key` exists. * * @private * @param {Object} cache The cache to query. diff --git a/_castRest.js b/_castRest.js new file mode 100644 index 000000000..213c66f19 --- /dev/null +++ b/_castRest.js @@ -0,0 +1,14 @@ +var baseRest = require('./_baseRest'); + +/** + * A `baseRest` alias which can be replaced with `identity` by module + * replacement plugins. + * + * @private + * @type {Function} + * @param {Function} func The function to apply a rest parameter to. + * @returns {Function} Returns the new function. + */ +var castRest = baseRest; + +module.exports = castRest; diff --git a/_copyObject.js b/_copyObject.js index 7d267b2e5..2f2a5c23b 100644 --- a/_copyObject.js +++ b/_copyObject.js @@ -1,4 +1,5 @@ -var assignValue = require('./_assignValue'); +var assignValue = require('./_assignValue'), + baseAssignValue = require('./_baseAssignValue'); /** * Copies properties of `source` to `object`. @@ -11,6 +12,7 @@ var assignValue = require('./_assignValue'); * @returns {Object} Returns `object`. */ function copyObject(source, props, object, customizer) { + var isNew = !object; object || (object = {}); var index = -1, @@ -23,7 +25,14 @@ function copyObject(source, props, object, customizer) { ? customizer(object[key], source[key], key, object, source) : undefined; - assignValue(object, key, newValue === undefined ? source[key] : newValue); + if (newValue === undefined) { + newValue = source[key]; + } + if (isNew) { + baseAssignValue(object, key, newValue); + } else { + assignValue(object, key, newValue); + } } return object; } diff --git a/_countHolders.js b/_countHolders.js index 8cc95e6e0..718fcdaa8 100644 --- a/_countHolders.js +++ b/_countHolders.js @@ -12,7 +12,7 @@ function countHolders(array, placeholder) { while (length--) { if (array[length] === placeholder) { - result++; + ++result; } } return result; diff --git a/_createFlow.js b/_createFlow.js index 911aaf15c..56de0b269 100644 --- a/_createFlow.js +++ b/_createFlow.js @@ -1,6 +1,5 @@ var LodashWrapper = require('./_LodashWrapper'), - baseFlatten = require('./_baseFlatten'), - baseRest = require('./_baseRest'), + flatRest = require('./_flatRest'), getData = require('./_getData'), getFuncName = require('./_getFuncName'), isArray = require('./isArray'), @@ -26,9 +25,7 @@ var CURRY_FLAG = 8, * @returns {Function} Returns the new flow function. */ function createFlow(fromRight) { - return baseRest(function(funcs) { - funcs = baseFlatten(funcs, 1); - + return flatRest(function(funcs) { var length = funcs.length, index = length, prereq = LodashWrapper.prototype.thru; diff --git a/_createOver.js b/_createOver.js index 723182dc1..3b9455161 100644 --- a/_createOver.js +++ b/_createOver.js @@ -1,10 +1,9 @@ var apply = require('./_apply'), arrayMap = require('./_arrayMap'), - baseFlatten = require('./_baseFlatten'), baseIteratee = require('./_baseIteratee'), baseRest = require('./_baseRest'), baseUnary = require('./_baseUnary'), - isArray = require('./isArray'); + flatRest = require('./_flatRest'); /** * Creates a function like `_.over`. @@ -14,11 +13,8 @@ var apply = require('./_apply'), * @returns {Function} Returns the new over function. */ function createOver(arrayFunc) { - return baseRest(function(iteratees) { - iteratees = (iteratees.length == 1 && isArray(iteratees[0])) - ? arrayMap(iteratees[0], baseUnary(baseIteratee)) - : arrayMap(baseFlatten(iteratees, 1), baseUnary(baseIteratee)); - + return flatRest(function(iteratees) { + iteratees = arrayMap(iteratees, baseUnary(baseIteratee)); return baseRest(function(args) { var thisArg = this; return arrayFunc(iteratees, function(iteratee) { diff --git a/_deburrLetter.js b/_deburrLetter.js index 98283a467..3e531edcf 100644 --- a/_deburrLetter.js +++ b/_deburrLetter.js @@ -55,7 +55,7 @@ var deburredLetters = { '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', '\u0132': 'IJ', '\u0133': 'ij', '\u0152': 'Oe', '\u0153': 'oe', - '\u0149': "'n", '\u017f': 'ss' + '\u0149': "'n", '\u017f': 's' }; /** diff --git a/_defineProperty.js b/_defineProperty.js deleted file mode 100644 index f6128d776..000000000 --- a/_defineProperty.js +++ /dev/null @@ -1,11 +0,0 @@ -var getNative = require('./_getNative'); - -/* Used to set `toString` methods. */ -var defineProperty = (function() { - var func = getNative(Object, 'defineProperty'), - name = getNative.name; - - return (name && name.length > 2) ? func : undefined; -}()); - -module.exports = defineProperty; diff --git a/_equalArrays.js b/_equalArrays.js index e095170ce..178dcedf2 100644 --- a/_equalArrays.js +++ b/_equalArrays.js @@ -1,5 +1,6 @@ var SetCache = require('./_SetCache'), - arraySome = require('./_arraySome'); + arraySome = require('./_arraySome'), + cacheHas = require('./_cacheHas'); /** Used to compose bitmasks for comparison styles. */ var UNORDERED_COMPARE_FLAG = 1, @@ -59,9 +60,9 @@ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) { // Recursively compare arrays (susceptible to call stack limits). if (seen) { if (!arraySome(other, function(othValue, othIndex) { - if (!seen.has(othIndex) && + if (!cacheHas(seen, othIndex) && (arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) { - return seen.add(othIndex); + return seen.push(othIndex); } })) { result = false; diff --git a/_escapeHtmlChar.js b/_escapeHtmlChar.js index 6abceb51c..7ca68ee62 100644 --- a/_escapeHtmlChar.js +++ b/_escapeHtmlChar.js @@ -6,8 +6,7 @@ var htmlEscapes = { '<': '<', '>': '>', '"': '"', - "'": ''', - '`': '`' + "'": ''' }; /** diff --git a/_flatRest.js b/_flatRest.js new file mode 100644 index 000000000..94ab6cca7 --- /dev/null +++ b/_flatRest.js @@ -0,0 +1,16 @@ +var flatten = require('./flatten'), + overRest = require('./_overRest'), + setToString = require('./_setToString'); + +/** + * A specialized version of `baseRest` which flattens the rest array. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @returns {Function} Returns the new function. + */ +function flatRest(func) { + return setToString(overRest(func, undefined, flatten), func + ''); +} + +module.exports = flatRest; diff --git a/_getTag.js b/_getTag.js index de560d676..6954db1b6 100644 --- a/_getTag.js +++ b/_getTag.js @@ -41,8 +41,7 @@ var dataViewCtorString = toSource(DataView), */ var getTag = baseGetTag; -// Fallback for data views, maps, sets, and weak maps in IE 11, -// for data views in Edge < 14, and promises in Node.js. +// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || (Map && getTag(new Map) != mapTag) || (Promise && getTag(Promise.resolve()) != promiseTag) || diff --git a/_hasPath.js b/_hasPath.js index 1e2c3eac4..770be4b88 100644 --- a/_hasPath.js +++ b/_hasPath.js @@ -18,9 +18,9 @@ var castPath = require('./_castPath'), function hasPath(object, path, hasFunc) { path = isKey(path, object) ? [path] : castPath(path); - var result, - index = -1, - length = path.length; + var index = -1, + length = path.length, + result = false; while (++index < length) { var key = toKey(path[index]); @@ -29,10 +29,10 @@ function hasPath(object, path, hasFunc) { } object = object[key]; } - if (result) { + if (result || ++index != length) { return result; } - var length = object ? object.length : 0; + length = object ? object.length : 0; return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object)); } diff --git a/_hashClear.js b/_hashClear.js index 14c159176..5d4b70cc4 100644 --- a/_hashClear.js +++ b/_hashClear.js @@ -9,6 +9,7 @@ var nativeCreate = require('./_nativeCreate'); */ function hashClear() { this.__data__ = nativeCreate ? nativeCreate(null) : {}; + this.size = 0; } module.exports = hashClear; diff --git a/_hashDelete.js b/_hashDelete.js index 45b39fb00..ea9dabf13 100644 --- a/_hashDelete.js +++ b/_hashDelete.js @@ -9,7 +9,9 @@ * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function hashDelete(key) { - return this.has(key) && delete this.__data__[key]; + var result = this.has(key) && delete this.__data__[key]; + this.size -= result ? 1 : 0; + return result; } module.exports = hashDelete; diff --git a/_hashSet.js b/_hashSet.js index 56fec1eb2..e1055283e 100644 --- a/_hashSet.js +++ b/_hashSet.js @@ -15,6 +15,7 @@ var HASH_UNDEFINED = '__lodash_hash_undefined__'; */ function hashSet(key, value) { var data = this.__data__; + this.size += this.has(key) ? 0 : 1; data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; return this; } diff --git a/_insertWrapDetails.js b/_insertWrapDetails.js index 191f226de..e79080864 100644 --- a/_insertWrapDetails.js +++ b/_insertWrapDetails.js @@ -10,9 +10,11 @@ var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/; * @returns {string} Returns the modified source. */ function insertWrapDetails(source, details) { - var length = details.length, - lastIndex = length - 1; - + var length = details.length; + if (!length) { + return source; + } + var lastIndex = length - 1; details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex]; details = details.join(length > 2 ? ', ' : ' '); return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n'); diff --git a/_isHostObject.js b/_isHostObject.js deleted file mode 100644 index e598c10e3..000000000 --- a/_isHostObject.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Checks if `value` is a host object in IE < 9. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a host object, else `false`. - */ -function isHostObject(value) { - // Many host objects are `Object` objects that can coerce to strings - // despite having improperly defined `toString` methods. - var result = false; - if (value != null && typeof value.toString != 'function') { - try { - result = !!(value + ''); - } catch (e) {} - } - return result; -} - -module.exports = isHostObject; diff --git a/_listCacheClear.js b/_listCacheClear.js index e4e132581..acbe39a59 100644 --- a/_listCacheClear.js +++ b/_listCacheClear.js @@ -7,6 +7,7 @@ */ function listCacheClear() { this.__data__ = []; + this.size = 0; } module.exports = listCacheClear; diff --git a/_listCacheDelete.js b/_listCacheDelete.js index 2f3232836..b1384ade9 100644 --- a/_listCacheDelete.js +++ b/_listCacheDelete.js @@ -28,6 +28,7 @@ function listCacheDelete(key) { } else { splice.call(data, index, 1); } + --this.size; return true; } diff --git a/_listCacheSet.js b/_listCacheSet.js index e2f13b6be..5855c95e4 100644 --- a/_listCacheSet.js +++ b/_listCacheSet.js @@ -15,6 +15,7 @@ function listCacheSet(key, value) { index = assocIndexOf(data, key); if (index < 0) { + ++this.size; data.push([key, value]); } else { data[index][1] = value; diff --git a/_mapCacheClear.js b/_mapCacheClear.js index edb42b5f5..bc9ca204a 100644 --- a/_mapCacheClear.js +++ b/_mapCacheClear.js @@ -10,6 +10,7 @@ var Hash = require('./_Hash'), * @memberOf MapCache */ function mapCacheClear() { + this.size = 0; this.__data__ = { 'hash': new Hash, 'map': new (Map || ListCache), diff --git a/_mapCacheDelete.js b/_mapCacheDelete.js index 08f1c2efe..946ca3c93 100644 --- a/_mapCacheDelete.js +++ b/_mapCacheDelete.js @@ -10,7 +10,9 @@ var getMapData = require('./_getMapData'); * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function mapCacheDelete(key) { - return getMapData(this, key)['delete'](key); + var result = getMapData(this, key)['delete'](key); + this.size -= result ? 1 : 0; + return result; } module.exports = mapCacheDelete; diff --git a/_mapCacheSet.js b/_mapCacheSet.js index 0ef1eafd8..734684927 100644 --- a/_mapCacheSet.js +++ b/_mapCacheSet.js @@ -11,7 +11,11 @@ var getMapData = require('./_getMapData'); * @returns {Object} Returns the map cache instance. */ function mapCacheSet(key, value) { - getMapData(this, key).set(key, value); + var data = getMapData(this, key), + size = data.size; + + data.set(key, value); + this.size += data.size == size ? 0 : 1; return this; } diff --git a/_memoizeCapped.js b/_memoizeCapped.js new file mode 100644 index 000000000..7f71c8fba --- /dev/null +++ b/_memoizeCapped.js @@ -0,0 +1,26 @@ +var memoize = require('./memoize'); + +/** Used as the maximum memoize cache size. */ +var MAX_MEMOIZE_SIZE = 500; + +/** + * A specialized version of `_.memoize` which clears the memoized function's + * cache when it exceeds `MAX_MEMOIZE_SIZE`. + * + * @private + * @param {Function} func The function to have its output memoized. + * @returns {Function} Returns the new memoized function. + */ +function memoizeCapped(func) { + var result = memoize(func, function(key) { + if (cache.size === MAX_MEMOIZE_SIZE) { + cache.clear(); + } + return key; + }); + + var cache = result.cache; + return result; +} + +module.exports = memoizeCapped; diff --git a/_nativeDefineProperty.js b/_nativeDefineProperty.js new file mode 100644 index 000000000..38ed486a7 --- /dev/null +++ b/_nativeDefineProperty.js @@ -0,0 +1,6 @@ +var getNative = require('./_getNative'); + +/* Built-in method references that are verified to be native. */ +var nativeDefineProperty = getNative(Object, 'defineProperty'); + +module.exports = nativeDefineProperty; diff --git a/_overRest.js b/_overRest.js new file mode 100644 index 000000000..c7cdef339 --- /dev/null +++ b/_overRest.js @@ -0,0 +1,36 @@ +var apply = require('./_apply'); + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max; + +/** + * A specialized version of `baseRest` which transforms the rest array. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @param {Function} transform The rest array transform. + * @returns {Function} Returns the new function. + */ +function overRest(func, start, transform) { + start = nativeMax(start === undefined ? (func.length - 1) : start, 0); + return function() { + var args = arguments, + index = -1, + length = nativeMax(args.length - start, 0), + array = Array(length); + + while (++index < length) { + array[index] = args[start + index]; + } + index = -1; + var otherArgs = Array(start + 1); + while (++index < start) { + otherArgs[index] = args[index]; + } + otherArgs[start] = transform(array); + return apply(func, this, otherArgs); + }; +} + +module.exports = overRest; diff --git a/_setData.js b/_setData.js index d86c61086..e5cf3eb96 100644 --- a/_setData.js +++ b/_setData.js @@ -1,9 +1,5 @@ var baseSetData = require('./_baseSetData'), - now = require('./now'); - -/** Used to detect hot functions by number of calls within a span of milliseconds. */ -var HOT_COUNT = 150, - HOT_SPAN = 16; + shortOut = require('./_shortOut'); /** * Sets metadata for `func`. @@ -19,24 +15,6 @@ var HOT_COUNT = 150, * @param {*} data The metadata. * @returns {Function} Returns `func`. */ -var setData = (function() { - var count = 0, - lastCalled = 0; - - return function(key, value) { - var stamp = now(), - remaining = HOT_SPAN - (stamp - lastCalled); - - lastCalled = stamp; - if (remaining > 0) { - if (++count >= HOT_COUNT) { - return key; - } - } else { - count = 0; - } - return baseSetData(key, value); - }; -}()); +var setData = shortOut(baseSetData); module.exports = setData; diff --git a/_setToString.js b/_setToString.js new file mode 100644 index 000000000..6ca841967 --- /dev/null +++ b/_setToString.js @@ -0,0 +1,14 @@ +var baseSetToString = require('./_baseSetToString'), + shortOut = require('./_shortOut'); + +/** + * Sets the `toString` method of `func` to return `string`. + * + * @private + * @param {Function} func The function to modify. + * @param {Function} string The `toString` result. + * @returns {Function} Returns `func`. + */ +var setToString = shortOut(baseSetToString); + +module.exports = setToString; diff --git a/_setWrapToString.js b/_setWrapToString.js index 3c53cd0fc..decdc4499 100644 --- a/_setWrapToString.js +++ b/_setWrapToString.js @@ -1,8 +1,6 @@ -var constant = require('./constant'), - defineProperty = require('./_defineProperty'), - getWrapDetails = require('./_getWrapDetails'), - identity = require('./identity'), +var getWrapDetails = require('./_getWrapDetails'), insertWrapDetails = require('./_insertWrapDetails'), + setToString = require('./_setToString'), updateWrapDetails = require('./_updateWrapDetails'); /** @@ -15,13 +13,9 @@ var constant = require('./constant'), * @param {number} bitmask The bitmask flags. See `createWrap` for more details. * @returns {Function} Returns `wrapper`. */ -var setWrapToString = !defineProperty ? identity : function(wrapper, reference, bitmask) { +function setWrapToString(wrapper, reference, bitmask) { var source = (reference + ''); - return defineProperty(wrapper, 'toString', { - 'configurable': true, - 'enumerable': false, - 'value': constant(insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))) - }); -}; + return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))); +} module.exports = setWrapToString; diff --git a/_shortOut.js b/_shortOut.js new file mode 100644 index 000000000..a4e6507fb --- /dev/null +++ b/_shortOut.js @@ -0,0 +1,37 @@ +/** Used to detect hot functions by number of calls within a span of milliseconds. */ +var HOT_COUNT = 500, + HOT_SPAN = 16; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeNow = Date.now; + +/** + * Creates a function that'll short out and invoke `identity` instead + * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN` + * milliseconds. + * + * @private + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new shortable function. + */ +function shortOut(func) { + var count = 0, + lastCalled = 0; + + return function() { + var stamp = nativeNow(), + remaining = HOT_SPAN - (stamp - lastCalled); + + lastCalled = stamp; + if (remaining > 0) { + if (++count >= HOT_COUNT) { + return arguments[0]; + } + } else { + count = 0; + } + return func.apply(undefined, arguments); + }; +} + +module.exports = shortOut; diff --git a/_shuffleSelf.js b/_shuffleSelf.js new file mode 100644 index 000000000..718ef7b00 --- /dev/null +++ b/_shuffleSelf.js @@ -0,0 +1,25 @@ +var baseRandom = require('./_baseRandom'); + +/** + * A specialized version of `arrayShuffle` which mutates `array`. + * + * @private + * @param {Array} array The array to shuffle. + * @returns {Array} Returns `array`. + */ +function shuffleSelf(array) { + var index = -1, + length = array.length, + lastIndex = length - 1; + + while (++index < length) { + var rand = baseRandom(index, lastIndex), + value = array[rand]; + + array[rand] = array[index]; + array[index] = value; + } + return array; +} + +module.exports = shuffleSelf; diff --git a/_stackClear.js b/_stackClear.js index 498482c4c..ce8e5a92f 100644 --- a/_stackClear.js +++ b/_stackClear.js @@ -9,6 +9,7 @@ var ListCache = require('./_ListCache'); */ function stackClear() { this.__data__ = new ListCache; + this.size = 0; } module.exports = stackClear; diff --git a/_stackDelete.js b/_stackDelete.js index 8c60260c7..ff9887ab6 100644 --- a/_stackDelete.js +++ b/_stackDelete.js @@ -8,7 +8,11 @@ * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function stackDelete(key) { - return this.__data__['delete'](key); + var data = this.__data__, + result = data['delete'](key); + + this.size = data.size; + return result; } module.exports = stackDelete; diff --git a/_stackSet.js b/_stackSet.js index 604918376..b790ac5f4 100644 --- a/_stackSet.js +++ b/_stackSet.js @@ -16,16 +16,18 @@ var LARGE_ARRAY_SIZE = 200; * @returns {Object} Returns the stack cache instance. */ function stackSet(key, value) { - var cache = this.__data__; - if (cache instanceof ListCache) { - var pairs = cache.__data__; + var data = this.__data__; + if (data instanceof ListCache) { + var pairs = data.__data__; if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { pairs.push([key, value]); + this.size = ++data.size; return this; } - cache = this.__data__ = new MapCache(pairs); + data = this.__data__ = new MapCache(pairs); } - cache.set(key, value); + data.set(key, value); + this.size = data.size; return this; } diff --git a/_strictIndexOf.js b/_strictIndexOf.js new file mode 100644 index 000000000..0486a4956 --- /dev/null +++ b/_strictIndexOf.js @@ -0,0 +1,23 @@ +/** + * A specialized version of `_.indexOf` which performs strict equality + * comparisons of values, i.e. `===`. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function strictIndexOf(array, value, fromIndex) { + var index = fromIndex - 1, + length = array.length; + + while (++index < length) { + if (array[index] === value) { + return index; + } + } + return -1; +} + +module.exports = strictIndexOf; diff --git a/_strictLastIndexOf.js b/_strictLastIndexOf.js new file mode 100644 index 000000000..d7310dcc2 --- /dev/null +++ b/_strictLastIndexOf.js @@ -0,0 +1,21 @@ +/** + * A specialized version of `_.lastIndexOf` which performs strict equality + * comparisons of values, i.e. `===`. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function strictLastIndexOf(array, value, fromIndex) { + var index = fromIndex + 1; + while (index--) { + if (array[index] === value) { + return index; + } + } + return index; +} + +module.exports = strictLastIndexOf; diff --git a/_stringToPath.js b/_stringToPath.js index 3eaf5c392..8bb78e53f 100644 --- a/_stringToPath.js +++ b/_stringToPath.js @@ -1,4 +1,4 @@ -var memoize = require('./memoize'), +var memoizeCapped = require('./_memoizeCapped'), toString = require('./toString'); /** Used to match property names within property paths. */ @@ -15,7 +15,7 @@ var reEscapeChar = /\\(\\)?/g; * @param {string} string The string to convert. * @returns {Array} Returns the property path array. */ -var stringToPath = memoize(function(string) { +var stringToPath = memoizeCapped(function(string) { string = toString(string); var result = []; diff --git a/_unescapeHtmlChar.js b/_unescapeHtmlChar.js index 11e5b7d55..a71fecb3f 100644 --- a/_unescapeHtmlChar.js +++ b/_unescapeHtmlChar.js @@ -6,8 +6,7 @@ var htmlUnescapes = { '<': '<', '>': '>', '"': '"', - ''': "'", - '`': '`' + ''': "'" }; /** diff --git a/_unicodeSize.js b/_unicodeSize.js index 3f50ce86a..26cd25703 100644 --- a/_unicodeSize.js +++ b/_unicodeSize.js @@ -34,7 +34,7 @@ var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); function unicodeSize(string) { var result = reUnicode.lastIndex = 0; while (reUnicode.test(string)) { - result++; + ++result; } return result; } diff --git a/assign.js b/assign.js index 5488c8b69..909db26a3 100644 --- a/assign.js +++ b/assign.js @@ -11,12 +11,6 @@ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; -/** Built-in value references. */ -var propertyIsEnumerable = objectProto.propertyIsEnumerable; - -/** Detect if properties shadowing those on `Object.prototype` are non-enumerable. */ -var nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf'); - /** * Assigns own enumerable string keyed properties of source objects to the * destination object. Source objects are applied from left to right. @@ -50,7 +44,7 @@ var nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf'); * // => { 'a': 1, 'c': 3 } */ var assign = createAssigner(function(object, source) { - if (nonEnumShadows || isPrototype(source) || isArrayLike(source)) { + if (isPrototype(source) || isArrayLike(source)) { copyObject(source, keys(source), object); return; } diff --git a/at.js b/at.js index 5849a8caa..05e948254 100644 --- a/at.js +++ b/at.js @@ -1,6 +1,5 @@ var baseAt = require('./_baseAt'), - baseFlatten = require('./_baseFlatten'), - baseRest = require('./_baseRest'); + flatRest = require('./_flatRest'); /** * Creates an array of values corresponding to `paths` of `object`. @@ -19,8 +18,6 @@ var baseAt = require('./_baseAt'), * _.at(object, ['a[0].b.c', 'a[1]']); * // => [3, 4] */ -var at = baseRest(function(object, paths) { - return baseAt(object, baseFlatten(paths, 1)); -}); +var at = flatRest(baseAt); module.exports = at; diff --git a/bindAll.js b/bindAll.js index 7d0d09d5a..a35706dee 100644 --- a/bindAll.js +++ b/bindAll.js @@ -1,7 +1,7 @@ var arrayEach = require('./_arrayEach'), - baseFlatten = require('./_baseFlatten'), - baseRest = require('./_baseRest'), + baseAssignValue = require('./_baseAssignValue'), bind = require('./bind'), + flatRest = require('./_flatRest'), toKey = require('./_toKey'); /** @@ -30,10 +30,10 @@ var arrayEach = require('./_arrayEach'), * jQuery(element).on('click', view.click); * // => Logs 'clicked docs' when clicked. */ -var bindAll = baseRest(function(object, methodNames) { - arrayEach(baseFlatten(methodNames, 1), function(key) { +var bindAll = flatRest(function(object, methodNames) { + arrayEach(methodNames, function(key) { key = toKey(key); - object[key] = bind(object[key], object); + baseAssignValue(object, key, bind(object[key], object)); }); return object; }); diff --git a/concat.js b/concat.js index 506306c65..1da48a4fc 100644 --- a/concat.js +++ b/concat.js @@ -26,17 +26,18 @@ var arrayPush = require('./_arrayPush'), * // => [1] */ function concat() { - var length = arguments.length, - args = Array(length ? length - 1 : 0), + var length = arguments.length; + if (!length) { + return []; + } + var args = Array(length - 1), array = arguments[0], index = length; while (index--) { args[index - 1] = arguments[index]; } - return length - ? arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)) - : []; + return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)); } module.exports = concat; diff --git a/core.js b/core.js index de27977d2..7b2496722 100644 --- a/core.js +++ b/core.js @@ -13,7 +13,7 @@ var undefined; /** Used as the semantic version number. */ - var VERSION = '4.15.0'; + var VERSION = '4.16.0'; /** Used as the `TypeError` message for "Functions" methods. */ var FUNC_ERROR_TEXT = 'Expected a function'; @@ -53,8 +53,7 @@ '<': '<', '>': '>', '"': '"', - "'": ''', - '`': '`' + "'": ''' }; /** Detect free variable `global` from Node.js. */ @@ -183,17 +182,6 @@ */ var escapeHtmlChar = basePropertyOf(htmlEscapes); - /** - * Checks if `value` is a host object in IE < 9. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a host object, else `false`. - */ - function isHostObject() { - return false; - } - /** * Creates a unary function that invokes `func` with its argument transformed. * @@ -414,10 +402,23 @@ var objValue = object[key]; if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || (value === undefined && !(key in object))) { - object[key] = value; + baseAssignValue(object, key, value); } } + /** + * The base implementation of `assignValue` and `assignMergeValue` without + * value checks. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ + function baseAssignValue(object, key, value) { + object[key] = value; + } + /** * The base implementation of `_.create` without support for assigning * properties to the created object. @@ -674,8 +675,8 @@ othTag = objectToString.call(other); othTag = othTag == argsTag ? objectTag : othTag; } - var objIsObj = objTag == objectTag && !isHostObject(object), - othIsObj = othTag == objectTag && !isHostObject(other), + var objIsObj = objTag == objectTag, + othIsObj = othTag == objectTag, isSameTag = objTag == othTag; stack || (stack = []); @@ -832,24 +833,7 @@ * @returns {Function} Returns the new function. */ function baseRest(func, start) { - start = nativeMax(start === undefined ? (func.length - 1) : start, 0); - return function() { - var args = arguments, - index = -1, - length = nativeMax(args.length - start, 0), - array = Array(length); - - while (++index < length) { - array[index] = args[start + index]; - } - index = -1; - var otherArgs = Array(start + 1); - while (++index < start) { - otherArgs[index] = args[index]; - } - otherArgs[start] = array; - return func.apply(this, otherArgs); - }; + return setToString(overRest(func, start, identity), func + ''); } /** @@ -979,6 +963,7 @@ * @returns {Object} Returns `object`. */ function copyObject(source, props, object, customizer) { + var isNew = !object; object || (object = {}); var index = -1, @@ -991,7 +976,14 @@ ? customizer(object[key], source[key], key, object, source) : undefined; - assignValue(object, key, newValue === undefined ? source[key] : newValue); + if (newValue === undefined) { + newValue = source[key]; + } + if (isNew) { + baseAssignValue(object, key, newValue); + } else { + assignValue(object, key, newValue); + } } return object; } @@ -1326,6 +1318,17 @@ return result; } + /** + * A specialized version of `baseRest` which flattens the rest array. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @returns {Function} Returns the new function. + */ + function flatRest(func) { + return setToString(overRest(func, undefined, flatten), func + ''); + } + /** * Checks if `value` is a flattenable `arguments` object or array. * @@ -1356,6 +1359,46 @@ return result; } + /** + * A specialized version of `baseRest` which transforms the rest array. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @param {Function} transform The rest array transform. + * @returns {Function} Returns the new function. + */ + function overRest(func, start, transform) { + start = nativeMax(start === undefined ? (func.length - 1) : start, 0); + return function() { + var args = arguments, + index = -1, + length = nativeMax(args.length - start, 0), + array = Array(length); + + while (++index < length) { + array[index] = args[start + index]; + } + index = -1; + var otherArgs = Array(start + 1); + while (++index < start) { + otherArgs[index] = args[index]; + } + otherArgs[start] = transform(array); + return func.apply(this, otherArgs); + }; + } + + /** + * Sets the `toString` method of `func` to return `string`. + * + * @private + * @param {Function} func The function to modify. + * @param {Function} string The `toString` result. + * @returns {Function} Returns `func`. + */ + var setToString = identity; + /** * Converts `value` to a string key if it's not a string or symbol. * @@ -1409,17 +1452,18 @@ * // => [1] */ function concat() { - var length = arguments.length, - args = Array(length ? length - 1 : 0), + var length = arguments.length; + if (!length) { + return []; + } + var args = Array(length - 1), array = arguments[0], index = length; while (index--) { args[index - 1] = arguments[index]; } - return length - ? arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)) - : []; + return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)); } /** @@ -1905,7 +1949,7 @@ * @see _.forEachRight * @example * - * _([1, 2]).forEach(function(value) { + * _.forEach([1, 2], function(value) { * console.log(value); * }); * // => Logs `1` then `2`. @@ -2099,16 +2143,11 @@ * { 'user': 'barney', 'age': 34 } * ]; * - * _.sortBy(users, function(o) { return o.user; }); + * _.sortBy(users, [function(o) { return o.user; }]); * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] * * _.sortBy(users, ['user', 'age']); * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]] - * - * _.sortBy(users, 'user', function(o) { - * return Math.floor(o.age / 10); - * }); - * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] */ function sortBy(collection, iteratee) { var index = 0; @@ -2212,7 +2251,7 @@ * _.defer(function(text) { * console.log(text); * }, 'deferred'); - * // => Logs 'deferred' after one or more milliseconds. + * // => Logs 'deferred' after one millisecond. */ var defer = baseRest(function(func, args) { return baseDelay(func, 1, args); @@ -2698,7 +2737,7 @@ */ function isObject(value) { var type = typeof value; - return !!value && (type == 'object' || type == 'function'); + return value != null && (type == 'object' || type == 'function'); } /** @@ -2726,7 +2765,7 @@ * // => false */ function isObjectLike(value) { - return !!value && typeof value == 'object'; + return value != null && typeof value == 'object'; } /** @@ -3263,8 +3302,8 @@ * _.pick(object, ['a', 'c']); * // => { 'a': 1, 'c': 3 } */ - var pick = baseRest(function(object, props) { - return object == null ? {} : basePick(object, baseMap(baseFlatten(props, 1), toKey)); + var pick = flatRest(function(object, props) { + return object == null ? {} : basePick(object, baseMap(props, toKey)); }); /** @@ -3337,8 +3376,8 @@ /*------------------------------------------------------------------------*/ /** - * Converts the characters "&", "<", ">", '"', "'", and "\`" in `string` to - * their corresponding HTML entities. + * Converts the characters "&", "<", ">", '"', and "'" in `string` to their + * corresponding HTML entities. * * **Note:** No other characters are escaped. To escape additional * characters use a third-party library like [_he_](https://mths.be/he). @@ -3349,12 +3388,6 @@ * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) * (under "semi-related fun fact") for more details. * - * Backticks are escaped because in IE < 9, they can break out of - * attribute values or HTML comments. See [#59](https://html5sec.org/#59), - * [#102](https://html5sec.org/#102), [#108](https://html5sec.org/#108), and - * [#133](https://html5sec.org/#133) of the - * [HTML5 Security Cheatsheet](https://html5sec.org/) for more details. - * * When working with HTML you should always * [quote attribute values](http://wonko.com/post/html-escaping) to reduce * XSS vectors. diff --git a/core.min.js b/core.min.js index f5c9efaee..2182f73d3 100644 --- a/core.min.js +++ b/core.min.js @@ -3,26 +3,26 @@ * lodash (Custom Build) /license | Underscore.js 1.8.3 underscorejs.org/LICENSE * Build: `lodash core -o ./dist/lodash.core.js` */ -;(function(){function n(n,t){return n.push.apply(n,t),n}function t(n){return function(t){return null==t?Z:t[n]}}function r(n,t,r,e,u){return u(n,function(n,u,o){r=e?(e=false,n):t(r,n,u,o)}),r}function e(n,t){return d(t,function(t){return n[t]})}function u(n){return n instanceof o?n:new o(n)}function o(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t}function i(n,t,r,e){return n===Z||J(n,an[r])&&!ln.call(e,r)?t:n}function c(n){return V(n)?vn(n):{}}function f(n,t,r){if(typeof n!="function")throw new TypeError("Expected a function"); -return setTimeout(function(){n.apply(Z,r)},t)}function a(n,t){var r=true;return jn(n,function(n,e,u){return r=!!t(n,e,u)}),r}function l(n,t,r){for(var e=-1,u=n.length;++et}function y(n,t,r,e,u){return n===t||(null==n||null==t||!V(n)&&!H(t)?n!==n&&t!==t:g(n,t,y,r,e,u))}function g(n,t,r,e,u,o){var i=wn(n),c=wn(t),f="[object Array]",a="[object Array]";i||(f=sn.call(n),f="[object Arguments]"==f?"[object Object]":f),c||(a=sn.call(t),a="[object Arguments]"==a?"[object Object]":a);var l="[object Object]"==f&&true,c="[object Object]"==a&&true,a=f==a;o||(o=[]);var p=On(o,function(t){return t[0]==n; -}),s=On(o,function(n){return n[0]==t});if(p&&s)return p[1]==t;if(o.push([n,t]),o.push([t,n]),a&&!l){if(i)r=B(n,t,r,e,u,o);else n:{switch(f){case"[object Boolean]":case"[object Date]":case"[object Number]":r=J(+n,+t);break n;case"[object Error]":r=n.name==t.name&&n.message==t.message;break n;case"[object RegExp]":case"[object String]":r=n==t+"";break n}r=false}return o.pop(),r}return 2&u||(i=l&&ln.call(n,"__wrapped__"),f=c&&ln.call(t,"__wrapped__"),!i&&!f)?!!a&&(r=R(n,t,r,e,u,o),o.pop(),r):(i=i?n.value():n, -f=f?t.value():t,r=r(i,f,e,u,o),o.pop(),r)}function _(n){return typeof n=="function"?n:null==n?X:(typeof n=="object"?m:t)(n)}function j(n,t){return nt&&(t=-t>u?0:u+t),r=r>u?u:r,0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=Array(u);++ei))return false;for(var c=-1,f=true,a=1&u?[]:Z;++cr?_n(e+r,0):r:0,r=(r||0)-1;for(var u=t===t;++rarguments.length,jn)}function G(n,t){var r;if(typeof t!="function")throw new TypeError("Expected a function");return n=kn(n),function(){return 0<--n&&(r=t.apply(this,arguments)),1>=n&&(t=Z),r}}function J(n,t){return n===t||n!==n&&t!==t}function M(n){ -return H(n)&&P(n)&&ln.call(n,"callee")&&(!bn.call(n,"callee")||"[object Arguments]"==sn.call(n))}function P(n){var t;return(t=null!=n)&&(t=n.length,t=typeof t=="number"&&-1=t),t&&!U(n)}function U(n){return n=V(n)?sn.call(n):"","[object Function]"==n||"[object GeneratorFunction]"==n}function V(n){var t=typeof n;return!!n&&("object"==t||"function"==t)}function H(n){return!!n&&typeof n=="object"}function K(n){return typeof n=="number"||H(n)&&"[object Number]"==sn.call(n)} -function L(n){return typeof n=="string"||!wn(n)&&H(n)&&"[object String]"==sn.call(n)}function Q(n){return typeof n=="string"?n:null==n?"":n+""}function W(n){return n?e(n,Rn(n)):[]}function X(n){return n}function Y(t,r,e){var u=Rn(r),o=v(r,u);null!=e||V(r)&&(o.length||!u.length)||(e=r,r=t,t=this,o=v(r,Rn(r)));var i=!(V(e)&&"chain"in e&&!e.chain),c=U(t);return jn(o,function(e){var u=r[e];t[e]=u,c&&(t.prototype[e]=function(){var r=this.__chain__;if(i||r){var e=t(this.__wrapped__);return(e.__actions__=E(this.__actions__)).push({ -func:u,args:arguments,thisArg:t}),e.__chain__=r,e}return u.apply(t,n([this.value()],arguments))})}),t}var Z,nn=1/0,tn=/[&<>"'`]/g,rn=RegExp(tn.source),en=typeof self=="object"&&self&&self.Object===Object&&self,un=typeof global=="object"&&global&&global.Object===Object&&global||en||Function("return this")(),on=(en=typeof exports=="object"&&exports&&!exports.nodeType&&exports)&&typeof module=="object"&&module&&!module.nodeType&&module,cn=function(n){return function(t){return null==n?Z:n[t]}}({"&":"&", -"<":"<",">":">",'"':""","'":"'","`":"`"}),fn=Array.prototype,an=Object.prototype,ln=an.hasOwnProperty,pn=0,sn=an.toString,hn=un._,vn=Object.create,bn=an.propertyIsEnumerable,yn=un.isFinite,gn=function(n,t){return function(r){return n(t(r))}}(Object.keys,Object),_n=Math.max;o.prototype=c(u.prototype),o.prototype.constructor=o;var jn=function(n,t){return function(r,e){if(null==r)return r;if(!P(r))return n(r,e);for(var u=r.length,o=t?u:-1,i=Object(r);(t?o--:++or&&(r=_n(e+r,0));n:{for(t=_(t),e=n.length,r+=-1;++re||o&&c&&a||!u&&a||!i){r=1;break n}if(!o&&rt}function y(n,t,r,e,u){return n===t||(null==n||null==t||!K(n)&&!L(t)?n!==n&&t!==t:g(n,t,y,r,e,u))}function g(n,t,r,e,u,o){var i=Sn(n),c=Sn(t),f="[object Array]",a="[object Array]";i||(f=vn.call(n),f="[object Arguments]"==f?"[object Object]":f),c||(a=vn.call(t),a="[object Arguments]"==a?"[object Object]":a);var l="[object Object]"==f,c="[object Object]"==a,a=f==a;o||(o=[]);var p=En(o,function(t){return t[0]==n}),s=En(o,function(n){ +return n[0]==t});if(p&&s)return p[1]==t;if(o.push([n,t]),o.push([t,n]),a&&!l){if(i)r=B(n,t,r,e,u,o);else n:{switch(f){case"[object Boolean]":case"[object Date]":case"[object Number]":r=P(+n,+t);break n;case"[object Error]":r=n.name==t.name&&n.message==t.message;break n;case"[object RegExp]":case"[object String]":r=n==t+"";break n}r=false}return o.pop(),r}return 2&u||(i=l&&sn.call(n,"__wrapped__"),f=c&&sn.call(t,"__wrapped__"),!i&&!f)?!!a&&(r=R(n,t,r,e,u,o),o.pop(),r):(i=i?n.value():n,f=f?t.value():t, +r=r(i,f,e,u,o),o.pop(),r)}function _(n){return typeof n=="function"?n:null==n?Z:(typeof n=="object"?m:t)(n)}function j(n,t){return nt&&(t=-t>u?0:u+t),r=r>u?u:r,0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=Array(u);++ei))return false;for(var c=-1,f=true,a=1&u?[]:tn;++cr?dn(e+r,0):r:0,r=(r||0)-1;for(var u=t===t;++rarguments.length,mn)}function M(n,t){ +var r;if(typeof t!="function")throw new TypeError("Expected a function");return n=Tn(n),function(){return 0<--n&&(r=t.apply(this,arguments)),1>=n&&(t=tn),r}}function P(n,t){return n===t||n!==n&&t!==t}function U(n){return L(n)&&V(n)&&sn.call(n,"callee")&&(!gn.call(n,"callee")||"[object Arguments]"==vn.call(n))}function V(n){var t;return(t=null!=n)&&(t=n.length,t=typeof t=="number"&&-1=t),t&&!H(n)}function H(n){return n=K(n)?vn.call(n):"","[object Function]"==n||"[object GeneratorFunction]"==n; +}function K(n){var t=typeof n;return null!=n&&("object"==t||"function"==t)}function L(n){return null!=n&&typeof n=="object"}function Q(n){return typeof n=="number"||L(n)&&"[object Number]"==vn.call(n)}function W(n){return typeof n=="string"||!Sn(n)&&L(n)&&"[object String]"==vn.call(n)}function X(n){return typeof n=="string"?n:null==n?"":n+""}function Y(n){return n?e(n,qn(n)):[]}function Z(n){return n}function nn(t,r,e){var u=qn(r),o=v(r,u);null!=e||K(r)&&(o.length||!u.length)||(e=r,r=t,t=this,o=v(r,qn(r))); +var i=!(K(e)&&"chain"in e&&!e.chain),c=H(t);return mn(o,function(e){var u=r[e];t[e]=u,c&&(t.prototype[e]=function(){var r=this.__chain__;if(i||r){var e=t(this.__wrapped__);return(e.__actions__=E(this.__actions__)).push({func:u,args:arguments,thisArg:t}),e.__chain__=r,e}return u.apply(t,n([this.value()],arguments))})}),t}var tn,rn=1/0,en=/[&<>"'`]/g,un=RegExp(en.source),on=typeof self=="object"&&self&&self.Object===Object&&self,cn=typeof global=="object"&&global&&global.Object===Object&&global||on||Function("return this")(),fn=(on=typeof exports=="object"&&exports&&!exports.nodeType&&exports)&&typeof module=="object"&&module&&!module.nodeType&&module,an=function(n){ +return function(t){return null==n?tn:n[t]}}({"&":"&","<":"<",">":">",'"':""","'":"'"}),ln=Array.prototype,pn=Object.prototype,sn=pn.hasOwnProperty,hn=0,vn=pn.toString,bn=cn._,yn=Object.create,gn=pn.propertyIsEnumerable,_n=cn.isFinite,jn=function(n,t){return function(r){return n(t(r))}}(Object.keys,Object),dn=Math.max;o.prototype=c(u.prototype),o.prototype.constructor=o;var mn=function(n,t){return function(r,e){if(null==r)return r;if(!V(r))return n(r,e);for(var u=r.length,o=t?u:-1,i=Object(r);(t?o--:++or&&(r=dn(e+r,0));n:{for(t=_(t),e=n.length,r+=-1;++re||o&&c&&a||!u&&a||!i){ +r=1;break n}if(!o&&r { '3': 2, '5': 1 } */ var countBy = createAggregator(function(result, value, key) { - hasOwnProperty.call(result, key) ? ++result[key] : (result[key] = 1); + if (hasOwnProperty.call(result, key)) { + ++result[key]; + } else { + baseAssignValue(result, key, 1); + } }); module.exports = countBy; diff --git a/defer.js b/defer.js index 351f630bc..f6d6c6fa6 100644 --- a/defer.js +++ b/defer.js @@ -17,7 +17,7 @@ var baseDelay = require('./_baseDelay'), * _.defer(function(text) { * console.log(text); * }, 'deferred'); - * // => Logs 'deferred' after one or more milliseconds. + * // => Logs 'deferred' after one millisecond. */ var defer = baseRest(function(func, args) { return baseDelay(func, 1, args); diff --git a/difference.js b/difference.js index c18e05785..fa28bb301 100644 --- a/difference.js +++ b/difference.js @@ -6,8 +6,8 @@ var baseDifference = require('./_baseDifference'), /** * Creates an array of `array` values not included in the other given arrays * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. The order of result values is determined by the - * order they occur in the first array. + * for equality comparisons. The order and references of result values are + * determined by the first array. * * **Note:** Unlike `_.pullAll`, this method returns a new array. * diff --git a/differenceBy.js b/differenceBy.js index 16fa097a7..2cd63e7ec 100644 --- a/differenceBy.js +++ b/differenceBy.js @@ -8,8 +8,9 @@ var baseDifference = require('./_baseDifference'), /** * This method is like `_.difference` except that it accepts `iteratee` which * is invoked for each element of `array` and `values` to generate the criterion - * by which they're compared. Result values are chosen from the first array. - * The iteratee is invoked with one argument: (value). + * by which they're compared. The order and references of result values are + * determined by the first array. The iteratee is invoked with one argument: + * (value). * * **Note:** Unlike `_.pullAllBy`, this method returns a new array. * diff --git a/differenceWith.js b/differenceWith.js index 82ecc95fc..c0233f4b9 100644 --- a/differenceWith.js +++ b/differenceWith.js @@ -6,9 +6,9 @@ var baseDifference = require('./_baseDifference'), /** * This method is like `_.difference` except that it accepts `comparator` - * which is invoked to compare elements of `array` to `values`. Result values - * are chosen from the first array. The comparator is invoked with two arguments: - * (arrVal, othVal). + * which is invoked to compare elements of `array` to `values`. The order and + * references of result values are determined by the first array. The comparator + * is invoked with two arguments: (arrVal, othVal). * * **Note:** Unlike `_.pullAllWith`, this method returns a new array. * diff --git a/escape.js b/escape.js index 176417c4c..a0e77e25e 100644 --- a/escape.js +++ b/escape.js @@ -6,8 +6,8 @@ var reUnescapedHtml = /[&<>"'`]/g, reHasUnescapedHtml = RegExp(reUnescapedHtml.source); /** - * Converts the characters "&", "<", ">", '"', "'", and "\`" in `string` to - * their corresponding HTML entities. + * Converts the characters "&", "<", ">", '"', and "'" in `string` to their + * corresponding HTML entities. * * **Note:** No other characters are escaped. To escape additional * characters use a third-party library like [_he_](https://mths.be/he). @@ -18,12 +18,6 @@ var reUnescapedHtml = /[&<>"'`]/g, * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) * (under "semi-related fun fact") for more details. * - * Backticks are escaped because in IE < 9, they can break out of - * attribute values or HTML comments. See [#59](https://html5sec.org/#59), - * [#102](https://html5sec.org/#102), [#108](https://html5sec.org/#108), and - * [#133](https://html5sec.org/#133) of the - * [HTML5 Security Cheatsheet](https://html5sec.org/) for more details. - * * When working with HTML you should always * [quote attribute values](http://wonko.com/post/html-escaping) to reduce * XSS vectors. diff --git a/forEach.js b/forEach.js index 143515ffe..0ce879f93 100644 --- a/forEach.js +++ b/forEach.js @@ -23,7 +23,7 @@ var arrayEach = require('./_arrayEach'), * @see _.forEachRight * @example * - * _([1, 2]).forEach(function(value) { + * _.forEach([1, 2], function(value) { * console.log(value); * }); * // => Logs `1` then `2`. diff --git a/fp/_mapping.js b/fp/_mapping.js index dd4abcb55..7fa8e672e 100644 --- a/fp/_mapping.js +++ b/fp/_mapping.js @@ -108,9 +108,10 @@ exports.aryMethod = { 'includesFrom', 'indexOfFrom', 'inRange', 'intersectionBy', 'intersectionWith', 'invokeArgs', 'invokeArgsMap', 'isEqualWith', 'isMatchWith', 'flatMapDepth', 'lastIndexOfFrom', 'mergeWith', 'orderBy', 'padChars', 'padCharsEnd', - 'padCharsStart', 'pullAllBy', 'pullAllWith', 'reduce', 'reduceRight', 'replace', - 'set', 'slice', 'sortedIndexBy', 'sortedLastIndexBy', 'transform', 'unionBy', - 'unionWith', 'update', 'xorBy', 'xorWith', 'zipWith' + 'padCharsStart', 'pullAllBy', 'pullAllWith', 'rangeStep', 'rangeStepRight', + 'reduce', 'reduceRight', 'replace', 'set', 'slice', 'sortedIndexBy', + 'sortedLastIndexBy', 'transform', 'unionBy', 'unionWith', 'update', 'xorBy', + 'xorWith', 'zipWith' ], '4': [ 'fill', 'setWith', 'updateWith' @@ -189,6 +190,8 @@ exports.methodRearg = { 'padCharsStart': [2, 1, 0], 'pullAllBy': [2, 1, 0], 'pullAllWith': [2, 1, 0], + 'rangeStep': [1, 2, 0], + 'rangeStepRight': [1, 2, 0], 'setWith': [3, 1, 2, 0], 'sortedIndexBy': [2, 1, 0], 'sortedLastIndexBy': [2, 1, 0], @@ -310,6 +313,8 @@ exports.remap = { 'padCharsEnd': 'padEnd', 'padCharsStart': 'padStart', 'propertyOf': 'get', + 'rangeStep': 'range', + 'rangeStepRight': 'rangeRight', 'restFrom': 'rest', 'spreadFrom': 'spread', 'trimChars': 'trim', diff --git a/fp/rangeStep.js b/fp/rangeStep.js new file mode 100644 index 000000000..d72dfc200 --- /dev/null +++ b/fp/rangeStep.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('rangeStep', require('../range')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/fp/rangeStepRight.js b/fp/rangeStepRight.js new file mode 100644 index 000000000..8b2a67bc6 --- /dev/null +++ b/fp/rangeStepRight.js @@ -0,0 +1,5 @@ +var convert = require('./convert'), + func = convert('rangeStepRight', require('../rangeRight')); + +func.placeholder = require('./placeholder'); +module.exports = func; diff --git a/groupBy.js b/groupBy.js index 3a7dbaf43..5b73b4104 100644 --- a/groupBy.js +++ b/groupBy.js @@ -1,4 +1,5 @@ -var createAggregator = require('./_createAggregator'); +var baseAssignValue = require('./_baseAssignValue'), + createAggregator = require('./_createAggregator'); /** Used for built-in method references. */ var objectProto = Object.prototype; @@ -34,7 +35,7 @@ var groupBy = createAggregator(function(result, value, key) { if (hasOwnProperty.call(result, key)) { result[key].push(value); } else { - result[key] = [value]; + baseAssignValue(result, key, [value]); } }); diff --git a/intersection.js b/intersection.js index b56d4dd32..a94c13512 100644 --- a/intersection.js +++ b/intersection.js @@ -6,8 +6,8 @@ var arrayMap = require('./_arrayMap'), /** * Creates an array of unique values that are included in all given arrays * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. The order of result values is determined by the - * order they occur in the first array. + * for equality comparisons. The order and references of result values are + * determined by the first array. * * @static * @memberOf _ diff --git a/intersectionBy.js b/intersectionBy.js index 436c28646..31461aae5 100644 --- a/intersectionBy.js +++ b/intersectionBy.js @@ -8,8 +8,9 @@ var arrayMap = require('./_arrayMap'), /** * This method is like `_.intersection` except that it accepts `iteratee` * which is invoked for each element of each `arrays` to generate the criterion - * by which they're compared. Result values are chosen from the first array. - * The iteratee is invoked with one argument: (value). + * by which they're compared. The order and references of result values are + * determined by the first array. The iteratee is invoked with one argument: + * (value). * * @static * @memberOf _ diff --git a/intersectionWith.js b/intersectionWith.js index 736eca26a..0ba2f9a61 100644 --- a/intersectionWith.js +++ b/intersectionWith.js @@ -6,9 +6,9 @@ var arrayMap = require('./_arrayMap'), /** * This method is like `_.intersection` except that it accepts `comparator` - * which is invoked to compare elements of `arrays`. Result values are chosen - * from the first array. The comparator is invoked with two arguments: - * (arrVal, othVal). + * which is invoked to compare elements of `arrays`. The order and references + * of result values are determined by the first array. The comparator is + * invoked with two arguments: (arrVal, othVal). * * @static * @memberOf _ diff --git a/isElement.js b/isElement.js index 62cdb062e..0c151a475 100644 --- a/isElement.js +++ b/isElement.js @@ -19,7 +19,7 @@ var isObjectLike = require('./isObjectLike'), * // => false */ function isElement(value) { - return !!value && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value); + return value != null && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value); } module.exports = isElement; diff --git a/isEmpty.js b/isEmpty.js index 726ac9871..4bee45502 100644 --- a/isEmpty.js +++ b/isEmpty.js @@ -16,12 +16,6 @@ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; -/** Built-in value references. */ -var propertyIsEnumerable = objectProto.propertyIsEnumerable; - -/** Detect if properties shadowing those on `Object.prototype` are non-enumerable. */ -var nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf'); - /** * Checks if `value` is an empty object, collection, map, or set. * @@ -65,7 +59,7 @@ function isEmpty(value) { if (tag == mapTag || tag == setTag) { return !value.size; } - if (nonEnumShadows || isPrototype(value)) { + if (isPrototype(value)) { return !nativeKeys(value).length; } for (var key in value) { diff --git a/isObject.js b/isObject.js index 4f96dd0a2..1dc893918 100644 --- a/isObject.js +++ b/isObject.js @@ -25,7 +25,7 @@ */ function isObject(value) { var type = typeof value; - return !!value && (type == 'object' || type == 'function'); + return value != null && (type == 'object' || type == 'function'); } module.exports = isObject; diff --git a/isObjectLike.js b/isObjectLike.js index e34114be5..301716b5a 100644 --- a/isObjectLike.js +++ b/isObjectLike.js @@ -23,7 +23,7 @@ * // => false */ function isObjectLike(value) { - return !!value && typeof value == 'object'; + return value != null && typeof value == 'object'; } module.exports = isObjectLike; diff --git a/isPlainObject.js b/isPlainObject.js index 3ac962c7f..035fbb2a1 100644 --- a/isPlainObject.js +++ b/isPlainObject.js @@ -1,5 +1,4 @@ var getPrototype = require('./_getPrototype'), - isHostObject = require('./_isHostObject'), isObjectLike = require('./isObjectLike'); /** `Object#toString` result references. */ @@ -54,8 +53,7 @@ var objectToString = objectProto.toString; * // => true */ function isPlainObject(value) { - if (!isObjectLike(value) || - objectToString.call(value) != objectTag || isHostObject(value)) { + if (!isObjectLike(value) || objectToString.call(value) != objectTag) { return false; } var proto = getPrototype(value); diff --git a/keyBy.js b/keyBy.js index 44393bf57..d0047a5f2 100644 --- a/keyBy.js +++ b/keyBy.js @@ -1,4 +1,5 @@ -var createAggregator = require('./_createAggregator'); +var baseAssignValue = require('./_baseAssignValue'), + createAggregator = require('./_createAggregator'); /** * Creates an object composed of keys generated from the results of running @@ -30,7 +31,7 @@ var createAggregator = require('./_createAggregator'); * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } */ var keyBy = createAggregator(function(result, value, key) { - result[key] = value; + baseAssignValue(result, key, value); }); module.exports = keyBy; diff --git a/lastIndexOf.js b/lastIndexOf.js index c2e2c4112..9201cb9a2 100644 --- a/lastIndexOf.js +++ b/lastIndexOf.js @@ -1,5 +1,6 @@ var baseFindIndex = require('./_baseFindIndex'), baseIsNaN = require('./_baseIsNaN'), + strictLastIndexOf = require('./_strictLastIndexOf'), toInteger = require('./toInteger'); /* Built-in method references for those with the same name as other `lodash` methods. */ @@ -35,21 +36,11 @@ function lastIndexOf(array, value, fromIndex) { var index = length; if (fromIndex !== undefined) { index = toInteger(fromIndex); - index = ( - index < 0 - ? nativeMax(length + index, 0) - : nativeMin(index, length - 1) - ) + 1; + index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); } - if (value !== value) { - return baseFindIndex(array, baseIsNaN, index - 1, true); - } - while (index--) { - if (array[index] === value) { - return index; - } - } - return -1; + return value === value + ? strictLastIndexOf(array, value, index) + : baseFindIndex(array, baseIsNaN, index, true); } module.exports = lastIndexOf; diff --git a/lodash.js b/lodash.js index 6b2525630..100e38839 100644 --- a/lodash.js +++ b/lodash.js @@ -12,7 +12,7 @@ var undefined; /** Used as the semantic version number. */ - var VERSION = '4.15.0'; + var VERSION = '4.16.0'; /** Used as the size to enable large array optimizations. */ var LARGE_ARRAY_SIZE = 200; @@ -23,6 +23,9 @@ /** Used to stand-in for `undefined` hash values. */ var HASH_UNDEFINED = '__lodash_hash_undefined__'; + /** Used as the maximum memoize cache size. */ + var MAX_MEMOIZE_SIZE = 500; + /** Used as the internal argument placeholder. */ var PLACEHOLDER = '__lodash_placeholder__'; @@ -47,7 +50,7 @@ DEFAULT_TRUNC_OMISSION = '...'; /** Used to detect hot functions by number of calls within a span of milliseconds. */ - var HOT_COUNT = 150, + var HOT_COUNT = 500, HOT_SPAN = 16; /** Used to indicate the type of lazy iteratees. */ @@ -164,9 +167,6 @@ /** Used to match `RegExp` flags from their coerced string values. */ var reFlags = /\w*$/; - /** Used to detect hexadecimal string values. */ - var reHasHexPrefix = /^0x/i; - /** Used to detect bad signed hexadecimal string values. */ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; @@ -361,7 +361,7 @@ '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', '\u0132': 'IJ', '\u0133': 'ij', '\u0152': 'Oe', '\u0153': 'oe', - '\u0149': "'n", '\u017f': 'ss' + '\u0149': "'n", '\u017f': 's' }; /** Used to map characters to HTML entities. */ @@ -370,8 +370,7 @@ '<': '<', '>': '>', '"': '"', - "'": ''', - '`': '`' + "'": ''' }; /** Used to map HTML entities to characters. */ @@ -380,8 +379,7 @@ '<': '<', '>': '>', '"': '"', - ''': "'", - '`': '`' + ''': "'" }; /** Used to escape characters for inclusion in compiled string literals. */ @@ -822,18 +820,9 @@ * @returns {number} Returns the index of the matched value, else `-1`. */ function baseIndexOf(array, value, fromIndex) { - if (value !== value) { - return baseFindIndex(array, baseIsNaN, fromIndex); - } - var index = fromIndex - 1, - length = array.length; - - while (++index < length) { - if (array[index] === value) { - return index; - } - } - return -1; + return value === value + ? strictIndexOf(array, value, fromIndex) + : baseFindIndex(array, baseIsNaN, fromIndex); } /** @@ -1038,7 +1027,7 @@ } /** - * Checks if a cache value for `key` exists. + * Checks if a `cache` value for `key` exists. * * @private * @param {Object} cache The cache to query. @@ -1096,7 +1085,7 @@ while (length--) { if (array[length] === placeholder) { - result++; + ++result; } } return result; @@ -1166,25 +1155,6 @@ return reHasUnicodeWord.test(string); } - /** - * Checks if `value` is a host object in IE < 9. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a host object, else `false`. - */ - function isHostObject(value) { - // Many host objects are `Object` objects that can coerce to strings - // despite having improperly defined `toString` methods. - var result = false; - if (value != null && typeof value.toString != 'function') { - try { - result = !!(value + ''); - } catch (e) {} - } - return result; - } - /** * Converts `iterator` to an array. * @@ -1292,6 +1262,48 @@ return result; } + /** + * A specialized version of `_.indexOf` which performs strict equality + * comparisons of values, i.e. `===`. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function strictIndexOf(array, value, fromIndex) { + var index = fromIndex - 1, + length = array.length; + + while (++index < length) { + if (array[index] === value) { + return index; + } + } + return -1; + } + + /** + * A specialized version of `_.lastIndexOf` which performs strict equality + * comparisons of values, i.e. `===`. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function strictLastIndexOf(array, value, fromIndex) { + var index = fromIndex + 1; + while (index--) { + if (array[index] === value) { + return index; + } + } + return index; + } + /** * Gets the number of symbols in `string`. * @@ -1337,7 +1349,7 @@ function unicodeSize(string) { var result = reUnicode.lastIndex = 0; while (reUnicode.test(string)) { - result++; + ++result; } return result; } @@ -1392,13 +1404,6 @@ * lodash.isFunction(lodash.bar); * // => true * - * // Use `context` to stub `Date#getTime` use in `_.now`. - * var stubbed = _.runInContext({ - * 'Date': function() { - * return { 'getTime': stubGetTime }; - * } - * }); - * * // Create a suped-up `defer` in Node.js. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer; */ @@ -1462,6 +1467,7 @@ var Buffer = moduleExports ? context.Buffer : undefined, Symbol = context.Symbol, Uint8Array = context.Uint8Array, + defineProperty = Object.defineProperty, getPrototype = overArg(Object.getPrototypeOf, Object), iteratorSymbol = Symbol ? Symbol.iterator : undefined, objectCreate = Object.create, @@ -1484,6 +1490,7 @@ nativeKeys = overArg(Object.keys, Object), nativeMax = Math.max, nativeMin = Math.min, + nativeNow = Date.now, nativeParseInt = context.parseInt, nativeRandom = Math.random, nativeReverse = arrayProto.reverse; @@ -1494,22 +1501,12 @@ Promise = getNative(context, 'Promise'), Set = getNative(context, 'Set'), WeakMap = getNative(context, 'WeakMap'), - nativeCreate = getNative(Object, 'create'); - - /* Used to set `toString` methods. */ - var defineProperty = (function() { - var func = getNative(Object, 'defineProperty'), - name = getNative.name; - - return (name && name.length > 2) ? func : undefined; - }()); + nativeCreate = getNative(Object, 'create'), + nativeDefineProperty = getNative(Object, 'defineProperty'); /** Used to store function metadata. */ var metaMap = WeakMap && new WeakMap; - /** Detect if properties shadowing those on `Object.prototype` are non-enumerable. */ - var nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf'); - /** Used to lookup unminified function names. */ var realNames = {}; @@ -1897,6 +1894,7 @@ */ function hashClear() { this.__data__ = nativeCreate ? nativeCreate(null) : {}; + this.size = 0; } /** @@ -1910,7 +1908,9 @@ * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function hashDelete(key) { - return this.has(key) && delete this.__data__[key]; + var result = this.has(key) && delete this.__data__[key]; + this.size -= result ? 1 : 0; + return result; } /** @@ -1957,6 +1957,7 @@ */ function hashSet(key, value) { var data = this.__data__; + this.size += this.has(key) ? 0 : 1; data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; return this; } @@ -1997,6 +1998,7 @@ */ function listCacheClear() { this.__data__ = []; + this.size = 0; } /** @@ -2021,6 +2023,7 @@ } else { splice.call(data, index, 1); } + --this.size; return true; } @@ -2068,6 +2071,7 @@ index = assocIndexOf(data, key); if (index < 0) { + ++this.size; data.push([key, value]); } else { data[index][1] = value; @@ -2110,6 +2114,7 @@ * @memberOf MapCache */ function mapCacheClear() { + this.size = 0; this.__data__ = { 'hash': new Hash, 'map': new (Map || ListCache), @@ -2127,7 +2132,9 @@ * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function mapCacheDelete(key) { - return getMapData(this, key)['delete'](key); + var result = getMapData(this, key)['delete'](key); + this.size -= result ? 1 : 0; + return result; } /** @@ -2167,7 +2174,11 @@ * @returns {Object} Returns the map cache instance. */ function mapCacheSet(key, value) { - getMapData(this, key).set(key, value); + var data = getMapData(this, key), + size = data.size; + + data.set(key, value); + this.size += data.size == size ? 0 : 1; return this; } @@ -2240,7 +2251,8 @@ * @param {Array} [entries] The key-value pairs to cache. */ function Stack(entries) { - this.__data__ = new ListCache(entries); + var data = this.__data__ = new ListCache(entries); + this.size = data.size; } /** @@ -2252,6 +2264,7 @@ */ function stackClear() { this.__data__ = new ListCache; + this.size = 0; } /** @@ -2264,7 +2277,11 @@ * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function stackDelete(key) { - return this.__data__['delete'](key); + var data = this.__data__, + result = data['delete'](key); + + this.size = data.size; + return result; } /** @@ -2304,16 +2321,18 @@ * @returns {Object} Returns the stack cache instance. */ function stackSet(key, value) { - var cache = this.__data__; - if (cache instanceof ListCache) { - var pairs = cache.__data__; + var data = this.__data__; + if (data instanceof ListCache) { + var pairs = data.__data__; if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { pairs.push([key, value]); + this.size = ++data.size; return this; } - cache = this.__data__ = new MapCache(pairs); + data = this.__data__ = new MapCache(pairs); } - cache.set(key, value); + data.set(key, value); + this.size = data.size; return this; } @@ -2353,6 +2372,44 @@ return result; } + /** + * A specialized version of `_.sample` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} array The array to sample. + * @returns {*} Returns the random element. + */ + function arraySample(array) { + var length = array.length; + return length ? array[baseRandom(0, length - 1)] : undefined; + } + + /** + * A specialized version of `_.sampleSize` for arrays. + * + * @private + * @param {Array} array The array to sample. + * @param {number} n The number of elements to sample. + * @returns {Array} Returns the random elements. + */ + function arraySampleSize(array, n) { + var result = arrayShuffle(array); + result.length = baseClamp(n, 0, result.length); + return result; + } + + /** + * A specialized version of `_.shuffle` for arrays. + * + * @private + * @param {Array} array The array to shuffle. + * @returns {Array} Returns the new shuffled array. + */ + function arrayShuffle(array) { + return shuffleSelf(copyArray(array)); + } + /** * Used by `_.defaults` to customize its `_.assignIn` use. * @@ -2383,7 +2440,7 @@ function assignMergeValue(object, key, value) { if ((value !== undefined && !eq(object[key], value)) || (typeof key == 'number' && value === undefined && !(key in object))) { - object[key] = value; + baseAssignValue(object, key, value); } } @@ -2401,7 +2458,7 @@ var objValue = object[key]; if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || (value === undefined && !(key in object))) { - object[key] = value; + baseAssignValue(object, key, value); } } @@ -2454,6 +2511,28 @@ return object && copyObject(source, keys(source), object); } + /** + * The base implementation of `assignValue` and `assignMergeValue` without + * value checks. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ + function baseAssignValue(object, key, value) { + if (key == '__proto__' && defineProperty) { + defineProperty(object, key, { + 'configurable': true, + 'enumerable': true, + 'value': value, + 'writable': true + }); + } else { + object[key] = value; + } + } + /** * The base implementation of `_.at` without support for individual paths. * @@ -2534,9 +2613,6 @@ return cloneBuffer(value, isDeep); } if (tag == objectTag || tag == argsTag || (isFunc && !object)) { - if (isHostObject(value)) { - return object ? value : {}; - } result = initCloneObject(isFunc ? {} : value); if (!isDeep) { return copySymbols(value, baseAssign(result, value)); @@ -3180,8 +3256,8 @@ othTag = getTag(other); othTag = othTag == argsTag ? objectTag : othTag; } - var objIsObj = objTag == objectTag && !isHostObject(object), - othIsObj = othTag == objectTag && !isHostObject(other), + var objIsObj = objTag == objectTag, + othIsObj = othTag == objectTag, isSameTag = objTag == othTag; if (isSameTag && !objIsObj) { @@ -3286,7 +3362,7 @@ if (!isObject(value) || isMasked(value)) { return false; } - var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; + var pattern = isFunction(value) ? reIsNative : reIsHostCtor; return pattern.test(toSource(value)); } @@ -3644,7 +3720,7 @@ value = object[key]; if (predicate(value, key)) { - result[key] = value; + baseAssignValue(result, key, value); } } return result; @@ -3810,24 +3886,7 @@ * @returns {Function} Returns the new function. */ function baseRest(func, start) { - start = nativeMax(start === undefined ? (func.length - 1) : start, 0); - return function() { - var args = arguments, - index = -1, - length = nativeMax(args.length - start, 0), - array = Array(length); - - while (++index < length) { - array[index] = args[start + index]; - } - index = -1; - var otherArgs = Array(start + 1); - while (++index < start) { - otherArgs[index] = args[index]; - } - otherArgs[start] = array; - return apply(func, this, otherArgs); - }; + return setToString(overRest(func, start, identity), func + ''); } /** @@ -3871,7 +3930,7 @@ } /** - * The base implementation of `setData` without support for hot loop detection. + * The base implementation of `setData` without support for hot loop shorting. * * @private * @param {Function} func The function to associate metadata with. @@ -3883,6 +3942,23 @@ return func; }; + /** + * The base implementation of `setToString` without support for hot loop shorting. + * + * @private + * @param {Function} func The function to modify. + * @param {Function} string The `toString` result. + * @returns {Function} Returns `func`. + */ + var baseSetToString = !nativeDefineProperty ? identity : function(func, string) { + return nativeDefineProperty(func, 'toString', { + 'configurable': true, + 'enumerable': false, + 'value': constant(string), + 'writable': true + }); + }; + /** * The base implementation of `_.slice` without an iteratee call guard. * @@ -4297,6 +4373,17 @@ return isArray(value) ? value : stringToPath(value); } + /** + * A `baseRest` alias which can be replaced with `identity` by module + * replacement plugins. + * + * @private + * @type {Function} + * @param {Function} func The function to apply a rest parameter to. + * @returns {Function} Returns the new function. + */ + var castRest = baseRest; + /** * Casts `array` to a slice if it's needed. * @@ -4611,6 +4698,7 @@ * @returns {Object} Returns `object`. */ function copyObject(source, props, object, customizer) { + var isNew = !object; object || (object = {}); var index = -1, @@ -4623,7 +4711,14 @@ ? customizer(object[key], source[key], key, object, source) : undefined; - assignValue(object, key, newValue === undefined ? source[key] : newValue); + if (newValue === undefined) { + newValue = source[key]; + } + if (isNew) { + baseAssignValue(object, key, newValue); + } else { + assignValue(object, key, newValue); + } } return object; } @@ -4902,9 +4997,7 @@ * @returns {Function} Returns the new flow function. */ function createFlow(fromRight) { - return baseRest(function(funcs) { - funcs = baseFlatten(funcs, 1); - + return flatRest(function(funcs) { var length = funcs.length, index = length, prereq = LodashWrapper.prototype.thru; @@ -5087,11 +5180,8 @@ * @returns {Function} Returns the new over function. */ function createOver(arrayFunc) { - return baseRest(function(iteratees) { - iteratees = (iteratees.length == 1 && isArray(iteratees[0])) - ? arrayMap(iteratees[0], baseUnary(getIteratee())) - : arrayMap(baseFlatten(iteratees, 1), baseUnary(getIteratee())); - + return flatRest(function(iteratees) { + iteratees = arrayMap(iteratees, baseUnary(getIteratee())); return baseRest(function(args) { var thisArg = this; return arrayFunc(iteratees, function(iteratee) { @@ -5434,9 +5524,9 @@ // Recursively compare arrays (susceptible to call stack limits). if (seen) { if (!arraySome(other, function(othValue, othIndex) { - if (!seen.has(othIndex) && + if (!cacheHas(seen, othIndex) && (arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) { - return seen.add(othIndex); + return seen.push(othIndex); } })) { result = false; @@ -5616,6 +5706,17 @@ return result; } + /** + * A specialized version of `baseRest` which flattens the rest array. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @returns {Function} Returns the new function. + */ + function flatRest(func) { + return setToString(overRest(func, undefined, flatten), func + ''); + } + /** * Creates an array of own enumerable property names and symbols of `object`. * @@ -5784,8 +5885,7 @@ */ var getTag = baseGetTag; - // Fallback for data views, maps, sets, and weak maps in IE 11, - // for data views in Edge < 14, and promises in Node.js. + // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || (Map && getTag(new Map) != mapTag) || (Promise && getTag(Promise.resolve()) != promiseTag) || @@ -5861,9 +5961,9 @@ function hasPath(object, path, hasFunc) { path = isKey(path, object) ? [path] : castPath(path); - var result, - index = -1, - length = path.length; + var index = -1, + length = path.length, + result = false; while (++index < length) { var key = toKey(path[index]); @@ -5872,10 +5972,10 @@ } object = object[key]; } - if (result) { + if (result || ++index != length) { return result; } - var length = object ? object.length : 0; + length = object ? object.length : 0; return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object)); } @@ -5970,9 +6070,11 @@ * @returns {string} Returns the modified source. */ function insertWrapDetails(source, details) { - var length = details.length, - lastIndex = length - 1; - + var length = details.length; + if (!length) { + return source; + } + var lastIndex = length - 1; details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex]; details = details.join(length > 2 ? ', ' : ' '); return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n'); @@ -6151,6 +6253,26 @@ }; } + /** + * A specialized version of `_.memoize` which clears the memoized function's + * cache when it exceeds `MAX_MEMOIZE_SIZE`. + * + * @private + * @param {Function} func The function to have its output memoized. + * @returns {Function} Returns the new memoized function. + */ + function memoizeCapped(func) { + var result = memoize(func, function(key) { + if (cache.size === MAX_MEMOIZE_SIZE) { + cache.clear(); + } + return key; + }); + + var cache = result.cache; + return result; + } + /** * Merges the function metadata of `source` into `data`. * @@ -6264,6 +6386,36 @@ return result; } + /** + * A specialized version of `baseRest` which transforms the rest array. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @param {Function} transform The rest array transform. + * @returns {Function} Returns the new function. + */ + function overRest(func, start, transform) { + start = nativeMax(start === undefined ? (func.length - 1) : start, 0); + return function() { + var args = arguments, + index = -1, + length = nativeMax(args.length - start, 0), + array = Array(length); + + while (++index < length) { + array[index] = args[start + index]; + } + index = -1; + var otherArgs = Array(start + 1); + while (++index < start) { + otherArgs[index] = args[index]; + } + otherArgs[start] = transform(array); + return apply(func, this, otherArgs); + }; + } + /** * Gets the parent value at `path` of `object`. * @@ -6312,25 +6464,7 @@ * @param {*} data The metadata. * @returns {Function} Returns `func`. */ - var setData = (function() { - var count = 0, - lastCalled = 0; - - return function(key, value) { - var stamp = now(), - remaining = HOT_SPAN - (stamp - lastCalled); - - lastCalled = stamp; - if (remaining > 0) { - if (++count >= HOT_COUNT) { - return key; - } - } else { - count = 0; - } - return baseSetData(key, value); - }; - }()); + var setData = shortOut(baseSetData); /** * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout). @@ -6344,6 +6478,16 @@ return root.setTimeout(func, wait); }; + /** + * Sets the `toString` method of `func` to return `string`. + * + * @private + * @param {Function} func The function to modify. + * @param {Function} string The `toString` result. + * @returns {Function} Returns `func`. + */ + var setToString = shortOut(baseSetToString); + /** * Sets the `toString` method of `wrapper` to mimic the source of `reference` * with wrapper details in a comment at the top of the source body. @@ -6354,14 +6498,61 @@ * @param {number} bitmask The bitmask flags. See `createWrap` for more details. * @returns {Function} Returns `wrapper`. */ - var setWrapToString = !defineProperty ? identity : function(wrapper, reference, bitmask) { + function setWrapToString(wrapper, reference, bitmask) { var source = (reference + ''); - return defineProperty(wrapper, 'toString', { - 'configurable': true, - 'enumerable': false, - 'value': constant(insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))) - }); - }; + return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))); + } + + /** + * Creates a function that'll short out and invoke `identity` instead + * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN` + * milliseconds. + * + * @private + * @param {Function} func The function to restrict. + * @returns {Function} Returns the new shortable function. + */ + function shortOut(func) { + var count = 0, + lastCalled = 0; + + return function() { + var stamp = nativeNow(), + remaining = HOT_SPAN - (stamp - lastCalled); + + lastCalled = stamp; + if (remaining > 0) { + if (++count >= HOT_COUNT) { + return arguments[0]; + } + } else { + count = 0; + } + return func.apply(undefined, arguments); + }; + } + + /** + * A specialized version of `arrayShuffle` which mutates `array`. + * + * @private + * @param {Array} array The array to shuffle. + * @returns {Array} Returns `array`. + */ + function shuffleSelf(array) { + var index = -1, + length = array.length, + lastIndex = length - 1; + + while (++index < length) { + var rand = baseRandom(index, lastIndex), + value = array[rand]; + + array[rand] = array[index]; + array[index] = value; + } + return array; + } /** * Converts `string` to a property path array. @@ -6370,7 +6561,7 @@ * @param {string} string The string to convert. * @returns {Array} Returns the property path array. */ - var stringToPath = memoize(function(string) { + var stringToPath = memoizeCapped(function(string) { string = toString(string); var result = []; @@ -6549,24 +6740,25 @@ * // => [1] */ function concat() { - var length = arguments.length, - args = Array(length ? length - 1 : 0), + var length = arguments.length; + if (!length) { + return []; + } + var args = Array(length - 1), array = arguments[0], index = length; while (index--) { args[index - 1] = arguments[index]; } - return length - ? arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)) - : []; + return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)); } /** * Creates an array of `array` values not included in the other given arrays * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. The order of result values is determined by the - * order they occur in the first array. + * for equality comparisons. The order and references of result values are + * determined by the first array. * * **Note:** Unlike `_.pullAll`, this method returns a new array. * @@ -6592,8 +6784,9 @@ /** * This method is like `_.difference` except that it accepts `iteratee` which * is invoked for each element of `array` and `values` to generate the criterion - * by which they're compared. Result values are chosen from the first array. - * The iteratee is invoked with one argument: (value). + * by which they're compared. The order and references of result values are + * determined by the first array. The iteratee is invoked with one argument: + * (value). * * **Note:** Unlike `_.pullAllBy`, this method returns a new array. * @@ -6626,9 +6819,9 @@ /** * This method is like `_.difference` except that it accepts `comparator` - * which is invoked to compare elements of `array` to `values`. Result values - * are chosen from the first array. The comparator is invoked with two arguments: - * (arrVal, othVal). + * which is invoked to compare elements of `array` to `values`. The order and + * references of result values are determined by the first array. The comparator + * is invoked with two arguments: (arrVal, othVal). * * **Note:** Unlike `_.pullAllWith`, this method returns a new array. * @@ -7122,8 +7315,8 @@ /** * Creates an array of unique values that are included in all given arrays * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. The order of result values is determined by the - * order they occur in the first array. + * for equality comparisons. The order and references of result values are + * determined by the first array. * * @static * @memberOf _ @@ -7146,8 +7339,9 @@ /** * This method is like `_.intersection` except that it accepts `iteratee` * which is invoked for each element of each `arrays` to generate the criterion - * by which they're compared. Result values are chosen from the first array. - * The iteratee is invoked with one argument: (value). + * by which they're compared. The order and references of result values are + * determined by the first array. The iteratee is invoked with one argument: + * (value). * * @static * @memberOf _ @@ -7181,9 +7375,9 @@ /** * This method is like `_.intersection` except that it accepts `comparator` - * which is invoked to compare elements of `arrays`. Result values are chosen - * from the first array. The comparator is invoked with two arguments: - * (arrVal, othVal). + * which is invoked to compare elements of `arrays`. The order and references + * of result values are determined by the first array. The comparator is + * invoked with two arguments: (arrVal, othVal). * * @static * @memberOf _ @@ -7281,21 +7475,11 @@ var index = length; if (fromIndex !== undefined) { index = toInteger(fromIndex); - index = ( - index < 0 - ? nativeMax(length + index, 0) - : nativeMin(index, length - 1) - ) + 1; + index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); } - if (value !== value) { - return baseFindIndex(array, baseIsNaN, index - 1, true); - } - while (index--) { - if (array[index] === value) { - return index; - } - } - return -1; + return value === value + ? strictLastIndexOf(array, value, index) + : baseFindIndex(array, baseIsNaN, index, true); } /** @@ -7457,9 +7641,7 @@ * console.log(pulled); * // => ['b', 'd'] */ - var pullAt = baseRest(function(array, indexes) { - indexes = baseFlatten(indexes, 1); - + var pullAt = flatRest(function(array, indexes) { var length = array ? array.length : 0, result = baseAt(array, indexes); @@ -8034,8 +8216,9 @@ /** * Creates a duplicate-free version of an array, using * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons, in which only the first occurrence of each - * element is kept. + * for equality comparisons, in which only the first occurrence of each element + * is kept. The order of result values is determined by the order they occur + * in the array. * * @static * @memberOf _ @@ -8057,7 +8240,9 @@ /** * This method is like `_.uniq` except that it accepts `iteratee` which is * invoked for each element in `array` to generate the criterion by which - * uniqueness is computed. The iteratee is invoked with one argument: (value). + * uniqueness is computed. The order of result values is determined by the + * order they occur in the array. The iteratee is invoked with one argument: + * (value). * * @static * @memberOf _ @@ -8084,8 +8269,9 @@ /** * This method is like `_.uniq` except that it accepts `comparator` which - * is invoked to compare elements of `array`. The comparator is invoked with - * two arguments: (arrVal, othVal). + * is invoked to compare elements of `array`. The order of result values is + * determined by the order they occur in the array.The comparator is invoked + * with two arguments: (arrVal, othVal). * * @static * @memberOf _ @@ -8227,8 +8413,9 @@ /** * This method is like `_.xor` except that it accepts `iteratee` which is * invoked for each element of each `arrays` to generate the criterion by - * which by which they're compared. The iteratee is invoked with one argument: - * (value). + * which by which they're compared. The order of result values is determined + * by the order they occur in the arrays. The iteratee is invoked with one + * argument: (value). * * @static * @memberOf _ @@ -8257,8 +8444,9 @@ /** * This method is like `_.xor` except that it accepts `comparator` which is - * invoked to compare elements of `arrays`. The comparator is invoked with - * two arguments: (arrVal, othVal). + * invoked to compare elements of `arrays`. The order of result values is + * determined by the order they occur in the arrays. The comparator is invoked + * with two arguments: (arrVal, othVal). * * @static * @memberOf _ @@ -8475,8 +8663,7 @@ * _(object).at(['a[0].b.c', 'a[1]']).value(); * // => [3, 4] */ - var wrapperAt = baseRest(function(paths) { - paths = baseFlatten(paths, 1); + var wrapperAt = flatRest(function(paths) { var length = paths.length, start = length ? paths[0] : 0, value = this.__wrapped__, @@ -8741,7 +8928,11 @@ * // => { '3': 2, '5': 1 } */ var countBy = createAggregator(function(result, value, key) { - hasOwnProperty.call(result, key) ? ++result[key] : (result[key] = 1); + if (hasOwnProperty.call(result, key)) { + ++result[key]; + } else { + baseAssignValue(result, key, 1); + } }); /** @@ -8996,7 +9187,7 @@ * @see _.forEachRight * @example * - * _([1, 2]).forEach(function(value) { + * _.forEach([1, 2], function(value) { * console.log(value); * }); * // => Logs `1` then `2`. @@ -9064,7 +9255,7 @@ if (hasOwnProperty.call(result, key)) { result[key].push(value); } else { - result[key] = [value]; + baseAssignValue(result, key, [value]); } }); @@ -9177,7 +9368,7 @@ * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } */ var keyBy = createAggregator(function(result, value, key) { - result[key] = value; + baseAssignValue(result, key, value); }); /** @@ -9437,10 +9628,7 @@ * // => 2 */ function sample(collection) { - var array = isArrayLike(collection) ? collection : values(collection), - length = array.length; - - return length > 0 ? array[baseRandom(0, length - 1)] : undefined; + return arraySample(isArrayLike(collection) ? collection : values(collection)); } /** @@ -9464,25 +9652,12 @@ * // => [2, 3, 1] */ function sampleSize(collection, n, guard) { - var index = -1, - result = toArray(collection), - length = result.length, - lastIndex = length - 1; - if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) { n = 1; } else { - n = baseClamp(toInteger(n), 0, length); + n = toInteger(n); } - while (++index < n) { - var rand = baseRandom(index, lastIndex), - value = result[rand]; - - result[rand] = result[index]; - result[index] = value; - } - result.length = n; - return result; + return arraySampleSize(isArrayLike(collection) ? collection : values(collection), n); } /** @@ -9501,7 +9676,10 @@ * // => [4, 1, 3, 2] */ function shuffle(collection) { - return sampleSize(collection, MAX_ARRAY_LENGTH); + return shuffleSelf(isArrayLike(collection) + ? copyArray(collection) + : values(collection) + ); } /** @@ -9606,16 +9784,11 @@ * { 'user': 'barney', 'age': 34 } * ]; * - * _.sortBy(users, function(o) { return o.user; }); + * _.sortBy(users, [function(o) { return o.user; }]); * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] * * _.sortBy(users, ['user', 'age']); * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]] - * - * _.sortBy(users, 'user', function(o) { - * return Math.floor(o.age / 10); - * }); - * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] */ var sortBy = baseRest(function(collection, iteratees) { if (collection == null) { @@ -10130,7 +10303,7 @@ * _.defer(function(text) { * console.log(text); * }, 'deferred'); - * // => Logs 'deferred' after one or more milliseconds. + * // => Logs 'deferred' after one millisecond. */ var defer = baseRest(function(func, args) { return baseDelay(func, 1, args); @@ -10238,14 +10411,14 @@ return cache.get(key); } var result = func.apply(this, args); - memoized.cache = cache.set(key, result); + memoized.cache = cache.set(key, result) || cache; return result; }; memoized.cache = new (memoize.Cache || MapCache); return memoized; } - // Assign cache to `_.memoize`. + // Expose `MapCache`. memoize.Cache = MapCache; /** @@ -10337,7 +10510,7 @@ * func(10, 5); * // => [100, 10] */ - var overArgs = baseRest(function(func, transforms) { + var overArgs = castRest(function(func, transforms) { transforms = (transforms.length == 1 && isArray(transforms[0])) ? arrayMap(transforms[0], baseUnary(getIteratee())) : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee())); @@ -10451,8 +10624,8 @@ * rearged('b', 'c', 'a') * // => ['a', 'b', 'c'] */ - var rearg = baseRest(function(func, indexes) { - return createWrap(func, REARG_FLAG, undefined, undefined, undefined, baseFlatten(indexes, 1)); + var rearg = flatRest(function(func, indexes) { + return createWrap(func, REARG_FLAG, undefined, undefined, undefined, indexes); }); /** @@ -11128,7 +11301,7 @@ * // => false */ function isElement(value) { - return !!value && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value); + return value != null && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value); } /** @@ -11174,7 +11347,7 @@ if (tag == mapTag || tag == setTag) { return !value.size; } - if (nonEnumShadows || isPrototype(value)) { + if (isPrototype(value)) { return !nativeKeys(value).length; } for (var key in value) { @@ -11423,7 +11596,7 @@ */ function isObject(value) { var type = typeof value; - return !!value && (type == 'object' || type == 'function'); + return value != null && (type == 'object' || type == 'function'); } /** @@ -11451,7 +11624,7 @@ * // => false */ function isObjectLike(value) { - return !!value && typeof value == 'object'; + return value != null && typeof value == 'object'; } /** @@ -11715,8 +11888,7 @@ * // => true */ function isPlainObject(value) { - if (!isObjectLike(value) || - objectToString.call(value) != objectTag || isHostObject(value)) { + if (!isObjectLike(value) || objectToString.call(value) != objectTag) { return false; } var proto = getPrototype(value); @@ -12273,7 +12445,7 @@ * // => { 'a': 1, 'c': 3 } */ var assign = createAssigner(function(object, source) { - if (nonEnumShadows || isPrototype(source) || isArrayLike(source)) { + if (isPrototype(source) || isArrayLike(source)) { copyObject(source, keys(source), object); return; } @@ -12401,9 +12573,7 @@ * _.at(object, ['a[0].b.c', 'a[1]']); * // => [3, 4] */ - var at = baseRest(function(object, paths) { - return baseAt(object, baseFlatten(paths, 1)); - }); + var at = flatRest(baseAt); /** * Creates an object that inherits from the `prototype` object. If a @@ -13006,7 +13176,7 @@ iteratee = getIteratee(iteratee, 3); baseForOwn(object, function(value, key, object) { - result[iteratee(value, key, object)] = value; + baseAssignValue(result, iteratee(value, key, object), value); }); return result; } @@ -13044,7 +13214,7 @@ iteratee = getIteratee(iteratee, 3); baseForOwn(object, function(value, key, object) { - result[key] = iteratee(value, key, object); + baseAssignValue(result, key, iteratee(value, key, object)); }); return result; } @@ -13088,7 +13258,7 @@ * This method is like `_.merge` except that it accepts `customizer` which * is invoked to produce the merged values of the destination and source * properties. If `customizer` returns `undefined`, merging is handled by the - * method instead. The `customizer` is invoked with seven arguments: + * method instead. The `customizer` is invoked with six arguments: * (objValue, srcValue, key, object, source, stack). * * **Note:** This method mutates `object`. @@ -13138,11 +13308,11 @@ * _.omit(object, ['a', 'c']); * // => { 'b': '2' } */ - var omit = baseRest(function(object, props) { + var omit = flatRest(function(object, props) { if (object == null) { return {}; } - props = arrayMap(baseFlatten(props, 1), toKey); + props = arrayMap(props, toKey); return basePick(object, baseDifference(getAllKeysIn(object), props)); }); @@ -13187,8 +13357,8 @@ * _.pick(object, ['a', 'c']); * // => { 'a': 1, 'c': 3 } */ - var pick = baseRest(function(object, props) { - return object == null ? {} : basePick(object, arrayMap(baseFlatten(props, 1), toKey)); + var pick = flatRest(function(object, props) { + return object == null ? {} : basePick(object, arrayMap(props, toKey)); }); /** @@ -13842,8 +14012,8 @@ } /** - * Converts the characters "&", "<", ">", '"', "'", and "\`" in `string` to - * their corresponding HTML entities. + * Converts the characters "&", "<", ">", '"', and "'" in `string` to their + * corresponding HTML entities. * * **Note:** No other characters are escaped. To escape additional * characters use a third-party library like [_he_](https://mths.be/he). @@ -13854,12 +14024,6 @@ * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) * (under "semi-related fun fact") for more details. * - * Backticks are escaped because in IE < 9, they can break out of - * attribute values or HTML comments. See [#59](https://html5sec.org/#59), - * [#102](https://html5sec.org/#102), [#108](https://html5sec.org/#108), and - * [#133](https://html5sec.org/#133) of the - * [HTML5 Security Cheatsheet](https://html5sec.org/) for more details. - * * When working with HTML you should always * [quote attribute values](http://wonko.com/post/html-escaping) to reduce * XSS vectors. @@ -14102,15 +14266,12 @@ * // => [6, 8, 10] */ function parseInt(string, radix, guard) { - // Chrome fails to trim leading whitespace characters. - // See https://bugs.chromium.org/p/v8/issues/detail?id=3109 for more details. if (guard || radix == null) { radix = 0; } else if (radix) { radix = +radix; } - string = toString(string).replace(reTrim, ''); - return nativeParseInt(string, radix || (reHasHexPrefix.test(string) ? 16 : 10)); + return nativeParseInt(toString(string), radix || 0); } /** @@ -14349,7 +14510,8 @@ * compiled({ 'user': 'barney' }); * // => 'hello barney!' * - * // Use the ES delimiter as an alternative to the default "interpolate" delimiter. + * // Use the ES template literal delimiter as an "interpolate" delimiter. + * // Disable support by replacing the "interpolate" delimiter. * var compiled = _.template('hello ${ user }!'); * compiled({ 'user': 'pebbles' }); * // => 'hello pebbles!' @@ -14750,7 +14912,7 @@ /** * The inverse of `_.escape`; this method converts the HTML entities - * `&`, `<`, `>`, `"`, `'`, and ``` in `string` to + * `&`, `<`, `>`, `"`, and `'` in `string` to * their corresponding characters. * * **Note:** No other HTML entities are unescaped. To unescape additional @@ -14904,10 +15066,10 @@ * jQuery(element).on('click', view.click); * // => Logs 'clicked docs' when clicked. */ - var bindAll = baseRest(function(object, methodNames) { - arrayEach(baseFlatten(methodNames, 1), function(key) { + var bindAll = flatRest(function(object, methodNames) { + arrayEach(methodNames, function(key) { key = toKey(key); - object[key] = bind(object[key], object); + baseAssignValue(object, key, bind(object[key], object)); }); return object; }); diff --git a/lodash.min.js b/lodash.min.js index 867ecf2a3..1168cf78b 100644 --- a/lodash.min.js +++ b/lodash.min.js @@ -2,131 +2,131 @@ * @license * lodash lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE */ -;(function(){function t(t,n){return t.set(n[0],n[1]),t}function n(t,n){return t.add(n),t}function r(t,n,r){switch(r.length){case 0:return t.call(n);case 1:return t.call(n,r[0]);case 2:return t.call(n,r[0],r[1]);case 3:return t.call(n,r[0],r[1],r[2])}return t.apply(n,r)}function e(t,n,r,e){for(var u=-1,o=t?t.length:0;++u=n?t:n)),t}function gn(t,n,r,e,o,i,f){var c;if(e&&(c=i?e(t,o,i,f):e(t)),c!==P)return c;if(!uu(t))return t;if(o=Fi(t)){if(c=he(t),!n)return Wr(t,c)}else{var a=St(t),l="[object Function]"==a||"[object GeneratorFunction]"==a;if(Pi(t))return Er(t,n);if("[object Object]"==a||"[object Arguments]"==a||l&&!i){ -if(C(t))return i?t:{};if(c=pe(l?{}:t),!n)return Lr(t,pn(c,t))}else{if(!Tt[a])return i?t:{};c=_e(t,a,gn,n)}}if(f||(f=new Gt),i=f.get(t))return i;if(f.set(t,c),!o)var s=r?Rn(t,bu,Ho):bu(t);return u(s||t,function(u,o){s&&(o=u,u=t[o]),ln(c,o,gn(u,n,r,e,o,t,f))}),c}function dn(t){var n=bu(t);return function(r){return yn(r,t,n)}}function yn(t,n,r){var e=r.length;if(null==t)return!e;for(t=Tu(t);e--;){var u=r[e],o=n[u],i=t[u];if(i===P&&!(u in t)||!o(i))return false}return true}function bn(t){return uu(t)?oo(t):{}; -}function xn(t,n,r){if(typeof t!="function")throw new Nu("Expected a function");return ni(function(){t.apply(P,r)},n)}function jn(t,n,r,e){var u=-1,o=c,i=true,f=t.length,s=[],h=n.length;if(!f)return s;r&&(n=l(n,S(r))),e?(o=a,i=false):200<=n.length&&(o=R,i=false,n=new Kt(n));t:for(;++un}function Bn(t,n){return null!=t&&Gu.call(t,n)}function Ln(t,n){return null!=t&&n in Tu(t)}function Cn(t,n,r){for(var e=r?a:c,u=t[0].length,o=t.length,i=o,f=Cu(o),s=1/0,h=[];i--;){var p=t[i];i&&n&&(p=l(p,S(n))),s=jo(p.length,s),f[i]=!r&&(n||120<=u&&120<=p.length)?new Kt(i&&p):P}var p=t[0],_=-1,v=f[0];t:for(;++_n?r:0,ge(n,r)?t[n]:P}function nr(t,n,r){var e=-1;return n=l(n.length?n:[Ou],S(fe())),t=Yn(t,function(t){return{a:l(n,function(n){return n(t)}),b:++e,c:t -}}),A(t,function(t,n){var e;t:{e=-1;for(var u=t.a,o=n.a,i=u.length,f=r.length;++e=f?c:c*("desc"==r[e]?-1:1);break t}}e=t.b-n.b}return e})}function rr(t,n){return t=Tu(t),er(t,n,function(n,r){return r in t})}function er(t,n,r){for(var e=-1,u=n.length,o={};++en||9007199254740991n&&(n=-n>u?0:u+n),r=r>u?u:r,0>r&&(r+=u),u=n>r?0:r-n>>>0,n>>>=0,r=Cu(u);++e=u){for(;e>>1,i=t[o];null!==i&&!au(i)&&(r?i<=n:i=e?t:sr(t,n,r)}function Er(t,n){if(n)return t.slice();var r=new t.constructor(t.length);return t.copy(r),r}function Or(t){var n=new t.constructor(t.byteLength);return new ro(n).set(new ro(t)),n}function Sr(t,n){if(t!==n){var r=t!==P,e=null===t,u=t===t,o=au(t),i=n!==P,f=null===n,c=n===n,a=au(n);if(!f&&!a&&!o&&t>n||o&&i&&c&&!f&&!a||e&&i&&c||!r&&c||!u)return 1;if(!e&&!o&&!a&&tu?P:o,u=1),n=Tu(n);++ei&&f[0]!==a&&f[i-1]!==a?[]:z(f,a),i-=c.length,ir?r?cr(n,t):n:(r=cr(n,ho(t/$(n))), -Ut.test(n)?kr(F(r),0,t).join(""):r.slice(0,t))}function Yr(t,n,e,u){function o(){for(var n=-1,c=arguments.length,a=-1,l=u.length,s=Cu(l+c),h=this&&this!==Vt&&this instanceof o?f:t;++an||e)&&(1&t&&(o[2]=h[2],n|=1&r?0:4), -(r=h[3])&&(e=o[3],o[3]=e?Ir(e,r,h[4]):r,o[4]=e?z(o[3],"__lodash_placeholder__"):h[4]),(r=h[5])&&(e=o[5],o[5]=e?Rr(e,r,h[6]):r,o[6]=e?z(o[5],"__lodash_placeholder__"):h[6]),(r=h[7])&&(o[7]=r),128&t&&(o[8]=null==o[8]?h[8]:jo(o[8],h[8])),null==o[9]&&(o[9]=h[9]),o[0]=h[0],o[1]=n),t=o[0],n=o[1],r=o[2],e=o[3],u=o[4],f=o[9]=null==o[9]?c?0:t.length:xo(o[9]-a,0),!f&&24&n&&(n&=-25),ri((h?Ko:ti)(n&&1!=n?8==n||16==n?Nr(t,n,f):32!=n&&33!=n||u.length?qr.apply(P,o):Yr(t,n,r,e):Dr(t,n,r),o),t,n)}function ee(t,n,r,e,u,o){ -var i=2&u,f=t.length,c=n.length;if(f!=c&&!(i&&c>f))return false;if((c=o.get(t))&&o.get(n))return c==n;var c=-1,a=true,l=1&u?new Kt:P;for(o.set(t,n),o.set(n,t);++cr&&(r=xo(e+r,0)),g(t,fe(n,3),r)):-1}function Ie(t,n,r){var e=t?t.length:0;if(!e)return-1;var u=e-1;return r!==P&&(u=hu(r),u=0>r?xo(e+u,0):jo(u,e-1)),g(t,fe(n,3),u,true)}function Re(t){return t&&t.length?t[0]:P}function We(t){ -var n=t?t.length:0;return n?t[n-1]:P}function Be(t,n){return t&&t.length&&n&&n.length?or(t,n):t}function Le(t){return t?Ao.call(t):t}function Ce(t){if(!t||!t.length)return[];var n=0;return t=f(t,function(t){if(Xe(t))return n=xo(t.length,n),true}),E(n,function(n){return l(t,j(n))})}function Ue(t,n){if(!t||!t.length)return[];var e=Ce(t);return null==n?e:l(e,function(t){return r(n,P,t)})}function Me(t){return t=It(t),t.__chain__=true,t}function ze(t,n){return n(t)}function De(){return this}function Te(t,n){ -return(Fi(t)?u:Po)(t,fe(n,3))}function $e(t,n){return(Fi(t)?o:Zo)(t,fe(n,3))}function Fe(t,n){return(Fi(t)?l:Yn)(t,fe(n,3))}function Ne(t,n,r){var e=-1,u=lu(t),o=u.length,i=o-1;for(n=(r?de(t,n,r):n===P)?1:vn(hu(n),0,o);++e=t&&(n=P),r}}function qe(t,n,r){return n=r?P:n,t=re(t,8,P,P,P,P,P,n),t.placeholder=qe.placeholder,t}function Ve(t,n,r){return n=r?P:n,t=re(t,16,P,P,P,P,P,n),t.placeholder=Ve.placeholder,t}function Ke(t,n,r){function e(n){var r=c,e=a;return c=a=P,_=n,s=t.apply(e,r)}function u(t){var r=t-p;return t-=_,p===P||r>=n||0>r||g&&t>=l}function o(){var t=Ri();if(u(t))return i(t);var r,e=ni;r=t-_,t=n-(t-p),r=g?jo(t,l-r):t,h=e(o,r)}function i(t){return h=P,d&&c?e(t):(c=a=P,s)}function f(){var t=Ri(),r=u(t);if(c=arguments, -a=this,p=t,r){if(h===P)return _=t=p,h=ni(o,n),v?e(t):s;if(g)return h=ni(o,n),e(p)}return h===P&&(h=ni(o,n)),s}var c,a,l,s,h,p,_=0,v=false,g=false,d=true;if(typeof t!="function")throw new Nu("Expected a function");return n=_u(n)||0,uu(r)&&(v=!!r.leading,l=(g="maxWait"in r)?xo(_u(r.maxWait)||0,n):l,d="trailing"in r?!!r.trailing:d),f.cancel=function(){h!==P&&Go(h),_=0,c=p=a=h=P},f.flush=function(){return h===P?s:i(Ri())},f}function Ge(t,n){function r(){var e=arguments,u=n?n.apply(this,e):e[0],o=r.cache;return o.has(u)?o.get(u):(e=t.apply(this,e), -r.cache=o.set(u,e),e)}if(typeof t!="function"||n&&typeof n!="function")throw new Nu("Expected a function");return r.cache=new(Ge.Cache||qt),r}function Je(t){if(typeof t!="function")throw new Nu("Expected a function");return function(){var n=arguments;switch(n.length){case 0:return!t.call(this);case 1:return!t.call(this,n[0]);case 2:return!t.call(this,n[0],n[1]);case 3:return!t.call(this,n[0],n[1],n[2])}return!t.apply(this,n)}}function Ye(t,n){return t===n||t!==t&&n!==n}function He(t){return Xe(t)&&Gu.call(t,"callee")&&(!io.call(t,"callee")||"[object Arguments]"==Hu.call(t)); -}function Qe(t){return null!=t&&eu(t.length)&&!nu(t)}function Xe(t){return ou(t)&&Qe(t)}function tu(t){return!!ou(t)&&("[object Error]"==Hu.call(t)||typeof t.message=="string"&&typeof t.name=="string")}function nu(t){return t=uu(t)?Hu.call(t):"","[object Function]"==t||"[object GeneratorFunction]"==t}function ru(t){return typeof t=="number"&&t==hu(t)}function eu(t){return typeof t=="number"&&-1=t}function uu(t){var n=typeof t;return!!t&&("object"==n||"function"==n)}function ou(t){ -return!!t&&typeof t=="object"}function iu(t){return typeof t=="number"||ou(t)&&"[object Number]"==Hu.call(t)}function fu(t){return!(!ou(t)||"[object Object]"!=Hu.call(t)||C(t))&&(t=eo(t),null===t||(t=Gu.call(t,"constructor")&&t.constructor,typeof t=="function"&&t instanceof t&&Ku.call(t)==Yu))}function cu(t){return typeof t=="string"||!Fi(t)&&ou(t)&&"[object String]"==Hu.call(t)}function au(t){return typeof t=="symbol"||ou(t)&&"[object Symbol]"==Hu.call(t)}function lu(t){if(!t)return[];if(Qe(t))return cu(t)?F(t):Wr(t); -if(uo&&t[uo]){t=t[uo]();for(var n,r=[];!(n=t.next()).done;)r.push(n.value);return r}return n=St(t),("[object Map]"==n?U:"[object Set]"==n?D:wu)(t)}function su(t){return t?(t=_u(t),t===Z||t===-Z?1.7976931348623157e308*(0>t?-1:1):t===t?t:0):0===t?t:0}function hu(t){t=su(t);var n=t%1;return t===t?n?t-n:t:0}function pu(t){return t?vn(hu(t),0,4294967295):0}function _u(t){if(typeof t=="number")return t;if(au(t))return q;if(uu(t)&&(t=typeof t.valueOf=="function"?t.valueOf():t,t=uu(t)?t+"":t),typeof t!="string")return 0===t?t:+t; -t=t.replace(at,"");var n=jt.test(t);return n||mt.test(t)?Pt(t.slice(2),n?2:8):xt.test(t)?q:+t}function vu(t){return Br(t,xu(t))}function gu(t){return null==t?"":dr(t)}function du(t,n,r){return t=null==t?P:In(t,n),t===P?r:t}function yu(t,n){return null!=t&&se(t,n,Ln)}function bu(t){return Qe(t)?Yt(t):Kn(t)}function xu(t){return Qe(t)?Yt(t,true):Gn(t)}function ju(t,n){return null==t?{}:er(t,Rn(t,xu,Qo),fe(n))}function wu(t){return t?I(t,bu(t)):[]}function mu(t){return jf(gu(t).toLowerCase())}function Au(t){ -return(t=gu(t))&&t.replace(kt,un).replace(Bt,"")}function ku(t,n,r){return t=gu(t),n=r?P:n,n===P?Mt.test(t)?t.match(Ct)||[]:t.match(vt)||[]:t.match(n)||[]}function Eu(t){return function(){return t}}function Ou(t){return t}function Su(t){return Vn(typeof t=="function"?t:gn(t,true))}function Iu(t,n,r){var e=bu(n),o=Sn(n,e);null!=r||uu(n)&&(o.length||!e.length)||(r=n,n=t,t=this,o=Sn(n,bu(n)));var i=!(uu(r)&&"chain"in r&&!r.chain),f=nu(t);return u(o,function(r){var e=n[r];t[r]=e,f&&(t.prototype[r]=function(){ -var n=this.__chain__;if(i||n){var r=t(this.__wrapped__);return(r.__actions__=Wr(this.__actions__)).push({func:e,args:arguments,thisArg:t}),r.__chain__=n,r}return e.apply(t,s([this.value()],arguments))})}),t}function Ru(){}function Wu(t){return ye(t)?j(Ae(t)):ur(t)}function Bu(){return[]}function Lu(){return false}w=w?cn.defaults(Vt.Object(),w,cn.pick(Vt,zt)):Vt;var Cu=w.Array,Uu=w.Date,Mu=w.Error,zu=w.Function,Du=w.Math,Tu=w.Object,$u=w.RegExp,Fu=w.String,Nu=w.TypeError,Pu=Cu.prototype,Zu=Tu.prototype,qu=w["__core-js_shared__"],Vu=function(){ -var t=/[^.]+$/.exec(qu&&qu.keys&&qu.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),Ku=zu.prototype.toString,Gu=Zu.hasOwnProperty,Ju=0,Yu=Ku.call(Tu),Hu=Zu.toString,Qu=Vt._,Xu=$u("^"+Ku.call(Gu).replace(ft,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),to=Jt?w.Buffer:P,no=w.Symbol,ro=w.Uint8Array,eo=M(Tu.getPrototypeOf,Tu),uo=no?no.iterator:P,oo=Tu.create,io=Zu.propertyIsEnumerable,fo=Pu.splice,co=no?no.isConcatSpreadable:P,ao=w.clearTimeout!==Vt.clearTimeout&&w.clearTimeout,lo=Uu&&Uu.now!==Vt.Date.now&&Uu.now,so=w.setTimeout!==Vt.setTimeout&&w.setTimeout,ho=Du.ceil,po=Du.floor,_o=Tu.getOwnPropertySymbols,vo=to?to.isBuffer:P,go=w.isFinite,yo=Pu.join,bo=M(Tu.keys,Tu),xo=Du.max,jo=Du.min,wo=w.parseInt,mo=Du.random,Ao=Pu.reverse,ko=le(w,"DataView"),Eo=le(w,"Map"),Oo=le(w,"Promise"),So=le(w,"Set"),Io=le(w,"WeakMap"),Ro=le(Tu,"create"),Wo=function(){ -var t=le(Tu,"defineProperty"),n=le.name;return n&&2t)&&(t==n.length-1?n.pop():fo.call(n,t,1),true)},Zt.prototype.get=function(t){var n=this.__data__;return t=sn(n,t),0>t?P:n[t][1]},Zt.prototype.has=function(t){return-1e?r.push([t,n]):r[e][1]=n,this},qt.prototype.clear=function(){this.__data__={hash:new Ft,map:new(Eo||Zt),string:new Ft}},qt.prototype.delete=function(t){return ce(this,t).delete(t)},qt.prototype.get=function(t){return ce(this,t).get(t); -},qt.prototype.has=function(t){return ce(this,t).has(t)},qt.prototype.set=function(t,n){return ce(this,t).set(t,n),this},Kt.prototype.add=Kt.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Kt.prototype.has=function(t){return this.__data__.has(t)},Gt.prototype.clear=function(){this.__data__=new Zt},Gt.prototype.delete=function(t){return this.__data__.delete(t)},Gt.prototype.get=function(t){return this.__data__.get(t)},Gt.prototype.has=function(t){return this.__data__.has(t); -},Gt.prototype.set=function(t,n){var r=this.__data__;if(r instanceof Zt){if(r=r.__data__,!Eo||199>r.length)return r.push([t,n]),this;r=this.__data__=new qt(r)}return r.set(t,n),this};var Po=Mr(En),Zo=Mr(On,true),qo=zr(),Vo=zr(true),Ko=Bo?function(t,n){return Bo.set(t,n),t}:Ou,Go=ao||function(t){return Vt.clearTimeout(t)},Jo=So&&1/D(new So([,-0]))[1]==Z?function(t){return new So(t)}:Ru,Yo=Bo?function(t){return Bo.get(t)}:Ru,Ho=_o?M(_o,Tu):Bu,Qo=_o?function(t){for(var n=[];t;)s(n,Ho(t)),t=eo(t);return n; -}:Bu;(ko&&"[object DataView]"!=St(new ko(new ArrayBuffer(1)))||Eo&&"[object Map]"!=St(new Eo)||Oo&&"[object Promise]"!=St(Oo.resolve())||So&&"[object Set]"!=St(new So)||Io&&"[object WeakMap]"!=St(new Io))&&(St=function(t){var n=Hu.call(t);if(t=(t="[object Object]"==n?t.constructor:P)?ke(t):P)switch(t){case Uo:return"[object DataView]";case Mo:return"[object Map]";case zo:return"[object Promise]";case Do:return"[object Set]";case To:return"[object WeakMap]"}return n});var Xo=qu?nu:Lu,ti=function(){ -var t=0,n=0;return function(r,e){var u=Ri(),o=16-(u-n);if(n=u,0=n}),Fi=Cu.isArray,Ni=Ht?S(Ht):zn,Pi=vo||Lu,Zi=Qt?S(Qt):Dn,qi=Xt?S(Xt):$n,Vi=tn?S(tn):Pn,Ki=nn?S(nn):Zn,Gi=rn?S(rn):qn,Ji=Qr(Jn),Yi=Qr(function(t,n){return t<=n}),Hi=Ur(function(t,n){if(Lo||xe(n)||Qe(n))Br(n,bu(n),t);else for(var r in n)Gu.call(n,r)&&ln(t,r,n[r]); -}),Qi=Ur(function(t,n){Br(n,xu(n),t)}),Xi=Ur(function(t,n,r,e){Br(n,xu(n),t,e)}),tf=Ur(function(t,n,r,e){Br(n,bu(n),t,e)}),nf=ar(function(t,n){return _n(t,kn(n,1))}),rf=ar(function(t){return t.push(P,en),r(Xi,P,t)}),ef=ar(function(t){return t.push(P,we),r(af,P,t)}),uf=Vr(function(t,n,r){t[n]=r},Eu(Ou)),of=Vr(function(t,n,r){Gu.call(t,n)?t[n].push(r):t[n]=[r]},fe),ff=ar(Mn),cf=Ur(function(t,n,r){Xn(t,n,r)}),af=Ur(function(t,n,r,e){Xn(t,n,r,e)}),lf=ar(function(t,n){return null==t?{}:(n=l(kn(n,1),Ae), -rr(t,jn(Rn(t,xu,Qo),n)))}),sf=ar(function(t,n){return null==t?{}:rr(t,l(kn(n,1),Ae))}),hf=ne(bu),pf=ne(xu),_f=$r(function(t,n,r){return n=n.toLowerCase(),t+(r?mu(n):n)}),vf=$r(function(t,n,r){return t+(r?"-":"")+n.toLowerCase()}),gf=$r(function(t,n,r){return t+(r?" ":"")+n.toLowerCase()}),df=Tr("toLowerCase"),yf=$r(function(t,n,r){return t+(r?"_":"")+n.toLowerCase()}),bf=$r(function(t,n,r){return t+(r?" ":"")+jf(n)}),xf=$r(function(t,n,r){return t+(r?" ":"")+n.toUpperCase()}),jf=Tr("toUpperCase"),wf=ar(function(t,n){ -try{return r(t,P,n)}catch(t){return tu(t)?t:new Mu(t)}}),mf=ar(function(t,n){return u(kn(n,1),function(n){n=Ae(n),t[n]=Wi(t[n],t)}),t}),Af=Zr(),kf=Zr(true),Ef=ar(function(t,n){return function(r){return Mn(r,t,n)}}),Of=ar(function(t,n){return function(r){return Mn(t,r,n)}}),Sf=Gr(l),If=Gr(i),Rf=Gr(_),Wf=Hr(),Bf=Hr(true),Lf=Kr(function(t,n){return t+n},0),Cf=te("ceil"),Uf=Kr(function(t,n){return t/n},1),Mf=te("floor"),zf=Kr(function(t,n){return t*n},1),Df=te("round"),Tf=Kr(function(t,n){return t-n},0);return It.after=function(t,n){ -if(typeof n!="function")throw new Nu("Expected a function");return t=hu(t),function(){if(1>--t)return n.apply(this,arguments)}},It.ary=Pe,It.assign=Hi,It.assignIn=Qi,It.assignInWith=Xi,It.assignWith=tf,It.at=nf,It.before=Ze,It.bind=Wi,It.bindAll=mf,It.bindKey=Bi,It.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return Fi(t)?t:[t]},It.chain=Me,It.chunk=function(t,n,r){if(n=(r?de(t,n,r):n===P)?1:xo(hu(n),0),r=t?t.length:0,!r||1>n)return[];for(var e=0,u=0,o=Cu(ho(r/n));en?0:n,e)):[]},It.dropRight=function(t,n,r){var e=t?t.length:0;return e?(n=r||n===P?1:hu(n),n=e-n,sr(t,0,0>n?0:n)):[]},It.dropRightWhile=function(t,n){ -return t&&t.length?br(t,fe(n,3),true,true):[]},It.dropWhile=function(t,n){return t&&t.length?br(t,fe(n,3),true):[]},It.fill=function(t,n,r,e){var u=t?t.length:0;if(!u)return[];for(r&&typeof r!="number"&&de(t,n,r)&&(r=0,e=u),u=t.length,r=hu(r),0>r&&(r=-r>u?0:u+r),e=e===P||e>u?u:hu(e),0>e&&(e+=u),e=r>e?0:pu(e);r>>0,r?(t=gu(t))&&(typeof n=="string"||null!=n&&!Vi(n))&&(n=dr(n),!n&&Ut.test(t))?kr(F(t),0,r):t.split(n,r):[]},It.spread=function(t,n){if(typeof t!="function")throw new Nu("Expected a function");return n=n===P?0:xo(hu(n),0),ar(function(e){ -var u=e[n];return e=kr(e,0,n),u&&s(e,u),r(t,this,e)})},It.tail=function(t){var n=t?t.length:0;return n?sr(t,1,n):[]},It.take=function(t,n,r){return t&&t.length?(n=r||n===P?1:hu(n),sr(t,0,0>n?0:n)):[]},It.takeRight=function(t,n,r){var e=t?t.length:0;return e?(n=r||n===P?1:hu(n),n=e-n,sr(t,0>n?0:n,e)):[]},It.takeRightWhile=function(t,n){return t&&t.length?br(t,fe(n,3),false,true):[]},It.takeWhile=function(t,n){return t&&t.length?br(t,fe(n,3)):[]},It.tap=function(t,n){return n(t),t},It.throttle=function(t,n,r){ -var e=true,u=true;if(typeof t!="function")throw new Nu("Expected a function");return uu(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),Ke(t,n,{leading:e,maxWait:n,trailing:u})},It.thru=ze,It.toArray=lu,It.toPairs=hf,It.toPairsIn=pf,It.toPath=function(t){return Fi(t)?l(t,Ae):au(t)?[t]:Wr(ei(t))},It.toPlainObject=vu,It.transform=function(t,n,r){var e=Fi(t)||Gi(t);if(n=fe(n,4),null==r)if(e||uu(t)){var o=t.constructor;r=e?Fi(t)?new o:[]:nu(o)?bn(eo(t)):{}}else r={};return(e?u:En)(t,function(t,e,u){ -return n(r,t,e,u)}),r},It.unary=function(t){return Pe(t,1)},It.union=hi,It.unionBy=pi,It.unionWith=_i,It.uniq=function(t){return t&&t.length?yr(t):[]},It.uniqBy=function(t,n){return t&&t.length?yr(t,fe(n,2)):[]},It.uniqWith=function(t,n){return t&&t.length?yr(t,P,n):[]},It.unset=function(t,n){var r;if(null==t)r=true;else{r=t;var e=n,e=ye(e,r)?[e]:Ar(e);r=me(r,e),e=Ae(We(e)),r=!(null!=r&&Gu.call(r,e))||delete r[e]}return r},It.unzip=Ce,It.unzipWith=Ue,It.update=function(t,n,r){return null==t?t:lr(t,n,(typeof r=="function"?r:Ou)(In(t,n)),void 0); -},It.updateWith=function(t,n,r,e){return e=typeof e=="function"?e:P,null!=t&&(t=lr(t,n,(typeof r=="function"?r:Ou)(In(t,n)),e)),t},It.values=wu,It.valuesIn=function(t){return null==t?[]:I(t,xu(t))},It.without=vi,It.words=ku,It.wrap=function(t,n){return n=null==n?Ou:n,Mi(n,t)},It.xor=gi,It.xorBy=di,It.xorWith=yi,It.zip=bi,It.zipObject=function(t,n){return wr(t||[],n||[],ln)},It.zipObjectDeep=function(t,n){return wr(t||[],n||[],lr)},It.zipWith=xi,It.entries=hf,It.entriesIn=pf,It.extend=Qi,It.extendWith=Xi, -Iu(It,It),It.add=Lf,It.attempt=wf,It.camelCase=_f,It.capitalize=mu,It.ceil=Cf,It.clamp=function(t,n,r){return r===P&&(r=n,n=P),r!==P&&(r=_u(r),r=r===r?r:0),n!==P&&(n=_u(n),n=n===n?n:0),vn(_u(t),n,r)},It.clone=function(t){return gn(t,false,true)},It.cloneDeep=function(t){return gn(t,true,true)},It.cloneDeepWith=function(t,n){return gn(t,true,true,n)},It.cloneWith=function(t,n){return gn(t,false,true,n)},It.conformsTo=function(t,n){return null==n||yn(t,n,bu(n))},It.deburr=Au,It.defaultTo=function(t,n){return null==t||t!==t?n:t; -},It.divide=Uf,It.endsWith=function(t,n,r){t=gu(t),n=dr(n);var e=t.length,e=r=r===P?e:vn(hu(r),0,e);return r-=n.length,0<=r&&t.slice(r,e)==n},It.eq=Ye,It.escape=function(t){return(t=gu(t))&&X.test(t)?t.replace(H,on):t},It.escapeRegExp=function(t){return(t=gu(t))&&ct.test(t)?t.replace(ft,"\\$&"):t},It.every=function(t,n,r){var e=Fi(t)?i:wn;return r&&de(t,n,r)&&(n=P),e(t,fe(n,3))},It.find=mi,It.findIndex=Se,It.findKey=function(t,n){return v(t,fe(n,3),En)},It.findLast=Ai,It.findLastIndex=Ie,It.findLastKey=function(t,n){ -return v(t,fe(n,3),On)},It.floor=Mf,It.forEach=Te,It.forEachRight=$e,It.forIn=function(t,n){return null==t?t:qo(t,fe(n,3),xu)},It.forInRight=function(t,n){return null==t?t:Vo(t,fe(n,3),xu)},It.forOwn=function(t,n){return t&&En(t,fe(n,3))},It.forOwnRight=function(t,n){return t&&On(t,fe(n,3))},It.get=du,It.gt=Ti,It.gte=$i,It.has=function(t,n){return null!=t&&se(t,n,Bn)},It.hasIn=yu,It.head=Re,It.identity=Ou,It.includes=function(t,n,r,e){return t=Qe(t)?t:wu(t),r=r&&!e?hu(r):0,e=t.length,0>r&&(r=xo(e+r,0)), -cu(t)?r<=e&&-1r&&(r=xo(e+r,0)),d(t,n,r)):-1},It.inRange=function(t,n,r){return n=su(n),r===P?(r=n,n=0):r=su(r),t=_u(t),t>=jo(n,r)&&t=t},It.isSet=Ki,It.isString=cu,It.isSymbol=au,It.isTypedArray=Gi,It.isUndefined=function(t){return t===P},It.isWeakMap=function(t){return ou(t)&&"[object WeakMap]"==St(t)},It.isWeakSet=function(t){return ou(t)&&"[object WeakSet]"==Hu.call(t)},It.join=function(t,n){return t?yo.call(t,n):""},It.kebabCase=vf,It.last=We,It.lastIndexOf=function(t,n,r){var e=t?t.length:0;if(!e)return-1;var u=e;if(r!==P&&(u=hu(r), -u=(0>u?xo(e+u,0):jo(u,e-1))+1),n!==n)return g(t,b,u-1,true);for(;u--;)if(t[u]===n)return u;return-1},It.lowerCase=gf,It.lowerFirst=df,It.lt=Ji,It.lte=Yi,It.max=function(t){return t&&t.length?mn(t,Ou,Wn):P},It.maxBy=function(t,n){return t&&t.length?mn(t,fe(n,2),Wn):P},It.mean=function(t){return x(t,Ou)},It.meanBy=function(t,n){return x(t,fe(n,2))},It.min=function(t){return t&&t.length?mn(t,Ou,Jn):P},It.minBy=function(t,n){return t&&t.length?mn(t,fe(n,2),Jn):P},It.stubArray=Bu,It.stubFalse=Lu,It.stubObject=function(){ -return{}},It.stubString=function(){return""},It.stubTrue=function(){return true},It.multiply=zf,It.nth=function(t,n){return t&&t.length?tr(t,hu(n)):P},It.noConflict=function(){return Vt._===this&&(Vt._=Qu),this},It.noop=Ru,It.now=Ri,It.pad=function(t,n,r){t=gu(t);var e=(n=hu(n))?$(t):0;return!n||e>=n?t:(n=(n-e)/2,Jr(po(n),r)+t+Jr(ho(n),r))},It.padEnd=function(t,n,r){t=gu(t);var e=(n=hu(n))?$(t):0;return n&&en){var e=t;t=n,n=e}return r||t%1||n%1?(r=mo(),jo(t+r*(n-t+Nt("1e-"+((r+"").length-1))),n)):fr(t,n)},It.reduce=function(t,n,r){var e=Fi(t)?h:m,u=3>arguments.length;return e(t,fe(n,4),r,u,Po); -},It.reduceRight=function(t,n,r){var e=Fi(t)?p:m,u=3>arguments.length;return e(t,fe(n,4),r,u,Zo)},It.repeat=function(t,n,r){return n=(r?de(t,n,r):n===P)?1:hu(n),cr(gu(t),n)},It.replace=function(){var t=arguments,n=gu(t[0]);return 3>t.length?n:n.replace(t[1],t[2])},It.result=function(t,n,r){n=ye(n,t)?[n]:Ar(n);var e=-1,u=n.length;for(u||(t=P,u=1);++et||9007199254740991=o)return t;if(o=r-$(e),1>o)return e;if(r=i?kr(i,0,o).join(""):t.slice(0,o),u===P)return r+e;if(i&&(o+=r.length-o),Vi(u)){if(t.slice(o).search(u)){var f=r;for(u.global||(u=$u(u.source,gu(yt.exec(u))+"g")), -u.lastIndex=0;i=u.exec(f);)var c=i.index;r=r.slice(0,c===P?o:c)}}else t.indexOf(dr(u),o)!=o&&(u=r.lastIndexOf(u),-1u.__dir__?"Right":"")}),u},$t.prototype[t+"Right"]=function(n){return this.reverse()[t](n).reverse()}}),u(["filter","map","takeWhile"],function(t,n){var r=n+1,e=1==r||3==r;$t.prototype[t]=function(t){var n=this.clone();return n.__iteratees__.push({ -iteratee:fe(t,3),type:r}),n.__filtered__=n.__filtered__||e,n}}),u(["head","last"],function(t,n){var r="take"+(n?"Right":"");$t.prototype[t]=function(){return this[r](1).value()[0]}}),u(["initial","tail"],function(t,n){var r="drop"+(n?"":"Right");$t.prototype[t]=function(){return this.__filtered__?new $t(this):this[r](1)}}),$t.prototype.compact=function(){return this.filter(Ou)},$t.prototype.find=function(t){return this.filter(t).head()},$t.prototype.findLast=function(t){return this.reverse().find(t); -},$t.prototype.invokeMap=ar(function(t,n){return typeof t=="function"?new $t(this):this.map(function(r){return Mn(r,t,n)})}),$t.prototype.reject=function(t){return this.filter(Je(fe(t)))},$t.prototype.slice=function(t,n){t=hu(t);var r=this;return r.__filtered__&&(0n)?new $t(r):(0>t?r=r.takeRight(-t):t&&(r=r.drop(t)),n!==P&&(n=hu(n),r=0>n?r.dropRight(-n):r.take(n-t)),r)},$t.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},$t.prototype.toArray=function(){return this.take(4294967295); -},En($t.prototype,function(t,n){var r=/^(?:filter|find|map|reject)|While$/.test(n),e=/^(?:head|last)$/.test(n),u=It[e?"take"+("last"==n?"Right":""):n],o=e||/^find/.test(n);u&&(It.prototype[n]=function(){function n(t){return t=u.apply(It,s([t],f)),e&&h?t[0]:t}var i=this.__wrapped__,f=e?[1]:arguments,c=i instanceof $t,a=f[0],l=c||Fi(i);l&&r&&typeof a=="function"&&1!=a.length&&(c=l=false);var h=this.__chain__,p=!!this.__actions__.length,a=o&&!h,c=c&&!p;return!o&&l?(i=c?i:new $t(this),i=t.apply(i,f),i.__actions__.push({ -func:ze,args:[n],thisArg:P}),new Lt(i,h)):a&&c?t.apply(this,f):(i=this.thru(n),a?e?i.value()[0]:i.value():i)})}),u("pop push shift sort splice unshift".split(" "),function(t){var n=Pu[t],r=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",e=/^(?:pop|shift)$/.test(t);It.prototype[t]=function(){var t=arguments;if(e&&!this.__chain__){var u=this.value();return n.apply(Fi(u)?u:[],t)}return this[r](function(r){return n.apply(Fi(r)?r:[],t)})}}),En($t.prototype,function(t,n){var r=It[n];if(r){var e=r.name+""; -(Co[e]||(Co[e]=[])).push({name:n,func:r})}}),Co[qr(P,2).name]=[{name:"wrapper",func:P}],$t.prototype.clone=function(){var t=new $t(this.__wrapped__);return t.__actions__=Wr(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Wr(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Wr(this.__views__),t},$t.prototype.reverse=function(){if(this.__filtered__){var t=new $t(this);t.__dir__=-1,t.__filtered__=true}else t=this.clone(),t.__dir__*=-1;return t; -},$t.prototype.value=function(){var t,n=this.__wrapped__.value(),r=this.__dir__,e=Fi(n),u=0>r,o=e?n.length:0;t=o;for(var i=this.__views__,f=0,c=-1,a=i.length;++co||o==t&&a==t)return xr(n,this.__actions__);e=[];t:for(;t--&&c=this.__values__.length,n=t?P:this.__values__[this.__index__++];return{done:t,value:n}},It.prototype.plant=function(t){ -for(var n,r=this;r instanceof Rt;){var e=Oe(r);e.__index__=0,e.__values__=P,n?u.__wrapped__=e:n=e;var u=e,r=r.__wrapped__}return u.__wrapped__=t,n},It.prototype.reverse=function(){var t=this.__wrapped__;return t instanceof $t?(this.__actions__.length&&(t=new $t(this)),t=t.reverse(),t.__actions__.push({func:ze,args:[Le],thisArg:P}),new Lt(t,this.__chain__)):this.thru(Le)},It.prototype.toJSON=It.prototype.valueOf=It.prototype.value=function(){return xr(this.__wrapped__,this.__actions__)},It.prototype.first=It.prototype.head, -uo&&(It.prototype[uo]=De),It}var P,Z=1/0,q=NaN,V=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],K=/\b__p\+='';/g,G=/\b(__p\+=)''\+/g,J=/(__e\(.*?\)|\b__t\))\+'';/g,Y=/&(?:amp|lt|gt|quot|#39|#96);/g,H=/[&<>"'`]/g,Q=RegExp(Y.source),X=RegExp(H.source),tt=/<%-([\s\S]+?)%>/g,nt=/<%([\s\S]+?)%>/g,rt=/<%=([\s\S]+?)%>/g,et=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ut=/^\w*$/,ot=/^\./,it=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ft=/[\\^$.*+?()[\]{}|]/g,ct=RegExp(ft.source),at=/^\s+|\s+$/g,lt=/^\s+/,st=/\s+$/,ht=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,pt=/\{\n\/\* \[wrapped with (.+)\] \*/,_t=/,? & /,vt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,gt=/\\(\\)?/g,dt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,yt=/\w*$/,bt=/^0x/i,xt=/^[-+]0x[0-9a-f]+$/i,jt=/^0b[01]+$/i,wt=/^\[object .+?Constructor\]$/,mt=/^0o[0-7]+$/i,At=/^(?:0|[1-9]\d*)$/,kt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Et=/($^)/,Ot=/['\n\r\u2028\u2029\\]/g,St="[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]|\\ud83c[\\udffb-\\udfff])?(?:\\u200d(?:[^\\ud800-\\udfff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]|\\ud83c[\\udffb-\\udfff])?)*",It="(?:[\\u2700-\\u27bf]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])"+St,Rt="(?:[^\\ud800-\\udfff][\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]?|[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\ud800-\\udfff])",Wt=RegExp("['\u2019]","g"),Bt=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]","g"),Lt=RegExp("\\ud83c[\\udffb-\\udfff](?=\\ud83c[\\udffb-\\udfff])|"+Rt+St,"g"),Ct=RegExp(["[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+(?:['\u2019](?:d|ll|m|re|s|t|ve))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\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]|[A-Z\\xc0-\\xd6\\xd8-\\xde]|$)|(?:[A-Z\\xc0-\\xd6\\xd8-\\xde]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\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\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\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]|[A-Z\\xc0-\\xd6\\xd8-\\xde](?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\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\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])|$)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?(?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\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\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['\u2019](?:d|ll|m|re|s|t|ve))?|[A-Z\\xc0-\\xd6\\xd8-\\xde]+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?|\\d+",It].join("|"),"g"),Ut=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0\\ufe0e\\ufe0f]"),Mt=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,zt="Array Buffer DataView Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Map Math Object Promise RegExp Set String Symbol TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap _ clearTimeout isFinite parseInt setTimeout".split(" "),Dt={}; -Dt["[object Float32Array]"]=Dt["[object Float64Array]"]=Dt["[object Int8Array]"]=Dt["[object Int16Array]"]=Dt["[object Int32Array]"]=Dt["[object Uint8Array]"]=Dt["[object Uint8ClampedArray]"]=Dt["[object Uint16Array]"]=Dt["[object Uint32Array]"]=true,Dt["[object Arguments]"]=Dt["[object Array]"]=Dt["[object ArrayBuffer]"]=Dt["[object Boolean]"]=Dt["[object DataView]"]=Dt["[object Date]"]=Dt["[object Error]"]=Dt["[object Function]"]=Dt["[object Map]"]=Dt["[object Number]"]=Dt["[object Object]"]=Dt["[object RegExp]"]=Dt["[object Set]"]=Dt["[object String]"]=Dt["[object WeakMap]"]=false; -var Tt={};Tt["[object Arguments]"]=Tt["[object Array]"]=Tt["[object ArrayBuffer]"]=Tt["[object DataView]"]=Tt["[object Boolean]"]=Tt["[object Date]"]=Tt["[object Float32Array]"]=Tt["[object Float64Array]"]=Tt["[object Int8Array]"]=Tt["[object Int16Array]"]=Tt["[object Int32Array]"]=Tt["[object Map]"]=Tt["[object Number]"]=Tt["[object Object]"]=Tt["[object RegExp]"]=Tt["[object Set]"]=Tt["[object String]"]=Tt["[object Symbol]"]=Tt["[object Uint8Array]"]=Tt["[object Uint8ClampedArray]"]=Tt["[object Uint16Array]"]=Tt["[object Uint32Array]"]=true, -Tt["[object Error]"]=Tt["[object Function]"]=Tt["[object WeakMap]"]=false;var $t,Ft={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Nt=parseFloat,Pt=parseInt,Zt=typeof global=="object"&&global&&global.Object===Object&&global,qt=typeof self=="object"&&self&&self.Object===Object&&self,Vt=Zt||qt||Function("return this")(),Kt=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Gt=Kt&&typeof module=="object"&&module&&!module.nodeType&&module,Jt=Gt&&Gt.exports===Kt,Yt=Jt&&Zt.g; -t:{try{$t=Yt&&Yt.f("util");break t}catch(t){}$t=void 0}var Ht=$t&&$t.isArrayBuffer,Qt=$t&&$t.isDate,Xt=$t&&$t.isMap,tn=$t&&$t.isRegExp,nn=$t&&$t.isSet,rn=$t&&$t.isTypedArray,en=j("length"),un=w({"\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", +;(function(){function t(t,n){return t.set(n[0],n[1]),t}function n(t,n){return t.add(n),t}function r(t,n,r){switch(r.length){case 0:return t.call(n);case 1:return t.call(n,r[0]);case 2:return t.call(n,r[0],r[1]);case 3:return t.call(n,r[0],r[1],r[2])}return t.apply(n,r)}function e(t,n,r,e){for(var u=-1,i=t?t.length:0;++u=n?t:n)),t}function vn(t,n,r,e,i,o,f){var c;if(e&&(c=o?e(t,i,o,f):e(t)),c!==N)return c;if(!cu(t))return t;if(i=Ko(t)){if(c=he(t),!n)return Rr(t,c)}else{var a=Et(t),l="[object Function]"==a||"[object GeneratorFunction]"==a;if(Jo(t))return kr(t,n);if("[object Object]"==a||"[object Arguments]"==a||l&&!o){ +if(c=pe(l?{}:t),!n)return Wr(t,sn(c,t))}else{if(!Mt[a])return o?t:{};c=_e(t,a,vn,n)}}if(f||(f=new Vt),o=f.get(t))return o;if(f.set(t,c),!i)var s=r?In(t,mu,ro):mu(t);return u(s||t,function(u,i){s&&(i=u,u=t[i]),cn(c,i,vn(u,n,r,e,i,t,f))}),c}function gn(t){var n=mu(t);return function(r){return dn(r,t,n)}}function dn(t,n,r){var e=r.length;if(null==t)return!e;for(t=Pu(t);e--;){var u=r[e],i=n[u],o=t[u];if(o===N&&!(u in t)||!i(o))return false}return true}function yn(t){return cu(t)?li(t):{}}function bn(t,n,r){ +if(typeof t!="function")throw new Vu("Expected a function");return oo(function(){t.apply(N,r)},n)}function xn(t,n,r,e){var u=-1,i=c,o=true,f=t.length,s=[],h=n.length;if(!f)return s;r&&(n=l(n,S(r))),e?(i=a,o=false):200<=n.length&&(i=R,o=false,n=new qt(n));t:for(;++un}function zn(t,n){return null!=t&&Qu.call(t,n)}function Wn(t,n){return null!=t&&n in Pu(t)}function Bn(t,n,r){for(var e=r?a:c,u=t[0].length,i=t.length,o=i,f=Du(i),s=1/0,h=[];o--;){var p=t[o];o&&n&&(p=l(p,S(n))),s=ki(p.length,s),f[o]=!r&&(n||120<=u&&120<=p.length)?new qt(o&&p):N}var p=t[0],_=-1,v=f[0];t:for(;++_n?r:0,ge(n,r)?t[n]:N}function tr(t,n,r){var e=-1;return n=l(n.length?n:[zu],S(fe())),t=Jn(t,function(t){return{a:l(n,function(n){return n(t)}),b:++e,c:t}}),A(t,function(t,n){var e;t:{e=-1;for(var u=t.a,i=n.a,o=u.length,f=r.length;++e=f?c:c*("desc"==r[e]?-1:1);break t}}e=t.b-n.b}return e})}function nr(t,n){return t=Pu(t),rr(t,n,function(n,r){return r in t})}function rr(t,n,r){for(var e=-1,u=n.length,i={};++en||9007199254740991n&&(n=-n>u?0:u+n),r=r>u?u:r,0>r&&(r+=u),u=n>r?0:r-n>>>0,n>>>=0,r=Du(u);++e=u){for(;e>>1,o=t[i];null!==o&&!pu(o)&&(r?o<=n:o=e?t:lr(t,n,r)}function kr(t,n){ +if(n)return t.slice();var r=new t.constructor(t.length);return t.copy(r),r}function Er(t){var n=new t.constructor(t.byteLength);return new oi(n).set(new oi(t)),n}function Or(t,n){if(t!==n){var r=t!==N,e=null===t,u=t===t,i=pu(t),o=n!==N,f=null===n,c=n===n,a=pu(n);if(!f&&!a&&!i&&t>n||i&&o&&c&&!f&&!a||e&&o&&c||!r&&c||!u)return 1;if(!e&&!i&&!a&&tu?N:i,u=1),n=Pu(n);++eo&&f[0]!==a&&f[o-1]!==a?[]:U(f,a),o-=c.length,or?r?fr(n,t):n:(r=fr(n,di(t/T(n))),Bt.test(n)?Ar($(r),0,t).join(""):r.slice(0,t))}function Jr(t,n,e,u){function i(){for(var n=-1,c=arguments.length,a=-1,l=u.length,s=Du(l+c),h=this&&this!==Zt&&this instanceof i?f:t;++an||e)&&(1&t&&(i[2]=h[2],n|=1&r?0:4),(r=h[3])&&(e=i[3],i[3]=e?Sr(e,r,h[4]):r,i[4]=e?U(i[3],"__lodash_placeholder__"):h[4]),(r=h[5])&&(e=i[5],i[5]=e?Ir(e,r,h[6]):r,i[6]=e?U(i[5],"__lodash_placeholder__"):h[6]),(r=h[7])&&(i[7]=r),128&t&&(i[8]=null==i[8]?h[8]:ki(i[8],h[8])), +null==i[9]&&(i[9]=h[9]),i[0]=h[0],i[1]=n),t=i[0],n=i[1],r=i[2],e=i[3],u=i[4],f=i[9]=null==i[9]?c?0:t.length:Ai(i[9]-a,0),!f&&24&n&&(n&=-25),ke((h?Hi:io)(n&&1!=n?8==n||16==n?Fr(t,n,f):32!=n&&33!=n||u.length?Zr.apply(N,i):Jr(t,n,r,e):Mr(t,n,r),i),t,n)}function re(t,n,r,e,u,i){var o=2&u,f=t.length,c=n.length;if(f!=c&&!(o&&c>f))return false;if((c=i.get(t))&&i.get(n))return c==n;var c=-1,a=true,l=1&u?new qt:N;for(i.set(t,n),i.set(n,t);++cr&&(r=Ai(e+r,0)),g(t,fe(n,3),r)):-1}function Be(t,n,r){var e=t?t.length:0;if(!e)return-1;var u=e-1;return r!==N&&(u=gu(r), +u=0>r?Ai(e+u,0):ki(u,e-1)),g(t,fe(n,3),u,true)}function Le(t){return t&&t.length?An(t,1):[]}function Ce(t){return t&&t.length?t[0]:N}function Ue(t){var n=t?t.length:0;return n?t[n-1]:N}function Me(t,n){return t&&t.length&&n&&n.length?ur(t,n):t}function De(t){return t?Ii.call(t):t}function Te(t){if(!t||!t.length)return[];var n=0;return t=f(t,function(t){if(eu(t))return n=Ai(t.length,n),true}),E(n,function(n){return l(t,j(n))})}function $e(t,n){if(!t||!t.length)return[];var e=Te(t);return null==n?e:l(e,function(t){ +return r(n,N,t)})}function Fe(t){return t=Ot(t),t.__chain__=true,t}function Ne(t,n){return n(t)}function Pe(){return this}function Ze(t,n){return(Ko(t)?u:Ki)(t,fe(n,3))}function qe(t,n){return(Ko(t)?i:Gi)(t,fe(n,3))}function Ve(t,n){return(Ko(t)?l:Jn)(t,fe(n,3))}function Ke(t,n,r){return n=r?N:n,n=t&&null==n?t.length:n,ne(t,128,N,N,N,N,n)}function Ge(t,n){var r;if(typeof n!="function")throw new Vu("Expected a function");return t=gu(t),function(){return 0<--t&&(r=n.apply(this,arguments)),1>=t&&(n=N), +r}}function Je(t,n,r){return n=r?N:n,t=ne(t,8,N,N,N,N,N,n),t.placeholder=Je.placeholder,t}function Ye(t,n,r){return n=r?N:n,t=ne(t,16,N,N,N,N,N,n),t.placeholder=Ye.placeholder,t}function He(t,n,r){function e(n){var r=c,e=a;return c=a=N,_=n,s=t.apply(e,r)}function u(t){var r=t-p;return t-=_,p===N||r>=n||0>r||g&&t>=l}function i(){var t=Uo();if(u(t))return o(t);var r,e=oo;r=t-_,t=n-(t-p),r=g?ki(t,l-r):t,h=e(i,r)}function o(t){return h=N,d&&c?e(t):(c=a=N,s)}function f(){var t=Uo(),r=u(t);if(c=arguments, +a=this,p=t,r){if(h===N)return _=t=p,h=oo(i,n),v?e(t):s;if(g)return h=oo(i,n),e(p)}return h===N&&(h=oo(i,n)),s}var c,a,l,s,h,p,_=0,v=false,g=false,d=true;if(typeof t!="function")throw new Vu("Expected a function");return n=yu(n)||0,cu(r)&&(v=!!r.leading,l=(g="maxWait"in r)?Ai(yu(r.maxWait)||0,n):l,d="trailing"in r?!!r.trailing:d),f.cancel=function(){h!==N&&Xi(h),_=0,c=p=a=h=N},f.flush=function(){return h===N?s:o(Uo())},f}function Qe(t,n){function r(){var e=arguments,u=n?n.apply(this,e):e[0],i=r.cache;return i.has(u)?i.get(u):(e=t.apply(this,e), +r.cache=i.set(u,e)||i,e)}if(typeof t!="function"||n&&typeof n!="function")throw new Vu("Expected a function");return r.cache=new(Qe.Cache||Pt),r}function Xe(t){if(typeof t!="function")throw new Vu("Expected a function");return function(){var n=arguments;switch(n.length){case 0:return!t.call(this);case 1:return!t.call(this,n[0]);case 2:return!t.call(this,n[0],n[1]);case 3:return!t.call(this,n[0],n[1],n[2])}return!t.apply(this,n)}}function tu(t,n){return t===n||t!==t&&n!==n}function nu(t){return eu(t)&&Qu.call(t,"callee")&&(!si.call(t,"callee")||"[object Arguments]"==ni.call(t)); +}function ru(t){return null!=t&&fu(t.length)&&!iu(t)}function eu(t){return au(t)&&ru(t)}function uu(t){return!!au(t)&&("[object Error]"==ni.call(t)||typeof t.message=="string"&&typeof t.name=="string")}function iu(t){return t=cu(t)?ni.call(t):"","[object Function]"==t||"[object GeneratorFunction]"==t}function ou(t){return typeof t=="number"&&t==gu(t)}function fu(t){return typeof t=="number"&&-1=t}function cu(t){var n=typeof t;return null!=t&&("object"==n||"function"==n); +}function au(t){return null!=t&&typeof t=="object"}function lu(t){return typeof t=="number"||au(t)&&"[object Number]"==ni.call(t)}function su(t){return!(!au(t)||"[object Object]"!=ni.call(t))&&(t=ci(t),null===t||(t=Qu.call(t,"constructor")&&t.constructor,typeof t=="function"&&t instanceof t&&Hu.call(t)==ti))}function hu(t){return typeof t=="string"||!Ko(t)&&au(t)&&"[object String]"==ni.call(t)}function pu(t){return typeof t=="symbol"||au(t)&&"[object Symbol]"==ni.call(t)}function _u(t){if(!t)return[]; +if(ru(t))return hu(t)?$(t):Rr(t);if(ai&&t[ai]){t=t[ai]();for(var n,r=[];!(n=t.next()).done;)r.push(n.value);return r}return n=Et(t),("[object Map]"==n?L:"[object Set]"==n?M:Eu)(t)}function vu(t){return t?(t=yu(t),t===P||t===-P?1.7976931348623157e308*(0>t?-1:1):t===t?t:0):0===t?t:0}function gu(t){t=vu(t);var n=t%1;return t===t?n?t-n:t:0}function du(t){return t?_n(gu(t),0,4294967295):0}function yu(t){if(typeof t=="number")return t;if(pu(t))return Z;if(cu(t)&&(t=typeof t.valueOf=="function"?t.valueOf():t, +t=cu(t)?t+"":t),typeof t!="string")return 0===t?t:+t;t=t.replace(ct,"");var n=bt.test(t);return n||jt.test(t)?Ft(t.slice(2),n?2:8):yt.test(t)?Z:+t}function bu(t){return zr(t,Au(t))}function xu(t){return null==t?"":gr(t)}function ju(t,n,r){return t=null==t?N:Sn(t,n),t===N?r:t}function wu(t,n){return null!=t&&se(t,n,Wn)}function mu(t){return ru(t)?Gt(t):Vn(t)}function Au(t){return ru(t)?Gt(t,true):Kn(t)}function ku(t,n){return null==t?{}:rr(t,In(t,Au,eo),fe(n))}function Eu(t){return t?I(t,mu(t)):[]}function Ou(t){ +return Of(xu(t).toLowerCase())}function Su(t){return(t=xu(t))&&t.replace(mt,rn).replace(Rt,"")}function Iu(t,n,r){return t=xu(t),n=r?N:n,n===N?Lt.test(t)?t.match(Wt)||[]:t.match(_t)||[]:t.match(n)||[]}function Ru(t){return function(){return t}}function zu(t){return t}function Wu(t){return qn(typeof t=="function"?t:vn(t,true))}function Bu(t,n,r){var e=mu(n),i=On(n,e);null!=r||cu(n)&&(i.length||!e.length)||(r=n,n=t,t=this,i=On(n,mu(n)));var o=!(cu(r)&&"chain"in r&&!r.chain),f=iu(t);return u(i,function(r){ +var e=n[r];t[r]=e,f&&(t.prototype[r]=function(){var n=this.__chain__;if(o||n){var r=t(this.__wrapped__);return(r.__actions__=Rr(this.__actions__)).push({func:e,args:arguments,thisArg:t}),r.__chain__=n,r}return e.apply(t,s([this.value()],arguments))})}),t}function Lu(){}function Cu(t){return ye(t)?j(Se(t)):er(t)}function Uu(){return[]}function Mu(){return false}w=w?on.defaults(Zt.Object(),w,on.pick(Zt,Ct)):Zt;var Du=w.Array,Tu=w.Date,$u=w.Error,Fu=w.Function,Nu=w.Math,Pu=w.Object,Zu=w.RegExp,qu=w.String,Vu=w.TypeError,Ku=Du.prototype,Gu=Pu.prototype,Ju=w["__core-js_shared__"],Yu=function(){ +var t=/[^.]+$/.exec(Ju&&Ju.keys&&Ju.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),Hu=Fu.prototype.toString,Qu=Gu.hasOwnProperty,Xu=0,ti=Hu.call(Pu),ni=Gu.toString,ri=Zt._,ei=Zu("^"+Hu.call(Qu).replace(ot,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ui=Kt?w.Buffer:N,ii=w.Symbol,oi=w.Uint8Array,fi=Pu.defineProperty,ci=C(Pu.getPrototypeOf,Pu),ai=ii?ii.iterator:N,li=Pu.create,si=Gu.propertyIsEnumerable,hi=Ku.splice,pi=ii?ii.isConcatSpreadable:N,_i=w.clearTimeout!==Zt.clearTimeout&&w.clearTimeout,vi=Tu&&Tu.now!==Zt.Date.now&&Tu.now,gi=w.setTimeout!==Zt.setTimeout&&w.setTimeout,di=Nu.ceil,yi=Nu.floor,bi=Pu.getOwnPropertySymbols,xi=ui?ui.isBuffer:N,ji=w.isFinite,wi=Ku.join,mi=C(Pu.keys,Pu),Ai=Nu.max,ki=Nu.min,Ei=Tu.now,Oi=w.parseInt,Si=Nu.random,Ii=Ku.reverse,Ri=le(w,"DataView"),zi=le(w,"Map"),Wi=le(w,"Promise"),Bi=le(w,"Set"),Li=le(w,"WeakMap"),Ci=le(Pu,"create"),Ui=le(Pu,"defineProperty"),Mi=Li&&new Li,Di={},Ti=Ie(Ri),$i=Ie(zi),Fi=Ie(Wi),Ni=Ie(Bi),Pi=Ie(Li),Zi=ii?ii.prototype:N,qi=Zi?Zi.valueOf:N,Vi=Zi?Zi.toString:N; +Ot.templateSettings={escape:X,evaluate:tt,interpolate:nt,variable:"",imports:{_:Ot}},Ot.prototype=St.prototype,Ot.prototype.constructor=Ot,zt.prototype=yn(St.prototype),zt.prototype.constructor=zt,Dt.prototype=yn(St.prototype),Dt.prototype.constructor=Dt,Tt.prototype.clear=function(){this.__data__=Ci?Ci(null):{},this.size=0},Tt.prototype.delete=function(t){return t=this.has(t)&&delete this.__data__[t],this.size-=t?1:0,t},Tt.prototype.get=function(t){var n=this.__data__;return Ci?(t=n[t],"__lodash_hash_undefined__"===t?N:t):Qu.call(n,t)?n[t]:N; +},Tt.prototype.has=function(t){var n=this.__data__;return Ci?n[t]!==N:Qu.call(n,t)},Tt.prototype.set=function(t,n){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=Ci&&n===N?"__lodash_hash_undefined__":n,this},Nt.prototype.clear=function(){this.__data__=[],this.size=0},Nt.prototype.delete=function(t){var n=this.__data__;return t=an(n,t),!(0>t)&&(t==n.length-1?n.pop():hi.call(n,t,1),--this.size,true)},Nt.prototype.get=function(t){var n=this.__data__;return t=an(n,t),0>t?N:n[t][1]},Nt.prototype.has=function(t){ +return-1e?(++this.size,r.push([t,n])):r[e][1]=n,this},Pt.prototype.clear=function(){this.size=0,this.__data__={hash:new Tt,map:new(zi||Nt),string:new Tt}},Pt.prototype.delete=function(t){return t=ce(this,t).delete(t),this.size-=t?1:0,t},Pt.prototype.get=function(t){return ce(this,t).get(t)},Pt.prototype.has=function(t){return ce(this,t).has(t)},Pt.prototype.set=function(t,n){var r=ce(this,t),e=r.size;return r.set(t,n), +this.size+=r.size==e?0:1,this},qt.prototype.add=qt.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},qt.prototype.has=function(t){return this.__data__.has(t)},Vt.prototype.clear=function(){this.__data__=new Nt,this.size=0},Vt.prototype.delete=function(t){var n=this.__data__;return t=n.delete(t),this.size=n.size,t},Vt.prototype.get=function(t){return this.__data__.get(t)},Vt.prototype.has=function(t){return this.__data__.has(t)},Vt.prototype.set=function(t,n){ +var r=this.__data__;if(r instanceof Nt){var e=r.__data__;if(!zi||199>e.length)return e.push([t,n]),this.size=++r.size,this;r=this.__data__=new Pt(e)}return r.set(t,n),this.size=r.size,this};var Ki=Cr(kn),Gi=Cr(En,true),Ji=Ur(),Yi=Ur(true),Hi=Mi?function(t,n){return Mi.set(t,n),t}:zu,Qi=Ui?function(t,n){return Ui(t,"toString",{configurable:true,enumerable:false,value:Ru(n),writable:true})}:zu,Xi=_i||function(t){return Zt.clearTimeout(t)},to=Bi&&1/M(new Bi([,-0]))[1]==P?function(t){return new Bi(t)}:Lu,no=Mi?function(t){ +return Mi.get(t)}:Lu,ro=bi?C(bi,Pu):Uu,eo=bi?function(t){for(var n=[];t;)s(n,ro(t)),t=ci(t);return n}:Uu;(Ri&&"[object DataView]"!=Et(new Ri(new ArrayBuffer(1)))||zi&&"[object Map]"!=Et(new zi)||Wi&&"[object Promise]"!=Et(Wi.resolve())||Bi&&"[object Set]"!=Et(new Bi)||Li&&"[object WeakMap]"!=Et(new Li))&&(Et=function(t){var n=ni.call(t);if(t=(t="[object Object]"==n?t.constructor:N)?Ie(t):N)switch(t){case Ti:return"[object DataView]";case $i:return"[object Map]";case Fi:return"[object Promise]";case Ni: +return"[object Set]";case Pi:return"[object WeakMap]"}return n});var uo=Ju?iu:Mu,io=Ee(Hi),oo=gi||function(t,n){return Zt.setTimeout(t,n)},fo=Ee(Qi),co=function(t){t=Qe(t,function(t){return 500===n.size&&n.clear(),t});var n=t.cache;return t}(function(t){t=xu(t);var n=[];return ut.test(t)&&n.push(""),t.replace(it,function(t,r,e,u){n.push(e?u.replace(vt,"$1"):r||t)}),n}),ao=cr(function(t,n){return eu(t)?xn(t,An(n,1,eu,true)):[]}),lo=cr(function(t,n){var r=Ue(n);return eu(r)&&(r=N),eu(t)?xn(t,An(n,1,eu,true),fe(r,2)):[]; +}),so=cr(function(t,n){var r=Ue(n);return eu(r)&&(r=N),eu(t)?xn(t,An(n,1,eu,true),N,r):[]}),ho=cr(function(t){var n=l(t,wr);return n.length&&n[0]===t[0]?Bn(n):[]}),po=cr(function(t){var n=Ue(t),r=l(t,wr);return n===Ue(r)?n=N:r.pop(),r.length&&r[0]===t[0]?Bn(r,fe(n,2)):[]}),_o=cr(function(t){var n=Ue(t),r=l(t,wr);return n===Ue(r)?n=N:r.pop(),r.length&&r[0]===t[0]?Bn(r,N,n):[]}),vo=cr(Me),go=ue(function(t,n){var r=t?t.length:0,e=pn(t,n);return ir(t,l(n,function(t){return ge(t,r)?+t:t}).sort(Or)),e}),yo=cr(function(t){ +return dr(An(t,1,eu,true))}),bo=cr(function(t){var n=Ue(t);return eu(n)&&(n=N),dr(An(t,1,eu,true),fe(n,2))}),xo=cr(function(t){var n=Ue(t);return eu(n)&&(n=N),dr(An(t,1,eu,true),N,n)}),jo=cr(function(t,n){return eu(t)?xn(t,n):[]}),wo=cr(function(t){return xr(f(t,eu))}),mo=cr(function(t){var n=Ue(t);return eu(n)&&(n=N),xr(f(t,eu),fe(n,2))}),Ao=cr(function(t){var n=Ue(t);return eu(n)&&(n=N),xr(f(t,eu),N,n)}),ko=cr(Te),Eo=cr(function(t){var n=t.length,n=1=n}),Ko=Du.isArray,Go=Jt?S(Jt):Un,Jo=xi||Mu,Yo=Yt?S(Yt):Mn,Ho=Ht?S(Ht):Tn,Qo=Qt?S(Qt):Nn,Xo=Xt?S(Xt):Pn,tf=tn?S(tn):Zn,nf=Hr(Gn),rf=Hr(function(t,n){return t<=n}),ef=Lr(function(t,n){if(xe(n)||ru(n))zr(n,mu(n),t);else for(var r in n)Qu.call(n,r)&&cn(t,r,n[r])}),uf=Lr(function(t,n){zr(n,Au(n),t)}),of=Lr(function(t,n,r,e){zr(n,Au(n),t,e)}),ff=Lr(function(t,n,r,e){zr(n,mu(n),t,e)}),cf=ue(pn),af=cr(function(t){return t.push(N,nn),r(of,N,t)}),lf=cr(function(t){return t.push(N,we),r(vf,N,t)}),sf=qr(function(t,n,r){ +t[n]=r},Ru(zu)),hf=qr(function(t,n,r){Qu.call(t,n)?t[n].push(r):t[n]=[r]},fe),pf=cr(Cn),_f=Lr(function(t,n,r){Qn(t,n,r)}),vf=Lr(function(t,n,r,e){Qn(t,n,r,e)}),gf=ue(function(t,n){return null==t?{}:(n=l(n,Se),nr(t,xn(In(t,Au,eo),n)))}),df=ue(function(t,n){return null==t?{}:nr(t,l(n,Se))}),yf=te(mu),bf=te(Au),xf=Tr(function(t,n,r){return n=n.toLowerCase(),t+(r?Ou(n):n)}),jf=Tr(function(t,n,r){return t+(r?"-":"")+n.toLowerCase()}),wf=Tr(function(t,n,r){return t+(r?" ":"")+n.toLowerCase()}),mf=Dr("toLowerCase"),Af=Tr(function(t,n,r){ +return t+(r?"_":"")+n.toLowerCase()}),kf=Tr(function(t,n,r){return t+(r?" ":"")+Of(n)}),Ef=Tr(function(t,n,r){return t+(r?" ":"")+n.toUpperCase()}),Of=Dr("toUpperCase"),Sf=cr(function(t,n){try{return r(t,N,n)}catch(t){return uu(t)?t:new $u(t)}}),If=ue(function(t,n){return u(n,function(n){n=Se(n),hn(t,n,Mo(t[n],t))}),t}),Rf=Pr(),zf=Pr(true),Wf=cr(function(t,n){return function(r){return Cn(r,t,n)}}),Bf=cr(function(t,n){return function(r){return Cn(t,r,n)}}),Lf=Kr(l),Cf=Kr(o),Uf=Kr(_),Mf=Yr(),Df=Yr(true),Tf=Vr(function(t,n){ +return t+n},0),$f=Xr("ceil"),Ff=Vr(function(t,n){return t/n},1),Nf=Xr("floor"),Pf=Vr(function(t,n){return t*n},1),Zf=Xr("round"),qf=Vr(function(t,n){return t-n},0);return Ot.after=function(t,n){if(typeof n!="function")throw new Vu("Expected a function");return t=gu(t),function(){if(1>--t)return n.apply(this,arguments)}},Ot.ary=Ke,Ot.assign=ef,Ot.assignIn=uf,Ot.assignInWith=of,Ot.assignWith=ff,Ot.at=cf,Ot.before=Ge,Ot.bind=Mo,Ot.bindAll=If,Ot.bindKey=Do,Ot.castArray=function(){if(!arguments.length)return[]; +var t=arguments[0];return Ko(t)?t:[t]},Ot.chain=Fe,Ot.chunk=function(t,n,r){if(n=(r?de(t,n,r):n===N)?1:Ai(gu(n),0),r=t?t.length:0,!r||1>n)return[];for(var e=0,u=0,i=Du(di(r/n));en?0:n,e)):[]},Ot.dropRight=function(t,n,r){var e=t?t.length:0;return e?(n=r||n===N?1:gu(n),n=e-n,lr(t,0,0>n?0:n)):[]},Ot.dropRightWhile=function(t,n){return t&&t.length?yr(t,fe(n,3),true,true):[]},Ot.dropWhile=function(t,n){return t&&t.length?yr(t,fe(n,3),true):[]},Ot.fill=function(t,n,r,e){var u=t?t.length:0;if(!u)return[];for(r&&typeof r!="number"&&de(t,n,r)&&(r=0,e=u),u=t.length,r=gu(r),0>r&&(r=-r>u?0:u+r),e=e===N||e>u?u:gu(e),0>e&&(e+=u),e=r>e?0:du(e);r>>0, +r?(t=xu(t))&&(typeof n=="string"||null!=n&&!Qo(n))&&(n=gr(n),!n&&Bt.test(t))?Ar($(t),0,r):t.split(n,r):[]},Ot.spread=function(t,n){if(typeof t!="function")throw new Vu("Expected a function");return n=n===N?0:Ai(gu(n),0),cr(function(e){var u=e[n];return e=Ar(e,0,n),u&&s(e,u),r(t,this,e)})},Ot.tail=function(t){var n=t?t.length:0;return n?lr(t,1,n):[]},Ot.take=function(t,n,r){return t&&t.length?(n=r||n===N?1:gu(n),lr(t,0,0>n?0:n)):[]},Ot.takeRight=function(t,n,r){var e=t?t.length:0;return e?(n=r||n===N?1:gu(n), +n=e-n,lr(t,0>n?0:n,e)):[]},Ot.takeRightWhile=function(t,n){return t&&t.length?yr(t,fe(n,3),false,true):[]},Ot.takeWhile=function(t,n){return t&&t.length?yr(t,fe(n,3)):[]},Ot.tap=function(t,n){return n(t),t},Ot.throttle=function(t,n,r){var e=true,u=true;if(typeof t!="function")throw new Vu("Expected a function");return cu(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),He(t,n,{leading:e,maxWait:n,trailing:u})},Ot.thru=Ne,Ot.toArray=_u,Ot.toPairs=yf,Ot.toPairsIn=bf,Ot.toPath=function(t){ +return Ko(t)?l(t,Se):pu(t)?[t]:Rr(co(t))},Ot.toPlainObject=bu,Ot.transform=function(t,n,r){var e=Ko(t)||tf(t);if(n=fe(n,4),null==r)if(e||cu(t)){var i=t.constructor;r=e?Ko(t)?new i:[]:iu(i)?yn(ci(t)):{}}else r={};return(e?u:kn)(t,function(t,e,u){return n(r,t,e,u)}),r},Ot.unary=function(t){return Ke(t,1)},Ot.union=yo,Ot.unionBy=bo,Ot.unionWith=xo,Ot.uniq=function(t){return t&&t.length?dr(t):[]},Ot.uniqBy=function(t,n){return t&&t.length?dr(t,fe(n,2)):[]},Ot.uniqWith=function(t,n){return t&&t.length?dr(t,N,n):[]; +},Ot.unset=function(t,n){var r;if(null==t)r=true;else{r=t;var e=n,e=ye(e,r)?[e]:mr(e);r=Ae(r,e),e=Se(Ue(e)),r=!(null!=r&&Qu.call(r,e))||delete r[e]}return r},Ot.unzip=Te,Ot.unzipWith=$e,Ot.update=function(t,n,r){return null==t?t:ar(t,n,(typeof r=="function"?r:zu)(Sn(t,n)),void 0)},Ot.updateWith=function(t,n,r,e){return e=typeof e=="function"?e:N,null!=t&&(t=ar(t,n,(typeof r=="function"?r:zu)(Sn(t,n)),e)),t},Ot.values=Eu,Ot.valuesIn=function(t){return null==t?[]:I(t,Au(t))},Ot.without=jo,Ot.words=Iu, +Ot.wrap=function(t,n){return n=null==n?zu:n,No(n,t)},Ot.xor=wo,Ot.xorBy=mo,Ot.xorWith=Ao,Ot.zip=ko,Ot.zipObject=function(t,n){return jr(t||[],n||[],cn)},Ot.zipObjectDeep=function(t,n){return jr(t||[],n||[],ar)},Ot.zipWith=Eo,Ot.entries=yf,Ot.entriesIn=bf,Ot.extend=uf,Ot.extendWith=of,Bu(Ot,Ot),Ot.add=Tf,Ot.attempt=Sf,Ot.camelCase=xf,Ot.capitalize=Ou,Ot.ceil=$f,Ot.clamp=function(t,n,r){return r===N&&(r=n,n=N),r!==N&&(r=yu(r),r=r===r?r:0),n!==N&&(n=yu(n),n=n===n?n:0),_n(yu(t),n,r)},Ot.clone=function(t){ +return vn(t,false,true)},Ot.cloneDeep=function(t){return vn(t,true,true)},Ot.cloneDeepWith=function(t,n){return vn(t,true,true,n)},Ot.cloneWith=function(t,n){return vn(t,false,true,n)},Ot.conformsTo=function(t,n){return null==n||dn(t,n,mu(n))},Ot.deburr=Su,Ot.defaultTo=function(t,n){return null==t||t!==t?n:t},Ot.divide=Ff,Ot.endsWith=function(t,n,r){t=xu(t),n=gr(n);var e=t.length,e=r=r===N?e:_n(gu(r),0,e);return r-=n.length,0<=r&&t.slice(r,e)==n},Ot.eq=tu,Ot.escape=function(t){return(t=xu(t))&&Q.test(t)?t.replace(Y,en):t; +},Ot.escapeRegExp=function(t){return(t=xu(t))&&ft.test(t)?t.replace(ot,"\\$&"):t},Ot.every=function(t,n,r){var e=Ko(t)?o:jn;return r&&de(t,n,r)&&(n=N),e(t,fe(n,3))},Ot.find=Io,Ot.findIndex=We,Ot.findKey=function(t,n){return v(t,fe(n,3),kn)},Ot.findLast=Ro,Ot.findLastIndex=Be,Ot.findLastKey=function(t,n){return v(t,fe(n,3),En)},Ot.floor=Nf,Ot.forEach=Ze,Ot.forEachRight=qe,Ot.forIn=function(t,n){return null==t?t:Ji(t,fe(n,3),Au)},Ot.forInRight=function(t,n){return null==t?t:Yi(t,fe(n,3),Au)},Ot.forOwn=function(t,n){ +return t&&kn(t,fe(n,3))},Ot.forOwnRight=function(t,n){return t&&En(t,fe(n,3))},Ot.get=ju,Ot.gt=qo,Ot.gte=Vo,Ot.has=function(t,n){return null!=t&&se(t,n,zn)},Ot.hasIn=wu,Ot.head=Ce,Ot.identity=zu,Ot.includes=function(t,n,r,e){return t=ru(t)?t:Eu(t),r=r&&!e?gu(r):0,e=t.length,0>r&&(r=Ai(e+r,0)),hu(t)?r<=e&&-1r&&(r=Ai(e+r,0)),d(t,n,r)):-1},Ot.inRange=function(t,n,r){return n=vu(n),r===N?(r=n, +n=0):r=vu(r),t=yu(t),t>=ki(n,r)&&t=t},Ot.isSet=Xo,Ot.isString=hu,Ot.isSymbol=pu,Ot.isTypedArray=tf,Ot.isUndefined=function(t){return t===N; +},Ot.isWeakMap=function(t){return au(t)&&"[object WeakMap]"==Et(t)},Ot.isWeakSet=function(t){return au(t)&&"[object WeakSet]"==ni.call(t)},Ot.join=function(t,n){return t?wi.call(t,n):""},Ot.kebabCase=jf,Ot.last=Ue,Ot.lastIndexOf=function(t,n,r){var e=t?t.length:0;if(!e)return-1;var u=e;if(r!==N&&(u=gu(r),u=0>u?Ai(e+u,0):ki(u,e-1)),n===n){for(r=u+1;r--&&t[r]!==n;);t=r}else t=g(t,b,u,true);return t},Ot.lowerCase=wf,Ot.lowerFirst=mf,Ot.lt=nf,Ot.lte=rf,Ot.max=function(t){return t&&t.length?wn(t,zu,Rn):N; +},Ot.maxBy=function(t,n){return t&&t.length?wn(t,fe(n,2),Rn):N},Ot.mean=function(t){return x(t,zu)},Ot.meanBy=function(t,n){return x(t,fe(n,2))},Ot.min=function(t){return t&&t.length?wn(t,zu,Gn):N},Ot.minBy=function(t,n){return t&&t.length?wn(t,fe(n,2),Gn):N},Ot.stubArray=Uu,Ot.stubFalse=Mu,Ot.stubObject=function(){return{}},Ot.stubString=function(){return""},Ot.stubTrue=function(){return true},Ot.multiply=Pf,Ot.nth=function(t,n){return t&&t.length?Xn(t,gu(n)):N},Ot.noConflict=function(){return Zt._===this&&(Zt._=ri), +this},Ot.noop=Lu,Ot.now=Uo,Ot.pad=function(t,n,r){t=xu(t);var e=(n=gu(n))?T(t):0;return!n||e>=n?t:(n=(n-e)/2,Gr(yi(n),r)+t+Gr(di(n),r))},Ot.padEnd=function(t,n,r){t=xu(t);var e=(n=gu(n))?T(t):0;return n&&en){var e=t;t=n,n=e}return r||t%1||n%1?(r=Si(),ki(t+r*(n-t+$t("1e-"+((r+"").length-1))),n)):or(t,n)},Ot.reduce=function(t,n,r){var e=Ko(t)?h:m,u=3>arguments.length;return e(t,fe(n,4),r,u,Ki)},Ot.reduceRight=function(t,n,r){var e=Ko(t)?p:m,u=3>arguments.length;return e(t,fe(n,4),r,u,Gi)},Ot.repeat=function(t,n,r){return n=(r?de(t,n,r):n===N)?1:gu(n),fr(xu(t),n)},Ot.replace=function(){var t=arguments,n=xu(t[0]);return 3>t.length?n:n.replace(t[1],t[2]); +},Ot.result=function(t,n,r){n=ye(n,t)?[n]:mr(n);var e=-1,u=n.length;for(u||(t=N,u=1);++et||9007199254740991=i)return t;if(i=r-T(e),1>i)return e;if(r=o?Ar(o,0,i).join(""):t.slice(0,i),u===N)return r+e;if(o&&(i+=r.length-i),Qo(u)){if(t.slice(i).search(u)){var f=r;for(u.global||(u=Zu(u.source,xu(dt.exec(u))+"g")),u.lastIndex=0;o=u.exec(f);)var c=o.index;r=r.slice(0,c===N?i:c)}}else t.indexOf(gr(u),i)!=i&&(u=r.lastIndexOf(u),-1u.__dir__?"Right":"")}),u},Dt.prototype[t+"Right"]=function(n){return this.reverse()[t](n).reverse()}}),u(["filter","map","takeWhile"],function(t,n){var r=n+1,e=1==r||3==r;Dt.prototype[t]=function(t){var n=this.clone();return n.__iteratees__.push({iteratee:fe(t,3),type:r}),n.__filtered__=n.__filtered__||e,n}}),u(["head","last"],function(t,n){var r="take"+(n?"Right":"");Dt.prototype[t]=function(){return this[r](1).value()[0]}}),u(["initial","tail"],function(t,n){var r="drop"+(n?"":"Right"); +Dt.prototype[t]=function(){return this.__filtered__?new Dt(this):this[r](1)}}),Dt.prototype.compact=function(){return this.filter(zu)},Dt.prototype.find=function(t){return this.filter(t).head()},Dt.prototype.findLast=function(t){return this.reverse().find(t)},Dt.prototype.invokeMap=cr(function(t,n){return typeof t=="function"?new Dt(this):this.map(function(r){return Cn(r,t,n)})}),Dt.prototype.reject=function(t){return this.filter(Xe(fe(t)))},Dt.prototype.slice=function(t,n){t=gu(t);var r=this;return r.__filtered__&&(0n)?new Dt(r):(0>t?r=r.takeRight(-t):t&&(r=r.drop(t)), +n!==N&&(n=gu(n),r=0>n?r.dropRight(-n):r.take(n-t)),r)},Dt.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Dt.prototype.toArray=function(){return this.take(4294967295)},kn(Dt.prototype,function(t,n){var r=/^(?:filter|find|map|reject)|While$/.test(n),e=/^(?:head|last)$/.test(n),u=Ot[e?"take"+("last"==n?"Right":""):n],i=e||/^find/.test(n);u&&(Ot.prototype[n]=function(){function n(t){return t=u.apply(Ot,s([t],f)),e&&h?t[0]:t}var o=this.__wrapped__,f=e?[1]:arguments,c=o instanceof Dt,a=f[0],l=c||Ko(o); +l&&r&&typeof a=="function"&&1!=a.length&&(c=l=false);var h=this.__chain__,p=!!this.__actions__.length,a=i&&!h,c=c&&!p;return!i&&l?(o=c?o:new Dt(this),o=t.apply(o,f),o.__actions__.push({func:Ne,args:[n],thisArg:N}),new zt(o,h)):a&&c?t.apply(this,f):(o=this.thru(n),a?e?o.value()[0]:o.value():o)})}),u("pop push shift sort splice unshift".split(" "),function(t){var n=Ku[t],r=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",e=/^(?:pop|shift)$/.test(t);Ot.prototype[t]=function(){var t=arguments;if(e&&!this.__chain__){ +var u=this.value();return n.apply(Ko(u)?u:[],t)}return this[r](function(r){return n.apply(Ko(r)?r:[],t)})}}),kn(Dt.prototype,function(t,n){var r=Ot[n];if(r){var e=r.name+"";(Di[e]||(Di[e]=[])).push({name:n,func:r})}}),Di[Zr(N,2).name]=[{name:"wrapper",func:N}],Dt.prototype.clone=function(){var t=new Dt(this.__wrapped__);return t.__actions__=Rr(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Rr(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Rr(this.__views__), +t},Dt.prototype.reverse=function(){if(this.__filtered__){var t=new Dt(this);t.__dir__=-1,t.__filtered__=true}else t=this.clone(),t.__dir__*=-1;return t},Dt.prototype.value=function(){var t,n=this.__wrapped__.value(),r=this.__dir__,e=Ko(n),u=0>r,i=e?n.length:0;t=i;for(var o=this.__views__,f=0,c=-1,a=o.length;++ci||i==t&&a==t)return br(n,this.__actions__);e=[];t:for(;t--&&c=this.__values__.length;return{done:t,value:t?N:this.__values__[this.__index__++]}},Ot.prototype.plant=function(t){for(var n,r=this;r instanceof St;){var e=ze(r);e.__index__=0,e.__values__=N,n?u.__wrapped__=e:n=e;var u=e,r=r.__wrapped__}return u.__wrapped__=t,n},Ot.prototype.reverse=function(){var t=this.__wrapped__;return t instanceof Dt?(this.__actions__.length&&(t=new Dt(this)),t=t.reverse(),t.__actions__.push({func:Ne,args:[De],thisArg:N}),new zt(t,this.__chain__)):this.thru(De); +},Ot.prototype.toJSON=Ot.prototype.valueOf=Ot.prototype.value=function(){return br(this.__wrapped__,this.__actions__)},Ot.prototype.first=Ot.prototype.head,ai&&(Ot.prototype[ai]=Pe),Ot}var N,P=1/0,Z=NaN,q=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],V=/\b__p\+='';/g,K=/\b(__p\+=)''\+/g,G=/(__e\(.*?\)|\b__t\))\+'';/g,J=/&(?:amp|lt|gt|quot|#39|#96);/g,Y=/[&<>"'`]/g,H=RegExp(J.source),Q=RegExp(Y.source),X=/<%-([\s\S]+?)%>/g,tt=/<%([\s\S]+?)%>/g,nt=/<%=([\s\S]+?)%>/g,rt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,et=/^\w*$/,ut=/^\./,it=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ot=/[\\^$.*+?()[\]{}|]/g,ft=RegExp(ot.source),ct=/^\s+|\s+$/g,at=/^\s+/,lt=/\s+$/,st=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ht=/\{\n\/\* \[wrapped with (.+)\] \*/,pt=/,? & /,_t=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,vt=/\\(\\)?/g,gt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,dt=/\w*$/,yt=/^[-+]0x[0-9a-f]+$/i,bt=/^0b[01]+$/i,xt=/^\[object .+?Constructor\]$/,jt=/^0o[0-7]+$/i,wt=/^(?:0|[1-9]\d*)$/,mt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,At=/($^)/,kt=/['\n\r\u2028\u2029\\]/g,Et="[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]|\\ud83c[\\udffb-\\udfff])?(?:\\u200d(?:[^\\ud800-\\udfff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]|\\ud83c[\\udffb-\\udfff])?)*",Ot="(?:[\\u2700-\\u27bf]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])"+Et,St="(?:[^\\ud800-\\udfff][\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]?|[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\ud800-\\udfff])",It=RegExp("['\u2019]","g"),Rt=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]","g"),zt=RegExp("\\ud83c[\\udffb-\\udfff](?=\\ud83c[\\udffb-\\udfff])|"+St+Et,"g"),Wt=RegExp(["[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+(?:['\u2019](?:d|ll|m|re|s|t|ve))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\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]|[A-Z\\xc0-\\xd6\\xd8-\\xde]|$)|(?:[A-Z\\xc0-\\xd6\\xd8-\\xde]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\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\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\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]|[A-Z\\xc0-\\xd6\\xd8-\\xde](?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\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\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])|$)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?(?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\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\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['\u2019](?:d|ll|m|re|s|t|ve))?|[A-Z\\xc0-\\xd6\\xd8-\\xde]+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?|\\d+",Ot].join("|"),"g"),Bt=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0\\ufe0e\\ufe0f]"),Lt=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Ct="Array Buffer DataView Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Map Math Object Promise RegExp Set String Symbol TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap _ clearTimeout isFinite parseInt setTimeout".split(" "),Ut={}; +Ut["[object Float32Array]"]=Ut["[object Float64Array]"]=Ut["[object Int8Array]"]=Ut["[object Int16Array]"]=Ut["[object Int32Array]"]=Ut["[object Uint8Array]"]=Ut["[object Uint8ClampedArray]"]=Ut["[object Uint16Array]"]=Ut["[object Uint32Array]"]=true,Ut["[object Arguments]"]=Ut["[object Array]"]=Ut["[object ArrayBuffer]"]=Ut["[object Boolean]"]=Ut["[object DataView]"]=Ut["[object Date]"]=Ut["[object Error]"]=Ut["[object Function]"]=Ut["[object Map]"]=Ut["[object Number]"]=Ut["[object Object]"]=Ut["[object RegExp]"]=Ut["[object Set]"]=Ut["[object String]"]=Ut["[object WeakMap]"]=false; +var Mt={};Mt["[object Arguments]"]=Mt["[object Array]"]=Mt["[object ArrayBuffer]"]=Mt["[object DataView]"]=Mt["[object Boolean]"]=Mt["[object Date]"]=Mt["[object Float32Array]"]=Mt["[object Float64Array]"]=Mt["[object Int8Array]"]=Mt["[object Int16Array]"]=Mt["[object Int32Array]"]=Mt["[object Map]"]=Mt["[object Number]"]=Mt["[object Object]"]=Mt["[object RegExp]"]=Mt["[object Set]"]=Mt["[object String]"]=Mt["[object Symbol]"]=Mt["[object Uint8Array]"]=Mt["[object Uint8ClampedArray]"]=Mt["[object Uint16Array]"]=Mt["[object Uint32Array]"]=true, +Mt["[object Error]"]=Mt["[object Function]"]=Mt["[object WeakMap]"]=false;var Dt,Tt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},$t=parseFloat,Ft=parseInt,Nt=typeof global=="object"&&global&&global.Object===Object&&global,Pt=typeof self=="object"&&self&&self.Object===Object&&self,Zt=Nt||Pt||Function("return this")(),qt=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Vt=qt&&typeof module=="object"&&module&&!module.nodeType&&module,Kt=Vt&&Vt.exports===qt,Gt=Kt&&Nt.g; +t:{try{Dt=Gt&&Gt.f("util");break t}catch(t){}Dt=void 0}var Jt=Dt&&Dt.isArrayBuffer,Yt=Dt&&Dt.isDate,Ht=Dt&&Dt.isMap,Qt=Dt&&Dt.isRegExp,Xt=Dt&&Dt.isSet,tn=Dt&&Dt.isTypedArray,nn=j("length"),rn=w({"\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","\u0100":"A","\u0102":"A","\u0104":"A","\u0101":"a","\u0103":"a","\u0105":"a","\u0106":"C","\u0108":"C","\u010a":"C","\u010c":"C", "\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\u010e":"D","\u0110":"D","\u010f":"d","\u0111":"d","\u0112":"E","\u0114":"E","\u0116":"E","\u0118":"E","\u011a":"E","\u0113":"e","\u0115":"e","\u0117":"e","\u0119":"e","\u011b":"e","\u011c":"G","\u011e":"G","\u0120":"G","\u0122":"G","\u011d":"g","\u011f":"g","\u0121":"g","\u0123":"g","\u0124":"H","\u0126":"H","\u0125":"h","\u0127":"h","\u0128":"I","\u012a":"I","\u012c":"I","\u012e":"I","\u0130":"I","\u0129":"i","\u012b":"i","\u012d":"i","\u012f":"i", "\u0131":"i","\u0134":"J","\u0135":"j","\u0136":"K","\u0137":"k","\u0138":"k","\u0139":"L","\u013b":"L","\u013d":"L","\u013f":"L","\u0141":"L","\u013a":"l","\u013c":"l","\u013e":"l","\u0140":"l","\u0142":"l","\u0143":"N","\u0145":"N","\u0147":"N","\u014a":"N","\u0144":"n","\u0146":"n","\u0148":"n","\u014b":"n","\u014c":"O","\u014e":"O","\u0150":"O","\u014d":"o","\u014f":"o","\u0151":"o","\u0154":"R","\u0156":"R","\u0158":"R","\u0155":"r","\u0157":"r","\u0159":"r","\u015a":"S","\u015c":"S","\u015e":"S", "\u0160":"S","\u015b":"s","\u015d":"s","\u015f":"s","\u0161":"s","\u0162":"T","\u0164":"T","\u0166":"T","\u0163":"t","\u0165":"t","\u0167":"t","\u0168":"U","\u016a":"U","\u016c":"U","\u016e":"U","\u0170":"U","\u0172":"U","\u0169":"u","\u016b":"u","\u016d":"u","\u016f":"u","\u0171":"u","\u0173":"u","\u0174":"W","\u0175":"w","\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017b":"Z","\u017d":"Z","\u017a":"z","\u017c":"z","\u017e":"z","\u0132":"IJ","\u0133":"ij","\u0152":"Oe","\u0153":"oe","\u0149":"'n", -"\u017f":"ss"}),on=w({"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"}),fn=w({"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"}),cn=N();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Vt._=cn, define(function(){return cn})):Gt?((Gt.exports=cn)._=cn,Kt._=cn):Vt._=cn}).call(this); \ No newline at end of file +"\u017f":"s"}),en=w({"&":"&","<":"<",">":">",'"':""","'":"'"}),un=w({"&":"&","<":"<",">":">",""":'"',"'":"'"}),on=F();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Zt._=on, define(function(){return on})):Vt?((Vt.exports=on)._=on,qt._=on):Zt._=on}).call(this); \ No newline at end of file diff --git a/mapKeys.js b/mapKeys.js index ef73c5251..3b68797db 100644 --- a/mapKeys.js +++ b/mapKeys.js @@ -1,4 +1,5 @@ -var baseForOwn = require('./_baseForOwn'), +var baseAssignValue = require('./_baseAssignValue'), + baseForOwn = require('./_baseForOwn'), baseIteratee = require('./_baseIteratee'); /** @@ -27,7 +28,7 @@ function mapKeys(object, iteratee) { iteratee = baseIteratee(iteratee, 3); baseForOwn(object, function(value, key, object) { - result[iteratee(value, key, object)] = value; + baseAssignValue(result, iteratee(value, key, object), value); }); return result; } diff --git a/mapValues.js b/mapValues.js index b2af211a7..4ec082514 100644 --- a/mapValues.js +++ b/mapValues.js @@ -1,4 +1,5 @@ -var baseForOwn = require('./_baseForOwn'), +var baseAssignValue = require('./_baseAssignValue'), + baseForOwn = require('./_baseForOwn'), baseIteratee = require('./_baseIteratee'); /** @@ -34,7 +35,7 @@ function mapValues(object, iteratee) { iteratee = baseIteratee(iteratee, 3); baseForOwn(object, function(value, key, object) { - result[key] = iteratee(value, key, object); + baseAssignValue(result, key, iteratee(value, key, object)); }); return result; } diff --git a/memoize.js b/memoize.js index 97aa18285..a1270355a 100644 --- a/memoize.js +++ b/memoize.js @@ -60,14 +60,14 @@ function memoize(func, resolver) { return cache.get(key); } var result = func.apply(this, args); - memoized.cache = cache.set(key, result); + memoized.cache = cache.set(key, result) || cache; return result; }; memoized.cache = new (memoize.Cache || MapCache); return memoized; } -// Assign cache to `_.memoize`. +// Expose `MapCache`. memoize.Cache = MapCache; module.exports = memoize; diff --git a/mergeWith.js b/mergeWith.js index a621dca2f..1b43a2c4a 100644 --- a/mergeWith.js +++ b/mergeWith.js @@ -5,7 +5,7 @@ var baseMerge = require('./_baseMerge'), * This method is like `_.merge` except that it accepts `customizer` which * is invoked to produce the merged values of the destination and source * properties. If `customizer` returns `undefined`, merging is handled by the - * method instead. The `customizer` is invoked with seven arguments: + * method instead. The `customizer` is invoked with six arguments: * (objValue, srcValue, key, object, source, stack). * * **Note:** This method mutates `object`. diff --git a/omit.js b/omit.js index 4ef0cafe4..38f919092 100644 --- a/omit.js +++ b/omit.js @@ -1,8 +1,7 @@ var arrayMap = require('./_arrayMap'), baseDifference = require('./_baseDifference'), - baseFlatten = require('./_baseFlatten'), basePick = require('./_basePick'), - baseRest = require('./_baseRest'), + flatRest = require('./_flatRest'), getAllKeysIn = require('./_getAllKeysIn'), toKey = require('./_toKey'); @@ -25,11 +24,11 @@ var arrayMap = require('./_arrayMap'), * _.omit(object, ['a', 'c']); * // => { 'b': '2' } */ -var omit = baseRest(function(object, props) { +var omit = flatRest(function(object, props) { if (object == null) { return {}; } - props = arrayMap(baseFlatten(props, 1), toKey); + props = arrayMap(props, toKey); return basePick(object, baseDifference(getAllKeysIn(object), props)); }); diff --git a/overArgs.js b/overArgs.js index 56d253bc6..f0067dbd3 100644 --- a/overArgs.js +++ b/overArgs.js @@ -4,6 +4,7 @@ var apply = require('./_apply'), baseIteratee = require('./_baseIteratee'), baseRest = require('./_baseRest'), baseUnary = require('./_baseUnary'), + castRest = require('./_castRest'), isArray = require('./isArray'); /* Built-in method references for those with the same name as other `lodash` methods. */ @@ -40,7 +41,7 @@ var nativeMin = Math.min; * func(10, 5); * // => [100, 10] */ -var overArgs = baseRest(function(func, transforms) { +var overArgs = castRest(function(func, transforms) { transforms = (transforms.length == 1 && isArray(transforms[0])) ? arrayMap(transforms[0], baseUnary(baseIteratee)) : arrayMap(baseFlatten(transforms, 1), baseUnary(baseIteratee)); diff --git a/package.json b/package.json index 5e4d36d9d..f88e332db 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lodash", - "version": "4.15.0", + "version": "4.16.0", "description": "Lodash modular utilities.", "keywords": "modules, stdlib, util", "homepage": "https://lodash.com/", diff --git a/parseInt.js b/parseInt.js index fe140f61b..578875870 100644 --- a/parseInt.js +++ b/parseInt.js @@ -1,12 +1,6 @@ var root = require('./_root'), toString = require('./toString'); -/** Used to match leading and trailing whitespace. */ -var reTrim = /^\s+|\s+$/g; - -/** Used to detect hexadecimal string values. */ -var reHasHexPrefix = /^0x/i; - /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeParseInt = root.parseInt; @@ -35,15 +29,12 @@ var nativeParseInt = root.parseInt; * // => [6, 8, 10] */ function parseInt(string, radix, guard) { - // Chrome fails to trim leading whitespace characters. - // See https://bugs.chromium.org/p/v8/issues/detail?id=3109 for more details. if (guard || radix == null) { radix = 0; } else if (radix) { radix = +radix; } - string = toString(string).replace(reTrim, ''); - return nativeParseInt(string, radix || (reHasHexPrefix.test(string) ? 16 : 10)); + return nativeParseInt(toString(string), radix || 0); } module.exports = parseInt; diff --git a/pick.js b/pick.js index 464dd9f92..a631b1519 100644 --- a/pick.js +++ b/pick.js @@ -1,7 +1,6 @@ var arrayMap = require('./_arrayMap'), - baseFlatten = require('./_baseFlatten'), basePick = require('./_basePick'), - baseRest = require('./_baseRest'), + flatRest = require('./_flatRest'), toKey = require('./_toKey'); /** @@ -21,8 +20,8 @@ var arrayMap = require('./_arrayMap'), * _.pick(object, ['a', 'c']); * // => { 'a': 1, 'c': 3 } */ -var pick = baseRest(function(object, props) { - return object == null ? {} : basePick(object, arrayMap(baseFlatten(props, 1), toKey)); +var pick = flatRest(function(object, props) { + return object == null ? {} : basePick(object, arrayMap(props, toKey)); }); module.exports = pick; diff --git a/pullAt.js b/pullAt.js index 59b5fa35a..7e4e46d7b 100644 --- a/pullAt.js +++ b/pullAt.js @@ -1,9 +1,8 @@ var arrayMap = require('./_arrayMap'), baseAt = require('./_baseAt'), - baseFlatten = require('./_baseFlatten'), basePullAt = require('./_basePullAt'), - baseRest = require('./_baseRest'), compareAscending = require('./_compareAscending'), + flatRest = require('./_flatRest'), isIndex = require('./_isIndex'); /** @@ -30,9 +29,7 @@ var arrayMap = require('./_arrayMap'), * console.log(pulled); * // => ['b', 'd'] */ -var pullAt = baseRest(function(array, indexes) { - indexes = baseFlatten(indexes, 1); - +var pullAt = flatRest(function(array, indexes) { var length = array ? array.length : 0, result = baseAt(array, indexes); diff --git a/rearg.js b/rearg.js index fabe5a383..4df6989b3 100644 --- a/rearg.js +++ b/rearg.js @@ -1,6 +1,5 @@ -var baseFlatten = require('./_baseFlatten'), - baseRest = require('./_baseRest'), - createWrap = require('./_createWrap'); +var createWrap = require('./_createWrap'), + flatRest = require('./_flatRest'); /** Used to compose bitmasks for function metadata. */ var REARG_FLAG = 256; @@ -27,8 +26,8 @@ var REARG_FLAG = 256; * rearged('b', 'c', 'a') * // => ['a', 'b', 'c'] */ -var rearg = baseRest(function(func, indexes) { - return createWrap(func, REARG_FLAG, undefined, undefined, undefined, baseFlatten(indexes, 1)); +var rearg = flatRest(function(func, indexes) { + return createWrap(func, REARG_FLAG, undefined, undefined, undefined, indexes); }); module.exports = rearg; diff --git a/sample.js b/sample.js index aff8e77d0..4ad05824a 100644 --- a/sample.js +++ b/sample.js @@ -1,4 +1,4 @@ -var baseRandom = require('./_baseRandom'), +var arraySample = require('./_arraySample'), isArrayLike = require('./isArrayLike'), values = require('./values'); @@ -17,10 +17,7 @@ var baseRandom = require('./_baseRandom'), * // => 2 */ function sample(collection) { - var array = isArrayLike(collection) ? collection : values(collection), - length = array.length; - - return length > 0 ? array[baseRandom(0, length - 1)] : undefined; + return arraySample(isArrayLike(collection) ? collection : values(collection)); } module.exports = sample; diff --git a/sampleSize.js b/sampleSize.js index 29df2e6f2..782b97e63 100644 --- a/sampleSize.js +++ b/sampleSize.js @@ -1,8 +1,8 @@ -var baseClamp = require('./_baseClamp'), - baseRandom = require('./_baseRandom'), +var arraySampleSize = require('./_arraySampleSize'), + isArrayLike = require('./isArrayLike'), isIterateeCall = require('./_isIterateeCall'), - toArray = require('./toArray'), - toInteger = require('./toInteger'); + toInteger = require('./toInteger'), + values = require('./values'); /** * Gets `n` random elements at unique keys from `collection` up to the @@ -25,25 +25,12 @@ var baseClamp = require('./_baseClamp'), * // => [2, 3, 1] */ function sampleSize(collection, n, guard) { - var index = -1, - result = toArray(collection), - length = result.length, - lastIndex = length - 1; - if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) { n = 1; } else { - n = baseClamp(toInteger(n), 0, length); + n = toInteger(n); } - while (++index < n) { - var rand = baseRandom(index, lastIndex), - value = result[rand]; - - result[rand] = result[index]; - result[index] = value; - } - result.length = n; - return result; + return arraySampleSize(isArrayLike(collection) ? collection : values(collection), n); } module.exports = sampleSize; diff --git a/shuffle.js b/shuffle.js index 88d00cefe..dca8c2fdb 100644 --- a/shuffle.js +++ b/shuffle.js @@ -1,7 +1,7 @@ -var sampleSize = require('./sampleSize'); - -/** Used as references for the maximum length and index of an array. */ -var MAX_ARRAY_LENGTH = 4294967295; +var copyArray = require('./_copyArray'), + isArrayLike = require('./isArrayLike'), + shuffleSelf = require('./_shuffleSelf'), + values = require('./values'); /** * Creates an array of shuffled values, using a version of the @@ -19,7 +19,10 @@ var MAX_ARRAY_LENGTH = 4294967295; * // => [4, 1, 3, 2] */ function shuffle(collection) { - return sampleSize(collection, MAX_ARRAY_LENGTH); + return shuffleSelf(isArrayLike(collection) + ? copyArray(collection) + : values(collection) + ); } module.exports = shuffle; diff --git a/sortBy.js b/sortBy.js index 5fbee44c7..4ba8f7a0e 100644 --- a/sortBy.js +++ b/sortBy.js @@ -26,16 +26,11 @@ var baseFlatten = require('./_baseFlatten'), * { 'user': 'barney', 'age': 34 } * ]; * - * _.sortBy(users, function(o) { return o.user; }); + * _.sortBy(users, [function(o) { return o.user; }]); * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] * * _.sortBy(users, ['user', 'age']); * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]] - * - * _.sortBy(users, 'user', function(o) { - * return Math.floor(o.age / 10); - * }); - * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] */ var sortBy = baseRest(function(collection, iteratees) { if (collection == null) { diff --git a/template.js b/template.js index c1a523c57..2df417fa7 100644 --- a/template.js +++ b/template.js @@ -86,7 +86,8 @@ var reUnescapedString = /['\n\r\u2028\u2029\\]/g; * compiled({ 'user': 'barney' }); * // => 'hello barney!' * - * // Use the ES delimiter as an alternative to the default "interpolate" delimiter. + * // Use the ES template literal delimiter as an "interpolate" delimiter. + * // Disable support by replacing the "interpolate" delimiter. * var compiled = _.template('hello ${ user }!'); * compiled({ 'user': 'pebbles' }); * // => 'hello pebbles!' diff --git a/unescape.js b/unescape.js index 929bb1675..df011bd3d 100644 --- a/unescape.js +++ b/unescape.js @@ -7,7 +7,7 @@ var reEscapedHtml = /&(?:amp|lt|gt|quot|#39|#96);/g, /** * The inverse of `_.escape`; this method converts the HTML entities - * `&`, `<`, `>`, `"`, `'`, and ``` in `string` to + * `&`, `<`, `>`, `"`, and `'` in `string` to * their corresponding characters. * * **Note:** No other HTML entities are unescaped. To unescape additional diff --git a/uniq.js b/uniq.js index 52e5d512a..1df782630 100644 --- a/uniq.js +++ b/uniq.js @@ -3,8 +3,9 @@ var baseUniq = require('./_baseUniq'); /** * Creates a duplicate-free version of an array, using * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons, in which only the first occurrence of each - * element is kept. + * for equality comparisons, in which only the first occurrence of each element + * is kept. The order of result values is determined by the order they occur + * in the array. * * @static * @memberOf _ diff --git a/uniqBy.js b/uniqBy.js index d67d4f161..621ab3e5c 100644 --- a/uniqBy.js +++ b/uniqBy.js @@ -4,7 +4,9 @@ var baseIteratee = require('./_baseIteratee'), /** * This method is like `_.uniq` except that it accepts `iteratee` which is * invoked for each element in `array` to generate the criterion by which - * uniqueness is computed. The iteratee is invoked with one argument: (value). + * uniqueness is computed. The order of result values is determined by the + * order they occur in the array. The iteratee is invoked with one argument: + * (value). * * @static * @memberOf _ diff --git a/uniqWith.js b/uniqWith.js index e09b1729e..86af583ad 100644 --- a/uniqWith.js +++ b/uniqWith.js @@ -2,8 +2,9 @@ var baseUniq = require('./_baseUniq'); /** * This method is like `_.uniq` except that it accepts `comparator` which - * is invoked to compare elements of `array`. The comparator is invoked with - * two arguments: (arrVal, othVal). + * is invoked to compare elements of `array`. The order of result values is + * determined by the order they occur in the array.The comparator is invoked + * with two arguments: (arrVal, othVal). * * @static * @memberOf _ diff --git a/wrapperAt.js b/wrapperAt.js index 829851125..ab3d22af9 100644 --- a/wrapperAt.js +++ b/wrapperAt.js @@ -1,8 +1,7 @@ var LazyWrapper = require('./_LazyWrapper'), LodashWrapper = require('./_LodashWrapper'), baseAt = require('./_baseAt'), - baseFlatten = require('./_baseFlatten'), - baseRest = require('./_baseRest'), + flatRest = require('./_flatRest'), isIndex = require('./_isIndex'), thru = require('./thru'); @@ -22,8 +21,7 @@ var LazyWrapper = require('./_LazyWrapper'), * _(object).at(['a[0].b.c', 'a[1]']).value(); * // => [3, 4] */ -var wrapperAt = baseRest(function(paths) { - paths = baseFlatten(paths, 1); +var wrapperAt = flatRest(function(paths) { var length = paths.length, start = length ? paths[0] : 0, value = this.__wrapped__, diff --git a/xorBy.js b/xorBy.js index 00b03108b..2cb524222 100644 --- a/xorBy.js +++ b/xorBy.js @@ -8,8 +8,9 @@ var arrayFilter = require('./_arrayFilter'), /** * This method is like `_.xor` except that it accepts `iteratee` which is * invoked for each element of each `arrays` to generate the criterion by - * which by which they're compared. The iteratee is invoked with one argument: - * (value). + * which by which they're compared. The order of result values is determined + * by the order they occur in the arrays. The iteratee is invoked with one + * argument: (value). * * @static * @memberOf _ diff --git a/xorWith.js b/xorWith.js index 4bd9071d9..68460dbd7 100644 --- a/xorWith.js +++ b/xorWith.js @@ -6,8 +6,9 @@ var arrayFilter = require('./_arrayFilter'), /** * This method is like `_.xor` except that it accepts `comparator` which is - * invoked to compare elements of `arrays`. The comparator is invoked with - * two arguments: (arrVal, othVal). + * invoked to compare elements of `arrays`. The order of result values is + * determined by the order they occur in the arrays. The comparator is invoked + * with two arguments: (arrVal, othVal). * * @static * @memberOf _