From 3dd9766d86118f14174b1caaf43cc1c52486b4a1 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Fri, 8 Apr 2016 00:00:14 -0700 Subject: [PATCH] Bump to v4.8.0. --- README.md | 2 +- lodash._stringtopath/README.md | 4 +- lodash._stringtopath/index.js | 389 +++++++++++++++--------------- lodash._stringtopath/package.json | 7 +- lodash.differenceby/README.md | 4 +- lodash.differenceby/index.js | 191 +++++---------- lodash.differenceby/package.json | 2 +- lodash.divide/README.md | 4 +- lodash.divide/index.js | 16 +- lodash.divide/package.json | 8 +- lodash.flatmapdeep/README.md | 4 +- lodash.flatmapdeep/index.js | 2 +- lodash.flatmapdeep/package.json | 4 +- lodash.flatmapdepth/README.md | 4 +- lodash.flatmapdepth/index.js | 10 +- lodash.flatmapdepth/package.json | 4 +- lodash.meanby/README.md | 4 +- lodash.meanby/index.js | 2 +- lodash.meanby/package.json | 4 +- lodash.multiply/README.md | 4 +- lodash.multiply/index.js | 16 +- lodash.multiply/package.json | 8 +- lodash.unionby/README.md | 4 +- lodash.unionby/index.js | 191 +++++---------- lodash.unionby/package.json | 2 +- lodash.update/README.md | 4 +- lodash.update/index.js | 33 ++- lodash.update/package.json | 4 +- lodash.updatewith/README.md | 4 +- lodash.updatewith/index.js | 33 ++- lodash.updatewith/package.json | 4 +- 31 files changed, 471 insertions(+), 501 deletions(-) diff --git a/README.md b/README.md index 76257256d..8fe8eace0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# lodash v4.7.1 +# lodash v4.8.0 The [lodash](https://lodash.com/) library exported as [npm packages](https://www.npmjs.com/browse/keyword/lodash-modularized) per method. diff --git a/lodash._stringtopath/README.md b/lodash._stringtopath/README.md index f12bf6d84..7e76277e2 100644 --- a/lodash._stringtopath/README.md +++ b/lodash._stringtopath/README.md @@ -1,4 +1,4 @@ -# lodash._stringtopath v4.7.1 +# lodash._stringtopath v4.8.0 The internal [lodash](https://lodash.com/) function `stringToPath` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var stringToPath = require('lodash._stringtopath'); ``` -See the [package source](https://github.com/lodash/lodash/blob/4.7.1-npm-packages/lodash._stringtopath) for more details. +See the [package source](https://github.com/lodash/lodash/blob/4.8.0-npm-packages/lodash._stringtopath) for more details. diff --git a/lodash._stringtopath/index.js b/lodash._stringtopath/index.js index 4679af688..99b3b6b6c 100644 --- a/lodash._stringtopath/index.js +++ b/lodash._stringtopath/index.js @@ -1,11 +1,12 @@ /** - * lodash 4.7.1 (Custom Build) + * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ +var baseToString = require('lodash._basetostring'); /** Used as the `TypeError` message for "Functions" methods. */ var FUNC_ERROR_TEXT = 'Expected a function'; @@ -13,13 +14,9 @@ var FUNC_ERROR_TEXT = 'Expected a function'; /** Used to stand-in for `undefined` hash values. */ var HASH_UNDEFINED = '__lodash_hash_undefined__'; -/** Used as references for various `Number` constants. */ -var INFINITY = 1 / 0; - /** `Object#toString` result references. */ var funcTag = '[object Function]', - genTag = '[object GeneratorFunction]', - symbolTag = '[object Symbol]'; + genTag = '[object GeneratorFunction]'; /** Used to match property names within property paths. */ var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; @@ -128,95 +125,236 @@ var reIsNative = RegExp('^' + ); /** Built-in value references. */ -var Symbol = root.Symbol, - splice = arrayProto.splice; +var splice = arrayProto.splice; /* Built-in method references that are verified to be native. */ var Map = getNative(root, 'Map'), nativeCreate = getNative(Object, 'create'); -/** Used to convert symbols to primitives and strings. */ -var symbolProto = Symbol ? Symbol.prototype : undefined, - symbolToString = symbolProto ? symbolProto.toString : undefined; - /** * Creates a hash object. * * @private * @constructor - * @returns {Object} Returns the new hash object. + * @param {Array} [entries] The key-value pairs to cache. */ -function Hash() {} +function Hash(entries) { + var index = -1, + length = entries ? entries.length : 0; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +/** + * Removes all key-value entries from the hash. + * + * @private + * @name clear + * @memberOf Hash + */ +function hashClear() { + this.__data__ = nativeCreate ? nativeCreate(null) : {}; +} /** * Removes `key` and its value from the hash. * * @private + * @name delete + * @memberOf Hash * @param {Object} hash The hash to modify. * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ -function hashDelete(hash, key) { - return hashHas(hash, key) && delete hash[key]; +function hashDelete(key) { + return this.has(key) && delete this.__data__[key]; } /** * Gets the hash value for `key`. * * @private - * @param {Object} hash The hash to query. + * @name get + * @memberOf Hash * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ -function hashGet(hash, key) { +function hashGet(key) { + var data = this.__data__; if (nativeCreate) { - var result = hash[key]; + var result = data[key]; return result === HASH_UNDEFINED ? undefined : result; } - return hasOwnProperty.call(hash, key) ? hash[key] : undefined; + return hasOwnProperty.call(data, key) ? data[key] : undefined; } /** * Checks if a hash value for `key` exists. * * @private - * @param {Object} hash The hash to query. + * @name has + * @memberOf Hash * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ -function hashHas(hash, key) { - return nativeCreate ? hash[key] !== undefined : hasOwnProperty.call(hash, key); +function hashHas(key) { + var data = this.__data__; + return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key); } /** * Sets the hash `key` to `value`. * * @private - * @param {Object} hash The hash to modify. + * @name set + * @memberOf Hash * @param {string} key The key of the value to set. * @param {*} value The value to set. + * @returns {Object} Returns the hash instance. */ -function hashSet(hash, key, value) { - hash[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; +function hashSet(key, value) { + var data = this.__data__; + data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; + return this; } -// Avoid inheriting from `Object.prototype` when possible. -Hash.prototype = nativeCreate ? nativeCreate(null) : objectProto; +// Add methods to `Hash`. +Hash.prototype.clear = hashClear; +Hash.prototype['delete'] = hashDelete; +Hash.prototype.get = hashGet; +Hash.prototype.has = hashHas; +Hash.prototype.set = hashSet; + +/** + * Creates an list cache object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function ListCache(entries) { + var index = -1, + length = entries ? entries.length : 0; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +/** + * Removes all key-value entries from the list cache. + * + * @private + * @name clear + * @memberOf ListCache + */ +function listCacheClear() { + this.__data__ = []; +} + +/** + * Removes `key` and its value from the list cache. + * + * @private + * @name delete + * @memberOf ListCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function listCacheDelete(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + return false; + } + var lastIndex = data.length - 1; + if (index == lastIndex) { + data.pop(); + } else { + splice.call(data, index, 1); + } + return true; +} + +/** + * Gets the list cache value for `key`. + * + * @private + * @name get + * @memberOf ListCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function listCacheGet(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + return index < 0 ? undefined : data[index][1]; +} + +/** + * Checks if a list cache value for `key` exists. + * + * @private + * @name has + * @memberOf ListCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function listCacheHas(key) { + return assocIndexOf(this.__data__, key) > -1; +} + +/** + * Sets the list cache `key` to `value`. + * + * @private + * @name set + * @memberOf ListCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the list cache instance. + */ +function listCacheSet(key, value) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + data.push([key, value]); + } else { + data[index][1] = value; + } + return this; +} + +// Add methods to `ListCache`. +ListCache.prototype.clear = listCacheClear; +ListCache.prototype['delete'] = listCacheDelete; +ListCache.prototype.get = listCacheGet; +ListCache.prototype.has = listCacheHas; +ListCache.prototype.set = listCacheSet; /** * Creates a map cache object to store key-value pairs. * * @private * @constructor - * @param {Array} [values] The values to cache. + * @param {Array} [entries] The key-value pairs to cache. */ -function MapCache(values) { +function MapCache(entries) { var index = -1, - length = values ? values.length : 0; + length = entries ? entries.length : 0; this.clear(); while (++index < length) { - var entry = values[index]; + var entry = entries[index]; this.set(entry[0], entry[1]); } } @@ -228,10 +366,10 @@ function MapCache(values) { * @name clear * @memberOf MapCache */ -function mapClear() { +function mapCacheClear() { this.__data__ = { 'hash': new Hash, - 'map': Map ? new Map : [], + 'map': new (Map || ListCache), 'string': new Hash }; } @@ -245,12 +383,8 @@ function mapClear() { * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ -function mapDelete(key) { - var data = this.__data__; - if (isKeyable(key)) { - return hashDelete(typeof key == 'string' ? data.string : data.hash, key); - } - return Map ? data.map['delete'](key) : assocDelete(data.map, key); +function mapCacheDelete(key) { + return getMapData(this, key)['delete'](key); } /** @@ -262,12 +396,8 @@ function mapDelete(key) { * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ -function mapGet(key) { - var data = this.__data__; - if (isKeyable(key)) { - return hashGet(typeof key == 'string' ? data.string : data.hash, key); - } - return Map ? data.map.get(key) : assocGet(data.map, key); +function mapCacheGet(key) { + return getMapData(this, key).get(key); } /** @@ -279,12 +409,8 @@ function mapGet(key) { * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ -function mapHas(key) { - var data = this.__data__; - if (isKeyable(key)) { - return hashHas(typeof key == 'string' ? data.string : data.hash, key); - } - return Map ? data.map.has(key) : assocHas(data.map, key); +function mapCacheHas(key) { + return getMapData(this, key).has(key); } /** @@ -297,71 +423,17 @@ function mapHas(key) { * @param {*} value The value to set. * @returns {Object} Returns the map cache instance. */ -function mapSet(key, value) { - var data = this.__data__; - if (isKeyable(key)) { - hashSet(typeof key == 'string' ? data.string : data.hash, key, value); - } else if (Map) { - data.map.set(key, value); - } else { - assocSet(data.map, key, value); - } +function mapCacheSet(key, value) { + getMapData(this, key).set(key, value); return this; } // Add methods to `MapCache`. -MapCache.prototype.clear = mapClear; -MapCache.prototype['delete'] = mapDelete; -MapCache.prototype.get = mapGet; -MapCache.prototype.has = mapHas; -MapCache.prototype.set = mapSet; - -/** - * Removes `key` and its value from the associative array. - * - * @private - * @param {Array} array The array to modify. - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ -function assocDelete(array, key) { - var index = assocIndexOf(array, key); - if (index < 0) { - return false; - } - var lastIndex = array.length - 1; - if (index == lastIndex) { - array.pop(); - } else { - splice.call(array, index, 1); - } - return true; -} - -/** - * Gets the associative array value for `key`. - * - * @private - * @param {Array} array The array to query. - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ -function assocGet(array, key) { - var index = assocIndexOf(array, key); - return index < 0 ? undefined : array[index][1]; -} - -/** - * Checks if an associative array value for `key` exists. - * - * @private - * @param {Array} array The array to query. - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ -function assocHas(array, key) { - return assocIndexOf(array, key) > -1; -} +MapCache.prototype.clear = mapCacheClear; +MapCache.prototype['delete'] = mapCacheDelete; +MapCache.prototype.get = mapCacheGet; +MapCache.prototype.has = mapCacheHas; +MapCache.prototype.set = mapCacheSet; /** * Gets the index at which the `key` is found in `array` of key-value pairs. @@ -382,20 +454,18 @@ function assocIndexOf(array, key) { } /** - * Sets the associative array `key` to `value`. + * Gets the data for `map`. * * @private - * @param {Array} array The array to modify. - * @param {string} key The key of the value to set. - * @param {*} value The value to set. + * @param {Object} map The map to query. + * @param {string} key The reference key. + * @returns {*} Returns the map data. */ -function assocSet(array, key, value) { - var index = assocIndexOf(array, key); - if (index < 0) { - array.push([key, value]); - } else { - array[index][1] = value; - } +function getMapData(map, key) { + var data = map.__data__; + return isKeyable(key) + ? data[typeof key == 'string' ? 'string' : 'hash'] + : data.map; } /** @@ -420,8 +490,9 @@ function getNative(object, key) { */ function isKeyable(value) { var type = typeof value; - return type == 'number' || type == 'boolean' || - (type == 'string' && value != '__proto__') || value == null; + return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') + ? (value !== '__proto__') + : (value === null); } /** @@ -477,7 +548,7 @@ function toSource(func) { * @category Function * @param {Function} func The function to have its output memoized. * @param {Function} [resolver] The function to resolve the cache key. - * @returns {Function} Returns the new memoizing function. + * @returns {Function} Returns the new memoized function. * @example * * var object = { 'a': 1, 'b': 2 }; @@ -617,34 +688,6 @@ function isObject(value) { return !!value && (type == 'object' || type == 'function'); } -/** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ -function isObjectLike(value) { - return !!value && typeof value == 'object'; -} - /** * Checks if `value` is a native function. * @@ -671,29 +714,6 @@ function isNative(value) { return pattern.test(toSource(value)); } -/** - * Checks if `value` is classified as a `Symbol` primitive or object. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, - * else `false`. - * @example - * - * _.isSymbol(Symbol.iterator); - * // => true - * - * _.isSymbol('abc'); - * // => false - */ -function isSymbol(value) { - return typeof value == 'symbol' || - (isObjectLike(value) && objectToString.call(value) == symbolTag); -} - /** * Converts `value` to a string. An empty string is returned for `null` * and `undefined` values. The sign of `-0` is preserved. @@ -716,18 +736,7 @@ function isSymbol(value) { * // => '1,2,3' */ function toString(value) { - // Exit early for strings to avoid a performance hit in some environments. - if (typeof value == 'string') { - return value; - } - if (value == null) { - return ''; - } - if (isSymbol(value)) { - return symbolToString ? symbolToString.call(value) : ''; - } - var result = (value + ''); - return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; + return value == null ? '' : baseToString(value); } module.exports = stringToPath; diff --git a/lodash._stringtopath/package.json b/lodash._stringtopath/package.json index 5512080ee..e3cbd4968 100644 --- a/lodash._stringtopath/package.json +++ b/lodash._stringtopath/package.json @@ -1,6 +1,6 @@ { "name": "lodash._stringtopath", - "version": "4.7.1", + "version": "4.8.0", "description": "The internal lodash function `stringToPath` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -12,5 +12,8 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, + "dependencies": { + "lodash._basetostring": "~4.12.0" + } } diff --git a/lodash.differenceby/README.md b/lodash.differenceby/README.md index e888b4d46..9d6db14b2 100644 --- a/lodash.differenceby/README.md +++ b/lodash.differenceby/README.md @@ -1,4 +1,4 @@ -# lodash.differenceby v4.7.1 +# lodash.differenceby v4.8.0 The [lodash](https://lodash.com/) method `_.differenceBy` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var differenceBy = require('lodash.differenceby'); ``` -See the [documentation](https://lodash.com/docs#differenceBy) or [package source](https://github.com/lodash/lodash/blob/4.7.1-npm-packages/lodash.differenceby) for more details. +See the [documentation](https://lodash.com/docs#differenceBy) or [package source](https://github.com/lodash/lodash/blob/4.8.0-npm-packages/lodash.differenceby) for more details. diff --git a/lodash.differenceby/index.js b/lodash.differenceby/index.js index b1798ea75..0823ac56a 100644 --- a/lodash.differenceby/index.js +++ b/lodash.differenceby/index.js @@ -62,7 +62,7 @@ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, /** * Used to match `RegExp` - * [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; @@ -147,7 +147,7 @@ function apply(func, thisArg, args) { * specifying an index to search from. * * @private - * @param {Array} [array] The array to search. + * @param {Array} [array] The array to inspect. * @param {*} target The value to search for. * @returns {boolean} Returns `true` if `target` is found, else `false`. */ @@ -160,7 +160,7 @@ function arrayIncludes(array, value) { * This function is like `arrayIncludes` except that it accepts a comparator. * * @private - * @param {Array} [array] The array to search. + * @param {Array} [array] The array to inspect. * @param {*} target The value to search for. * @param {Function} comparator The comparator invoked per element. * @returns {boolean} Returns `true` if `target` is found, else `false`. @@ -243,7 +243,7 @@ function arraySome(array, predicate) { * support for iteratee shorthands. * * @private - * @param {Array} array The array to search. + * @param {Array} array The array to inspect. * @param {Function} predicate The function invoked per iteration. * @param {number} fromIndex The index to search from. * @param {boolean} [fromRight] Specify iterating from right to left. @@ -265,7 +265,7 @@ function baseFindIndex(array, predicate, fromIndex, fromRight) { * The base implementation of `_.indexOf` without `fromIndex` bounds checks. * * @private - * @param {Array} array The array to search. + * @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`. @@ -402,7 +402,7 @@ function mapToArray(map) { } /** - * Creates a function that invokes `func` with its first argument transformed. + * Creates a unary function that invokes `func` with its argument transformed. * * @private * @param {Function} func The function to wrap. @@ -434,6 +434,7 @@ function setToArray(set) { /** Used for built-in method references. */ var arrayProto = Array.prototype, + funcProto = Function.prototype, objectProto = Object.prototype; /** Used to detect overreaching core-js shims. */ @@ -446,14 +447,14 @@ var maskSrcKey = (function() { }()); /** Used to resolve the decompiled source of functions. */ -var funcToString = Function.prototype.toString; +var funcToString = funcProto.toString; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -472,8 +473,7 @@ var Symbol = root.Symbol, spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined; /* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeGetPrototype = Object.getPrototypeOf, - nativeKeys = Object.keys, +var nativeKeys = overArg(Object.keys, Object), nativeMax = Math.max; /* Built-in method references that are verified to be native. */ @@ -942,11 +942,38 @@ Stack.prototype.get = stackGet; Stack.prototype.has = stackHas; Stack.prototype.set = stackSet; +/** + * Creates an array of the enumerable property names of the array-like `value`. + * + * @private + * @param {*} value The value to query. + * @param {boolean} inherited Specify returning inherited property names. + * @returns {Array} Returns the array of property names. + */ +function arrayLikeKeys(value, inherited) { + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. + // Safari 9 makes `arguments.length` enumerable in strict mode. + var result = (isArray(value) || isArguments(value)) + ? baseTimes(value.length, String) + : []; + + var length = result.length, + skipIndexes = !!length; + + for (var key in value) { + if ((inherited || hasOwnProperty.call(value, key)) && + !(skipIndexes && (key == 'length' || isIndex(key, length)))) { + result.push(key); + } + } + return result; +} + /** * Gets the index at which the `key` is found in `array` of key-value pairs. * * @private - * @param {Array} array The array to search. + * @param {Array} array The array to inspect. * @param {*} key The key to search for. * @returns {number} Returns the index of the matched value, else `-1`. */ @@ -1081,23 +1108,6 @@ function baseGetTag(value) { return objectToString.call(value); } -/** - * The base implementation of `_.has` without support for deep paths. - * - * @private - * @param {Object} [object] The object to query. - * @param {Array|string} key The key to check. - * @returns {boolean} Returns `true` if `key` exists, else `false`. - */ -function baseHas(object, key) { - // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`, - // that are composed entirely of index properties, return `false` for - // `hasOwnProperty` checks of them. - return object != null && - (hasOwnProperty.call(object, key) || - (typeof object == 'object' && key in object && getPrototype(object) === null)); -} - /** * The base implementation of `_.hasIn` without support for deep paths. * @@ -1300,14 +1310,24 @@ function baseIteratee(value) { } /** - * The base implementation of `_.keys` which doesn't skip the constructor - * property of prototypes or treat sparse arrays as dense. + * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ -var baseKeys = overArg(nativeKeys, Object); +function baseKeys(object) { + if (!isPrototype(object)) { + return nativeKeys(object); + } + var result = []; + for (var key in Object(object)) { + if (hasOwnProperty.call(object, key) && key != 'constructor') { + result.push(key); + } + } + return result; +} /** * The base implementation of `_.matches` which doesn't clone `source`. @@ -1542,7 +1562,7 @@ function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) { case regexpTag: case stringTag: // Coerce regexes to strings and treat strings, primitives and objects, - // as equal. See http://www.ecma-international.org/ecma-262/6.0/#sec-regexp.prototype.tostring + // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring // for more details. return object == (other + ''); @@ -1604,7 +1624,7 @@ function equalObjects(object, other, equalFunc, customizer, bitmask, stack) { var index = objLength; while (index--) { var key = objProps[index]; - if (!(isPartial ? key in other : baseHas(other, key))) { + if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { return false; } } @@ -1655,19 +1675,6 @@ function equalObjects(object, other, equalFunc, customizer, bitmask, stack) { return result; } -/** - * Gets the "length" property value of `object`. - * - * **Note:** This function is used to avoid a - * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects - * Safari on at least iOS 8.1-8.3 ARM64. - * - * @private - * @param {Object} object The object to query. - * @returns {*} Returns the "length" value. - */ -var getLength = baseProperty('length'); - /** * Gets the data for `map`. * @@ -1716,15 +1723,6 @@ function getNative(object, key) { return baseIsNative(value) ? value : undefined; } -/** - * Gets the `[[Prototype]]` of `value`. - * - * @private - * @param {*} value The value to query. - * @returns {null|Object} Returns the `[[Prototype]]`. - */ -var getPrototype = overArg(nativeGetPrototype, Object); - /** * Gets the `toStringTag` of `value`. * @@ -1735,7 +1733,7 @@ var getPrototype = overArg(nativeGetPrototype, Object); var getTag = baseGetTag; // Fallback for data views, maps, sets, and weak maps in IE 11, -// for data views in Edge, and promises in Node.js. +// for data views in Edge < 14, and promises in Node.js. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || (Map && getTag(new Map) != mapTag) || (Promise && getTag(Promise.resolve()) != promiseTag) || @@ -1787,24 +1785,7 @@ function hasPath(object, path, hasFunc) { } var length = object ? object.length : 0; return !!length && isLength(length) && isIndex(key, length) && - (isArray(object) || isString(object) || isArguments(object)); -} - -/** - * Creates an array of index keys for `object` values of arrays, - * `arguments` objects, and strings, otherwise `null` is returned. - * - * @private - * @param {Object} object The object to query. - * @returns {Array|null} Returns index keys, else `null`. - */ -function indexKeys(object) { - var length = object ? object.length : undefined; - if (isLength(length) && - (isArray(object) || isString(object) || isArguments(object))) { - return baseTimes(length, String); - } - return null; + (isArray(object) || isArguments(object)); } /** @@ -2043,7 +2024,7 @@ function last(array) { * **Note:** The cache is exposed as the `cache` property on the memoized * function. Its creation may be customized by replacing the `_.memoize.Cache` * constructor with one whose instances implement the - * [`Map`](http://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-map-prototype-object) + * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) * method interface of `delete`, `get`, `has`, and `set`. * * @static @@ -2102,7 +2083,7 @@ memoize.Cache = MapCache; /** * Performs a - * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static @@ -2155,7 +2136,7 @@ function eq(value, other) { * // => false */ function isArguments(value) { - // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode. + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); } @@ -2211,7 +2192,7 @@ var isArray = Array.isArray; * // => false */ function isArrayLike(value) { - return value != null && isLength(getLength(value)) && !isFunction(value); + return value != null && isLength(value.length) && !isFunction(value); } /** @@ -2262,8 +2243,7 @@ function isArrayLikeObject(value) { */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array and weak map constructors, - // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + // in Safari 8-9 which returns 'object' for typed array and other constructors. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } @@ -2271,16 +2251,15 @@ function isFunction(value) { /** * Checks if `value` is a valid array-like length. * - * **Note:** This function is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); @@ -2302,7 +2281,7 @@ function isLength(value) { /** * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static @@ -2358,28 +2337,6 @@ function isObjectLike(value) { return !!value && typeof value == 'object'; } -/** - * Checks if `value` is classified as a `String` primitive or object. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a string, else `false`. - * @example - * - * _.isString('abc'); - * // => true - * - * _.isString(1); - * // => false - */ -function isString(value) { - return typeof value == 'string' || - (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag); -} - /** * Checks if `value` is classified as a `Symbol` primitive or object. * @@ -2510,7 +2467,7 @@ function hasIn(object, path) { * Creates an array of the own enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. See the - * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) + * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) * for more details. * * @static @@ -2535,23 +2492,7 @@ function hasIn(object, path) { * // => ['0', '1'] */ function keys(object) { - var isProto = isPrototype(object); - if (!(isProto || isArrayLike(object))) { - return baseKeys(object); - } - var indexes = indexKeys(object), - skipIndexes = !!indexes, - result = indexes || [], - length = result.length; - - for (var key in object) { - if (baseHas(object, key) && - !(skipIndexes && (key == 'length' || isIndex(key, length))) && - !(isProto && key == 'constructor')) { - result.push(key); - } - } - return result; + return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); } /** diff --git a/lodash.differenceby/package.json b/lodash.differenceby/package.json index 50c248aa1..35841b057 100644 --- a/lodash.differenceby/package.json +++ b/lodash.differenceby/package.json @@ -1,6 +1,6 @@ { "name": "lodash.differenceby", - "version": "4.7.1", + "version": "4.8.0", "description": "The lodash method `_.differenceBy` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash.divide/README.md b/lodash.divide/README.md index 31b8afd2c..83a020e8c 100644 --- a/lodash.divide/README.md +++ b/lodash.divide/README.md @@ -1,4 +1,4 @@ -# lodash.divide v4.7.0 +# lodash.divide v4.8.0 The [lodash](https://lodash.com/) method `_.divide` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var divide = require('lodash.divide'); ``` -See the [documentation](https://lodash.com/docs#divide) or [package source](https://github.com/lodash/lodash/blob/4.7.0-npm-packages/lodash.divide) for more details. +See the [documentation](https://lodash.com/docs#divide) or [package source](https://github.com/lodash/lodash/blob/4.8.0-npm-packages/lodash.divide) for more details. diff --git a/lodash.divide/index.js b/lodash.divide/index.js index 643cf5590..5eaab1dee 100644 --- a/lodash.divide/index.js +++ b/lodash.divide/index.js @@ -1,11 +1,13 @@ /** - * lodash 4.7.0 (Custom Build) + * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ +var baseToNumber = require('lodash._basetonumber'), + baseToString = require('lodash._basetostring'); /** * Creates a function that performs a mathematical operation on two values. @@ -24,7 +26,17 @@ function createMathOperation(operator) { result = value; } if (other !== undefined) { - result = result === undefined ? other : operator(result, other); + if (result === undefined) { + return other; + } + if (typeof value == 'string' || typeof other == 'string') { + value = baseToString(value); + other = baseToString(other); + } else { + value = baseToNumber(value); + other = baseToNumber(other); + } + result = operator(value, other); } return result; }; diff --git a/lodash.divide/package.json b/lodash.divide/package.json index 7ab2def90..c2d1d3e7e 100644 --- a/lodash.divide/package.json +++ b/lodash.divide/package.json @@ -1,6 +1,6 @@ { "name": "lodash.divide", - "version": "4.7.0", + "version": "4.8.0", "description": "The lodash method `_.divide` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -13,5 +13,9 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, + "dependencies": { + "lodash._basetonumber": "~4.12.0", + "lodash._basetostring": "~4.12.0" + } } diff --git a/lodash.flatmapdeep/README.md b/lodash.flatmapdeep/README.md index c81a41e69..28cd83a38 100644 --- a/lodash.flatmapdeep/README.md +++ b/lodash.flatmapdeep/README.md @@ -1,4 +1,4 @@ -# lodash.flatmapdeep v4.7.0 +# lodash.flatmapdeep v4.8.0 The [lodash](https://lodash.com/) method `_.flatMapDeep` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var flatMapDeep = require('lodash.flatmapdeep'); ``` -See the [documentation](https://lodash.com/docs#flatMapDeep) or [package source](https://github.com/lodash/lodash/blob/4.7.0-npm-packages/lodash.flatmapdeep) for more details. +See the [documentation](https://lodash.com/docs#flatMapDeep) or [package source](https://github.com/lodash/lodash/blob/4.8.0-npm-packages/lodash.flatmapdeep) for more details. diff --git a/lodash.flatmapdeep/index.js b/lodash.flatmapdeep/index.js index b39c878d5..91fc3869c 100644 --- a/lodash.flatmapdeep/index.js +++ b/lodash.flatmapdeep/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.7.0 (Custom Build) + * lodash 4.8.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors * Released under MIT license diff --git a/lodash.flatmapdeep/package.json b/lodash.flatmapdeep/package.json index 93072e369..313338afd 100644 --- a/lodash.flatmapdeep/package.json +++ b/lodash.flatmapdeep/package.json @@ -1,6 +1,6 @@ { "name": "lodash.flatmapdeep", - "version": "4.7.0", + "version": "4.8.0", "description": "The lodash method `_.flatMapDeep` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,7 +15,7 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._baseflatten": "~4.1.0", + "lodash._baseflatten": "~4.2.0", "lodash.map": "^4.0.0" } } diff --git a/lodash.flatmapdepth/README.md b/lodash.flatmapdepth/README.md index 424ad9339..1de689749 100644 --- a/lodash.flatmapdepth/README.md +++ b/lodash.flatmapdepth/README.md @@ -1,4 +1,4 @@ -# lodash.flatmapdepth v4.7.0 +# lodash.flatmapdepth v4.8.0 The [lodash](https://lodash.com/) method `_.flatMapDepth` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var flatMapDepth = require('lodash.flatmapdepth'); ``` -See the [documentation](https://lodash.com/docs#flatMapDepth) or [package source](https://github.com/lodash/lodash/blob/4.7.0-npm-packages/lodash.flatmapdepth) for more details. +See the [documentation](https://lodash.com/docs#flatMapDepth) or [package source](https://github.com/lodash/lodash/blob/4.8.0-npm-packages/lodash.flatmapdepth) for more details. diff --git a/lodash.flatmapdepth/index.js b/lodash.flatmapdepth/index.js index 458007396..4c54ae7fc 100644 --- a/lodash.flatmapdepth/index.js +++ b/lodash.flatmapdepth/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.7.0 (Custom Build) + * lodash 4.8.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors * Released under MIT license @@ -38,7 +38,8 @@ var freeParseInt = parseInt; var objectProto = Object.prototype; /** - * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -97,8 +98,9 @@ function isFunction(value) { } /** - * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ diff --git a/lodash.flatmapdepth/package.json b/lodash.flatmapdepth/package.json index 713113abc..1c3ddaece 100644 --- a/lodash.flatmapdepth/package.json +++ b/lodash.flatmapdepth/package.json @@ -1,6 +1,6 @@ { "name": "lodash.flatmapdepth", - "version": "4.7.0", + "version": "4.8.0", "description": "The lodash method `_.flatMapDepth` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,7 +15,7 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._baseflatten": "~4.1.0", + "lodash._baseflatten": "~4.2.0", "lodash.map": "^4.0.0" } } diff --git a/lodash.meanby/README.md b/lodash.meanby/README.md index da1a6fb20..dc5ad87c6 100644 --- a/lodash.meanby/README.md +++ b/lodash.meanby/README.md @@ -1,4 +1,4 @@ -# lodash.meanby v4.7.0 +# lodash.meanby v4.8.0 The [lodash](https://lodash.com/) method `_.meanBy` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var meanBy = require('lodash.meanby'); ``` -See the [documentation](https://lodash.com/docs#meanBy) or [package source](https://github.com/lodash/lodash/blob/4.7.0-npm-packages/lodash.meanby) for more details. +See the [documentation](https://lodash.com/docs#meanBy) or [package source](https://github.com/lodash/lodash/blob/4.8.0-npm-packages/lodash.meanby) for more details. diff --git a/lodash.meanby/index.js b/lodash.meanby/index.js index c89972519..a8aa16d18 100644 --- a/lodash.meanby/index.js +++ b/lodash.meanby/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.7.0 (Custom Build) + * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors * Released under MIT license diff --git a/lodash.meanby/package.json b/lodash.meanby/package.json index 4c59e68b8..e8963f4bc 100644 --- a/lodash.meanby/package.json +++ b/lodash.meanby/package.json @@ -1,6 +1,6 @@ { "name": "lodash.meanby", - "version": "4.7.0", + "version": "4.8.0", "description": "The lodash method `_.meanBy` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,6 +15,6 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._baseiteratee": "~4.6.0" + "lodash._baseiteratee": "~4.7.0" } } diff --git a/lodash.multiply/README.md b/lodash.multiply/README.md index 1cea10226..10501f704 100644 --- a/lodash.multiply/README.md +++ b/lodash.multiply/README.md @@ -1,4 +1,4 @@ -# lodash.multiply v4.7.0 +# lodash.multiply v4.8.0 The [lodash](https://lodash.com/) method `_.multiply` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var multiply = require('lodash.multiply'); ``` -See the [documentation](https://lodash.com/docs#multiply) or [package source](https://github.com/lodash/lodash/blob/4.7.0-npm-packages/lodash.multiply) for more details. +See the [documentation](https://lodash.com/docs#multiply) or [package source](https://github.com/lodash/lodash/blob/4.8.0-npm-packages/lodash.multiply) for more details. diff --git a/lodash.multiply/index.js b/lodash.multiply/index.js index 827475204..30154f213 100644 --- a/lodash.multiply/index.js +++ b/lodash.multiply/index.js @@ -1,11 +1,13 @@ /** - * lodash 4.7.0 (Custom Build) + * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ +var baseToNumber = require('lodash._basetonumber'), + baseToString = require('lodash._basetostring'); /** * Creates a function that performs a mathematical operation on two values. @@ -24,7 +26,17 @@ function createMathOperation(operator) { result = value; } if (other !== undefined) { - result = result === undefined ? other : operator(result, other); + if (result === undefined) { + return other; + } + if (typeof value == 'string' || typeof other == 'string') { + value = baseToString(value); + other = baseToString(other); + } else { + value = baseToNumber(value); + other = baseToNumber(other); + } + result = operator(value, other); } return result; }; diff --git a/lodash.multiply/package.json b/lodash.multiply/package.json index eb9cf583a..c51d206db 100644 --- a/lodash.multiply/package.json +++ b/lodash.multiply/package.json @@ -1,6 +1,6 @@ { "name": "lodash.multiply", - "version": "4.7.0", + "version": "4.8.0", "description": "The lodash method `_.multiply` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -13,5 +13,9 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, + "dependencies": { + "lodash._basetonumber": "~4.12.0", + "lodash._basetostring": "~4.12.0" + } } diff --git a/lodash.unionby/README.md b/lodash.unionby/README.md index dbc53cc9a..9954ad4a4 100644 --- a/lodash.unionby/README.md +++ b/lodash.unionby/README.md @@ -1,4 +1,4 @@ -# lodash.unionby v4.7.1 +# lodash.unionby v4.8.0 The [lodash](https://lodash.com/) method `_.unionBy` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var unionBy = require('lodash.unionby'); ``` -See the [documentation](https://lodash.com/docs#unionBy) or [package source](https://github.com/lodash/lodash/blob/4.7.1-npm-packages/lodash.unionby) for more details. +See the [documentation](https://lodash.com/docs#unionBy) or [package source](https://github.com/lodash/lodash/blob/4.8.0-npm-packages/lodash.unionby) for more details. diff --git a/lodash.unionby/index.js b/lodash.unionby/index.js index 9e9193f3d..b61497ae1 100644 --- a/lodash.unionby/index.js +++ b/lodash.unionby/index.js @@ -62,7 +62,7 @@ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, /** * Used to match `RegExp` - * [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; @@ -147,7 +147,7 @@ function apply(func, thisArg, args) { * specifying an index to search from. * * @private - * @param {Array} [array] The array to search. + * @param {Array} [array] The array to inspect. * @param {*} target The value to search for. * @returns {boolean} Returns `true` if `target` is found, else `false`. */ @@ -160,7 +160,7 @@ function arrayIncludes(array, value) { * This function is like `arrayIncludes` except that it accepts a comparator. * * @private - * @param {Array} [array] The array to search. + * @param {Array} [array] The array to inspect. * @param {*} target The value to search for. * @param {Function} comparator The comparator invoked per element. * @returns {boolean} Returns `true` if `target` is found, else `false`. @@ -223,7 +223,7 @@ function arraySome(array, predicate) { * support for iteratee shorthands. * * @private - * @param {Array} array The array to search. + * @param {Array} array The array to inspect. * @param {Function} predicate The function invoked per iteration. * @param {number} fromIndex The index to search from. * @param {boolean} [fromRight] Specify iterating from right to left. @@ -245,7 +245,7 @@ function baseFindIndex(array, predicate, fromIndex, fromRight) { * The base implementation of `_.indexOf` without `fromIndex` bounds checks. * * @private - * @param {Array} array The array to search. + * @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`. @@ -382,7 +382,7 @@ function mapToArray(map) { } /** - * Creates a function that invokes `func` with its first argument transformed. + * Creates a unary function that invokes `func` with its argument transformed. * * @private * @param {Function} func The function to wrap. @@ -414,6 +414,7 @@ function setToArray(set) { /** Used for built-in method references. */ var arrayProto = Array.prototype, + funcProto = Function.prototype, objectProto = Object.prototype; /** Used to detect overreaching core-js shims. */ @@ -426,14 +427,14 @@ var maskSrcKey = (function() { }()); /** Used to resolve the decompiled source of functions. */ -var funcToString = Function.prototype.toString; +var funcToString = funcProto.toString; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -452,8 +453,7 @@ var Symbol = root.Symbol, spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined; /* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeGetPrototype = Object.getPrototypeOf, - nativeKeys = Object.keys, +var nativeKeys = overArg(Object.keys, Object), nativeMax = Math.max; /* Built-in method references that are verified to be native. */ @@ -922,11 +922,38 @@ Stack.prototype.get = stackGet; Stack.prototype.has = stackHas; Stack.prototype.set = stackSet; +/** + * Creates an array of the enumerable property names of the array-like `value`. + * + * @private + * @param {*} value The value to query. + * @param {boolean} inherited Specify returning inherited property names. + * @returns {Array} Returns the array of property names. + */ +function arrayLikeKeys(value, inherited) { + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. + // Safari 9 makes `arguments.length` enumerable in strict mode. + var result = (isArray(value) || isArguments(value)) + ? baseTimes(value.length, String) + : []; + + var length = result.length, + skipIndexes = !!length; + + for (var key in value) { + if ((inherited || hasOwnProperty.call(value, key)) && + !(skipIndexes && (key == 'length' || isIndex(key, length)))) { + result.push(key); + } + } + return result; +} + /** * Gets the index at which the `key` is found in `array` of key-value pairs. * * @private - * @param {Array} array The array to search. + * @param {Array} array The array to inspect. * @param {*} key The key to search for. * @returns {number} Returns the index of the matched value, else `-1`. */ @@ -1005,23 +1032,6 @@ function baseGetTag(value) { return objectToString.call(value); } -/** - * The base implementation of `_.has` without support for deep paths. - * - * @private - * @param {Object} [object] The object to query. - * @param {Array|string} key The key to check. - * @returns {boolean} Returns `true` if `key` exists, else `false`. - */ -function baseHas(object, key) { - // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`, - // that are composed entirely of index properties, return `false` for - // `hasOwnProperty` checks of them. - return object != null && - (hasOwnProperty.call(object, key) || - (typeof object == 'object' && key in object && getPrototype(object) === null)); -} - /** * The base implementation of `_.hasIn` without support for deep paths. * @@ -1224,14 +1234,24 @@ function baseIteratee(value) { } /** - * The base implementation of `_.keys` which doesn't skip the constructor - * property of prototypes or treat sparse arrays as dense. + * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ -var baseKeys = overArg(nativeKeys, Object); +function baseKeys(object) { + if (!isPrototype(object)) { + return nativeKeys(object); + } + var result = []; + for (var key in Object(object)) { + if (hasOwnProperty.call(object, key) && key != 'constructor') { + result.push(key); + } + } + return result; +} /** * The base implementation of `_.matches` which doesn't clone `source`. @@ -1538,7 +1558,7 @@ function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) { case regexpTag: case stringTag: // Coerce regexes to strings and treat strings, primitives and objects, - // as equal. See http://www.ecma-international.org/ecma-262/6.0/#sec-regexp.prototype.tostring + // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring // for more details. return object == (other + ''); @@ -1600,7 +1620,7 @@ function equalObjects(object, other, equalFunc, customizer, bitmask, stack) { var index = objLength; while (index--) { var key = objProps[index]; - if (!(isPartial ? key in other : baseHas(other, key))) { + if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { return false; } } @@ -1651,19 +1671,6 @@ function equalObjects(object, other, equalFunc, customizer, bitmask, stack) { return result; } -/** - * Gets the "length" property value of `object`. - * - * **Note:** This function is used to avoid a - * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects - * Safari on at least iOS 8.1-8.3 ARM64. - * - * @private - * @param {Object} object The object to query. - * @returns {*} Returns the "length" value. - */ -var getLength = baseProperty('length'); - /** * Gets the data for `map`. * @@ -1712,15 +1719,6 @@ function getNative(object, key) { return baseIsNative(value) ? value : undefined; } -/** - * Gets the `[[Prototype]]` of `value`. - * - * @private - * @param {*} value The value to query. - * @returns {null|Object} Returns the `[[Prototype]]`. - */ -var getPrototype = overArg(nativeGetPrototype, Object); - /** * Gets the `toStringTag` of `value`. * @@ -1731,7 +1729,7 @@ var getPrototype = overArg(nativeGetPrototype, Object); var getTag = baseGetTag; // Fallback for data views, maps, sets, and weak maps in IE 11, -// for data views in Edge, and promises in Node.js. +// for data views in Edge < 14, and promises in Node.js. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || (Map && getTag(new Map) != mapTag) || (Promise && getTag(Promise.resolve()) != promiseTag) || @@ -1783,24 +1781,7 @@ function hasPath(object, path, hasFunc) { } var length = object ? object.length : 0; return !!length && isLength(length) && isIndex(key, length) && - (isArray(object) || isString(object) || isArguments(object)); -} - -/** - * Creates an array of index keys for `object` values of arrays, - * `arguments` objects, and strings, otherwise `null` is returned. - * - * @private - * @param {Object} object The object to query. - * @returns {Array|null} Returns index keys, else `null`. - */ -function indexKeys(object) { - var length = object ? object.length : undefined; - if (isLength(length) && - (isArray(object) || isString(object) || isArguments(object))) { - return baseTimes(length, String); - } - return null; + (isArray(object) || isArguments(object)); } /** @@ -2036,7 +2017,7 @@ var unionBy = baseRest(function(arrays) { * **Note:** The cache is exposed as the `cache` property on the memoized * function. Its creation may be customized by replacing the `_.memoize.Cache` * constructor with one whose instances implement the - * [`Map`](http://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-map-prototype-object) + * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) * method interface of `delete`, `get`, `has`, and `set`. * * @static @@ -2095,7 +2076,7 @@ memoize.Cache = MapCache; /** * Performs a - * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static @@ -2148,7 +2129,7 @@ function eq(value, other) { * // => false */ function isArguments(value) { - // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode. + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); } @@ -2204,7 +2185,7 @@ var isArray = Array.isArray; * // => false */ function isArrayLike(value) { - return value != null && isLength(getLength(value)) && !isFunction(value); + return value != null && isLength(value.length) && !isFunction(value); } /** @@ -2255,8 +2236,7 @@ function isArrayLikeObject(value) { */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array and weak map constructors, - // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + // in Safari 8-9 which returns 'object' for typed array and other constructors. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } @@ -2264,16 +2244,15 @@ function isFunction(value) { /** * Checks if `value` is a valid array-like length. * - * **Note:** This function is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); @@ -2295,7 +2274,7 @@ function isLength(value) { /** * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static @@ -2351,28 +2330,6 @@ function isObjectLike(value) { return !!value && typeof value == 'object'; } -/** - * Checks if `value` is classified as a `String` primitive or object. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a string, else `false`. - * @example - * - * _.isString('abc'); - * // => true - * - * _.isString(1); - * // => false - */ -function isString(value) { - return typeof value == 'string' || - (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag); -} - /** * Checks if `value` is classified as a `Symbol` primitive or object. * @@ -2503,7 +2460,7 @@ function hasIn(object, path) { * Creates an array of the own enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. See the - * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) + * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) * for more details. * * @static @@ -2528,23 +2485,7 @@ function hasIn(object, path) { * // => ['0', '1'] */ function keys(object) { - var isProto = isPrototype(object); - if (!(isProto || isArrayLike(object))) { - return baseKeys(object); - } - var indexes = indexKeys(object), - skipIndexes = !!indexes, - result = indexes || [], - length = result.length; - - for (var key in object) { - if (baseHas(object, key) && - !(skipIndexes && (key == 'length' || isIndex(key, length))) && - !(isProto && key == 'constructor')) { - result.push(key); - } - } - return result; + return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); } /** diff --git a/lodash.unionby/package.json b/lodash.unionby/package.json index 00797d7a5..8d40dd27c 100644 --- a/lodash.unionby/package.json +++ b/lodash.unionby/package.json @@ -1,6 +1,6 @@ { "name": "lodash.unionby", - "version": "4.7.1", + "version": "4.8.0", "description": "The lodash method `_.unionBy` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash.update/README.md b/lodash.update/README.md index 5289b0603..b30fb2964 100644 --- a/lodash.update/README.md +++ b/lodash.update/README.md @@ -1,4 +1,4 @@ -# lodash.update v4.7.0 +# lodash.update v4.8.0 The [lodash](https://lodash.com/) method `_.update` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var update = require('lodash.update'); ``` -See the [documentation](https://lodash.com/docs#update) or [package source](https://github.com/lodash/lodash/blob/4.7.0-npm-packages/lodash.update) for more details. +See the [documentation](https://lodash.com/docs#update) or [package source](https://github.com/lodash/lodash/blob/4.8.0-npm-packages/lodash.update) for more details. diff --git a/lodash.update/index.js b/lodash.update/index.js index 643e95e1f..24594ce9a 100644 --- a/lodash.update/index.js +++ b/lodash.update/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.7.0 (Custom Build) + * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors * Released under MIT license @@ -9,6 +9,9 @@ var baseSet = require('lodash._baseset'), stringToPath = require('lodash._stringtopath'); +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0; + /** `Object#toString` result references. */ var symbolTag = '[object Symbol]'; @@ -41,7 +44,7 @@ function baseGet(object, path) { length = path.length; while (object != null && index < length) { - object = object[path[index++]]; + object = object[toKey(path[index++])]; } return (index && index == length) ? object : undefined; } @@ -91,13 +94,31 @@ function castPath(value) { * @returns {boolean} Returns `true` if `value` is a property name, else `false`. */ function isKey(value, object) { + if (isArray(value)) { + return false; + } var type = typeof value; - if (type == 'number' || type == 'symbol') { + if (type == 'number' || type == 'symbol' || type == 'boolean' || + value == null || isSymbol(value)) { return true; } - return !isArray(value) && - (isSymbol(value) || reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); + return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || + (object != null && value in Object(object)); +} + +/** + * 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. + */ +function toKey(value) { + if (typeof value == 'string' || isSymbol(value)) { + return value; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; } /** diff --git a/lodash.update/package.json b/lodash.update/package.json index 0f22f0493..d110f3eb6 100644 --- a/lodash.update/package.json +++ b/lodash.update/package.json @@ -1,6 +1,6 @@ { "name": "lodash.update", - "version": "4.7.0", + "version": "4.8.0", "description": "The lodash method `_.update` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -16,6 +16,6 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._baseset": "~4.2.0", - "lodash._stringtopath": "~4.7.0" + "lodash._stringtopath": "~4.8.0" } } diff --git a/lodash.updatewith/README.md b/lodash.updatewith/README.md index ef8d23ce2..ef6f0a0b1 100644 --- a/lodash.updatewith/README.md +++ b/lodash.updatewith/README.md @@ -1,4 +1,4 @@ -# lodash.updatewith v4.7.0 +# lodash.updatewith v4.8.0 The [lodash](https://lodash.com/) method `_.updateWith` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var updateWith = require('lodash.updatewith'); ``` -See the [documentation](https://lodash.com/docs#updateWith) or [package source](https://github.com/lodash/lodash/blob/4.7.0-npm-packages/lodash.updatewith) for more details. +See the [documentation](https://lodash.com/docs#updateWith) or [package source](https://github.com/lodash/lodash/blob/4.8.0-npm-packages/lodash.updatewith) for more details. diff --git a/lodash.updatewith/index.js b/lodash.updatewith/index.js index b4486591f..3cb16c531 100644 --- a/lodash.updatewith/index.js +++ b/lodash.updatewith/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.7.0 (Custom Build) + * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors * Released under MIT license @@ -9,6 +9,9 @@ var baseSet = require('lodash._baseset'), stringToPath = require('lodash._stringtopath'); +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0; + /** `Object#toString` result references. */ var symbolTag = '[object Symbol]'; @@ -41,7 +44,7 @@ function baseGet(object, path) { length = path.length; while (object != null && index < length) { - object = object[path[index++]]; + object = object[toKey(path[index++])]; } return (index && index == length) ? object : undefined; } @@ -91,13 +94,31 @@ function castPath(value) { * @returns {boolean} Returns `true` if `value` is a property name, else `false`. */ function isKey(value, object) { + if (isArray(value)) { + return false; + } var type = typeof value; - if (type == 'number' || type == 'symbol') { + if (type == 'number' || type == 'symbol' || type == 'boolean' || + value == null || isSymbol(value)) { return true; } - return !isArray(value) && - (isSymbol(value) || reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object))); + return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || + (object != null && value in Object(object)); +} + +/** + * 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. + */ +function toKey(value) { + if (typeof value == 'string' || isSymbol(value)) { + return value; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; } /** diff --git a/lodash.updatewith/package.json b/lodash.updatewith/package.json index e04f597c1..4aee1267b 100644 --- a/lodash.updatewith/package.json +++ b/lodash.updatewith/package.json @@ -1,6 +1,6 @@ { "name": "lodash.updatewith", - "version": "4.7.0", + "version": "4.8.0", "description": "The lodash method `_.updateWith` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -16,6 +16,6 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._baseset": "~4.2.0", - "lodash._stringtopath": "~4.7.0" + "lodash._stringtopath": "~4.8.0" } }