diff options
author | Florian Dold <florian.dold@gmail.com> | 2016-11-16 01:59:39 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2016-11-16 02:00:31 +0100 |
commit | bd65bb67e25a79b019d745b7262b2008ce2adb15 (patch) | |
tree | 89e1b032103a63737f1a703e6a943832ef261704 /node_modules/lodash/core.js | |
parent | f91466595b651721690133f58ab37f977539e95b (diff) |
incrementally verify denoms
The denominations are not stored in a separate object store.
Diffstat (limited to 'node_modules/lodash/core.js')
-rw-r--r-- | node_modules/lodash/core.js | 100 |
1 files changed, 43 insertions, 57 deletions
diff --git a/node_modules/lodash/core.js b/node_modules/lodash/core.js index 3a13976cd..ffe0b0543 100644 --- a/node_modules/lodash/core.js +++ b/node_modules/lodash/core.js @@ -1,6 +1,6 @@ /** * @license - * lodash (Custom Build) <https://lodash.com/> + * Lodash (Custom Build) <https://lodash.com/> * Build: `lodash core -o ./dist/lodash.core.js` * Copyright JS Foundation and other contributors <https://js.foundation/> * Released under MIT license <https://lodash.com/license> @@ -13,18 +13,18 @@ var undefined; /** Used as the semantic version number. */ - var VERSION = '4.16.6'; + var VERSION = '4.17.1'; /** Error message constants. */ var FUNC_ERROR_TEXT = 'Expected a function'; - /** Used to compose bitmasks for function metadata. */ - var BIND_FLAG = 1, - PARTIAL_FLAG = 32; + /** Used to compose bitmasks for value comparisons. */ + var COMPARE_PARTIAL_FLAG = 1, + COMPARE_UNORDERED_FLAG = 2; - /** Used to compose bitmasks for comparison styles. */ - var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; + /** Used to compose bitmasks for function metadata. */ + var WRAP_BIND_FLAG = 1, + WRAP_PARTIAL_FLAG = 32; /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0, @@ -662,22 +662,21 @@ * @private * @param {*} value The value to compare. * @param {*} other The other value to compare. + * @param {boolean} bitmask The bitmask flags. + * 1 - Unordered comparison + * 2 - Partial comparison * @param {Function} [customizer] The function to customize comparisons. - * @param {boolean} [bitmask] The bitmask of comparison flags. - * The bitmask may be composed of the following flags: - * 1 - Unordered comparison - * 2 - Partial comparison * @param {Object} [stack] Tracks traversed `value` and `other` objects. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. */ - function baseIsEqual(value, other, customizer, bitmask, stack) { + function baseIsEqual(value, other, bitmask, customizer, stack) { if (value === other) { return true; } if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) { return value !== value && other !== other; } - return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack); + return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); } /** @@ -688,14 +687,13 @@ * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Function} [customizer] The function to customize comparisons. - * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` - * for more details. * @param {Object} [stack] Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ - function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) { + function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { var objIsArr = isArray(object), othIsArr = isArray(other), objTag = arrayTag, @@ -727,12 +725,12 @@ stack.push([other, object]); if (isSameTag && !objIsObj) { var result = (objIsArr) - ? equalArrays(object, other, equalFunc, customizer, bitmask, stack) - : equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack); + ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) + : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); stack.pop(); return result; } - if (!(bitmask & PARTIAL_COMPARE_FLAG)) { + if (!(bitmask & COMPARE_PARTIAL_FLAG)) { var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); @@ -740,7 +738,7 @@ var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other; - var result = equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack); + var result = equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); stack.pop(); return result; } @@ -748,7 +746,7 @@ if (!isSameTag) { return false; } - var result = equalObjects(object, other, equalFunc, customizer, bitmask, stack); + var result = equalObjects(object, other, bitmask, customizer, equalFunc, stack); stack.pop(); return result; } @@ -830,7 +828,7 @@ while (length--) { var key = props[length]; if (!(key in object && - baseIsEqual(source[key], object[key], undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG) + baseIsEqual(source[key], object[key], COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG) )) { return false; } @@ -845,7 +843,7 @@ * * @private * @param {Object} object The source object. - * @param {string[]} props The property identifiers to pick. + * @param {string[]} paths The property paths to pick. * @returns {Object} Returns the new object. */ function basePick(object, props) { @@ -1162,7 +1160,7 @@ if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } - var isBind = bitmask & BIND_FLAG, + var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func); function wrapper() { @@ -1191,15 +1189,14 @@ * @private * @param {Array} array The array to compare. * @param {Array} other The other array to compare. - * @param {Function} equalFunc The function to determine equivalents of values. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. * @param {Function} customizer The function to customize comparisons. - * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` - * for more details. + * @param {Function} equalFunc The function to determine equivalents of values. * @param {Object} stack Tracks traversed `array` and `other` objects. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. */ - function equalArrays(array, other, equalFunc, customizer, bitmask, stack) { - var isPartial = bitmask & PARTIAL_COMPARE_FLAG, + function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { + var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array.length, othLength = other.length; @@ -1208,7 +1205,7 @@ } var index = -1, result = true, - seen = (bitmask & UNORDERED_COMPARE_FLAG) ? [] : undefined; + seen = (bitmask & COMPARE_UNORDERED_FLAG) ? [] : undefined; // Ignore non-index properties. while (++index < arrLength) { @@ -1227,7 +1224,7 @@ if (seen) { if (!baseSome(other, function(othValue, othIndex) { if (!indexOf(seen, othIndex) && - (arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) { + (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { return seen.push(othIndex); } })) { @@ -1236,7 +1233,7 @@ } } else if (!( arrValue === othValue || - equalFunc(arrValue, othValue, customizer, bitmask, stack) + equalFunc(arrValue, othValue, bitmask, customizer, stack) )) { result = false; break; @@ -1256,14 +1253,13 @@ * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {string} tag The `toStringTag` of the objects to compare. - * @param {Function} equalFunc The function to determine equivalents of values. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. * @param {Function} customizer The function to customize comparisons. - * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` - * for more details. + * @param {Function} equalFunc The function to determine equivalents of values. * @param {Object} stack Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ - function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) { + function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { switch (tag) { case boolTag: @@ -1294,15 +1290,14 @@ * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. - * @param {Function} equalFunc The function to determine equivalents of values. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. * @param {Function} customizer The function to customize comparisons. - * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` - * for more details. + * @param {Function} equalFunc The function to determine equivalents of values. * @param {Object} stack Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ - function equalObjects(object, other, equalFunc, customizer, bitmask, stack) { - var isPartial = bitmask & PARTIAL_COMPARE_FLAG, + function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { + var isPartial = bitmask & COMPARE_PARTIAL_FLAG, objProps = keys(object), objLength = objProps.length, othProps = keys(other), @@ -1329,7 +1324,7 @@ var compared; // Recursively compare objects (susceptible to call stack limits). if (!(compared === undefined - ? (objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack)) + ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) : compared )) { result = false; @@ -1444,15 +1439,6 @@ */ var setToString = identity; - /** - * Converts `value` to a string key if it's not a string or symbol. - * - * @private - * @param {*} value The value to inspect. - * @returns {string|symbol} Returns the key. - */ - var toKey = String; - /*------------------------------------------------------------------------*/ /** @@ -2273,7 +2259,7 @@ * // => 'hi fred!' */ var bind = baseRest(function(func, thisArg, partials) { - return createPartial(func, BIND_FLAG | PARTIAL_FLAG, thisArg, partials); + return createPartial(func, WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG, thisArg, partials); }); /** @@ -3307,7 +3293,7 @@ * @memberOf _ * @category Object * @param {Object} object The source object. - * @param {...(string|string[])} [props] The property identifiers to pick. + * @param {...(string|string[])} [paths] The property paths to pick. * @returns {Object} Returns the new object. * @example * @@ -3316,8 +3302,8 @@ * _.pick(object, ['a', 'c']); * // => { 'a': 1, 'c': 3 } */ - var pick = flatRest(function(object, props) { - return object == null ? {} : basePick(object, baseMap(props, toKey)); + var pick = flatRest(function(object, paths) { + return object == null ? {} : basePick(object, paths); }); /** |