diff --git a/README.md b/README.md
index 3e9a5f41b..c0cef4c8a 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# lodash v4.5.6
+# lodash v4.5.7
The [lodash](https://lodash.com/) library exported as [npm packages](https://www.npmjs.com/browse/keyword/lodash-modularized) per method.
diff --git a/lodash._baseclone/README.md b/lodash._baseclone/README.md
index 19495c339..fbcf773e9 100644
--- a/lodash._baseclone/README.md
+++ b/lodash._baseclone/README.md
@@ -1,4 +1,4 @@
-# lodash._baseclone v4.5.6
+# lodash._baseclone v4.5.7
The internal [lodash](https://lodash.com/) function `baseClone` exported as a [Node.js](https://nodejs.org/) module.
@@ -15,4 +15,4 @@ In Node.js:
var baseClone = require('lodash._baseclone');
```
-See the [package source](https://github.com/lodash/lodash/blob/4.5.6-npm-packages/lodash._baseclone) for more details.
+See the [package source](https://github.com/lodash/lodash/blob/4.5.7-npm-packages/lodash._baseclone) for more details.
diff --git a/lodash._baseclone/index.js b/lodash._baseclone/index.js
index 8b796bdfc..f98f4786e 100644
--- a/lodash._baseclone/index.js
+++ b/lodash._baseclone/index.js
@@ -1,5 +1,5 @@
/**
- * lodash 4.5.6 (Custom Build)
+ * lodash (Custom Build)
* Build: `lodash modularize exports="npm" -o ./`
* Copyright jQuery Foundation and other contributors
* Released under MIT license
@@ -262,25 +262,11 @@ function isHostObject(value) {
}
/**
- * Checks if `value` is a valid array-like index.
- *
- * @private
- * @param {*} value The value to check.
- * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
- * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
- */
-function isIndex(value, length) {
- value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
- length = length == null ? MAX_SAFE_INTEGER : length;
- return value > -1 && value % 1 == 0 && value < length;
-}
-
-/**
- * Converts `map` to an array.
+ * Converts `map` to its key-value pairs.
*
* @private
* @param {Object} map The map to convert.
- * @returns {Array} Returns the converted array.
+ * @returns {Array} Returns the key-value pairs.
*/
function mapToArray(map) {
var index = -1,
@@ -293,11 +279,11 @@ function mapToArray(map) {
}
/**
- * Converts `set` to an array.
+ * Converts `set` to an array of its values.
*
* @private
* @param {Object} set The set to convert.
- * @returns {Array} Returns the converted array.
+ * @returns {Array} Returns the values.
*/
function setToArray(set) {
var index = -1,
@@ -369,79 +355,225 @@ var symbolProto = Symbol ? Symbol.prototype : undefined,
*
* @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]);
}
}
@@ -453,10 +585,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
};
}
@@ -470,12 +602,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);
}
/**
@@ -487,12 +615,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);
}
/**
@@ -504,12 +628,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);
}
/**
@@ -522,41 +642,27 @@ 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;
+MapCache.prototype.clear = mapCacheClear;
+MapCache.prototype['delete'] = mapCacheDelete;
+MapCache.prototype.get = mapCacheGet;
+MapCache.prototype.has = mapCacheHas;
+MapCache.prototype.set = mapCacheSet;
/**
* Creates a stack 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 Stack(values) {
- var index = -1,
- length = values ? values.length : 0;
-
- this.clear();
- while (++index < length) {
- var entry = values[index];
- this.set(entry[0], entry[1]);
- }
+function Stack(entries) {
+ this.__data__ = new ListCache(entries);
}
/**
@@ -567,7 +673,7 @@ function Stack(values) {
* @memberOf Stack
*/
function stackClear() {
- this.__data__ = { 'array': [], 'map': null };
+ this.__data__ = new ListCache;
}
/**
@@ -580,10 +686,7 @@ function stackClear() {
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function stackDelete(key) {
- var data = this.__data__,
- array = data.array;
-
- return array ? assocDelete(array, key) : data.map['delete'](key);
+ return this.__data__['delete'](key);
}
/**
@@ -596,10 +699,7 @@ function stackDelete(key) {
* @returns {*} Returns the entry value.
*/
function stackGet(key) {
- var data = this.__data__,
- array = data.array;
-
- return array ? assocGet(array, key) : data.map.get(key);
+ return this.__data__.get(key);
}
/**
@@ -612,10 +712,7 @@ function stackGet(key) {
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function stackHas(key) {
- var data = this.__data__,
- array = data.array;
-
- return array ? assocHas(array, key) : data.map.has(key);
+ return this.__data__.has(key);
}
/**
@@ -629,21 +726,11 @@ function stackHas(key) {
* @returns {Object} Returns the stack cache instance.
*/
function stackSet(key, value) {
- var data = this.__data__,
- array = data.array;
-
- if (array) {
- if (array.length < (LARGE_ARRAY_SIZE - 1)) {
- assocSet(array, key, value);
- } else {
- data.array = null;
- data.map = new MapCache(array);
- }
- }
- var map = data.map;
- if (map) {
- map.set(key, value);
+ var cache = this.__data__;
+ if (cache instanceof ListCache && cache.__data__.length == LARGE_ARRAY_SIZE) {
+ cache = this.__data__ = new MapCache(cache.__data__);
}
+ cache.set(key, value);
return this;
}
@@ -655,50 +742,21 @@ Stack.prototype.has = stackHas;
Stack.prototype.set = stackSet;
/**
- * Removes `key` and its value from the associative array.
+ * Assigns `value` to `key` of `object` if the existing value is not equivalent
+ * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
+ * for equality comparisons.
*
* @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`.
+ * @param {Object} object The object to modify.
+ * @param {string} key The key of the property to assign.
+ * @param {*} value The value to assign.
*/
-function assocDelete(array, key) {
- var index = assocIndexOf(array, key);
- if (index < 0) {
- return false;
+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;
}
- 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;
}
/**
@@ -719,41 +777,6 @@ function assocIndexOf(array, key) {
return -1;
}
-/**
- * Sets the associative array `key` to `value`.
- *
- * @private
- * @param {Array} array The array to modify.
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- */
-function assocSet(array, key, value) {
- var index = assocIndexOf(array, key);
- if (index < 0) {
- array.push([key, value]);
- } else {
- array[index][1] = value;
- }
-}
-
-/**
- * Assigns `value` to `key` of `object` if the existing value is not equivalent
- * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
- * for equality comparisons.
- *
- * @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 assignValue(object, key, value) {
- var objValue = object[key];
- if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
- (value === undefined && !(key in object))) {
- object[key] = value;
- }
-}
-
/**
* The base implementation of `_.assign` without support for multiple sources
* or `customizer` functions.
@@ -867,9 +890,7 @@ function baseCreate(proto) {
*/
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
var result = keysFunc(object);
- return isArray(object)
- ? result
- : arrayPush(result, symbolsFunc(object));
+ return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
}
/**
@@ -905,7 +926,7 @@ function baseKeys(object) {
*
* @private
* @param {string} key The key of the property to get.
- * @returns {Function} Returns the new function.
+ * @returns {Function} Returns the new accessor function.
*/
function baseProperty(key) {
return function(object) {
@@ -1104,6 +1125,21 @@ function getAllKeys(object) {
*/
var getLength = baseProperty('length');
+/**
+ * Gets the data for `map`.
+ *
+ * @private
+ * @param {Object} map The map to query.
+ * @param {string} key The reference key.
+ * @returns {*} Returns the map data.
+ */
+function getMapData(map, key) {
+ var data = map.__data__;
+ return isKeyable(key)
+ ? data[typeof key == 'string' ? 'string' : 'hash']
+ : data.map;
+}
+
/**
* Gets the native function at `key` of `object`.
*
@@ -1282,6 +1318,21 @@ function indexKeys(object) {
return null;
}
+/**
+ * Checks if `value` is a valid array-like index.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
+ * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
+ */
+function isIndex(value, length) {
+ length = length == null ? MAX_SAFE_INTEGER : length;
+ return !!length &&
+ (typeof value == 'number' || reIsUint.test(value)) &&
+ (value > -1 && value % 1 == 0 && value < length);
+}
+
/**
* Checks if `value` is suitable for use as unique object key.
*
@@ -1291,8 +1342,9 @@ function indexKeys(object) {
*/
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);
}
/**
@@ -1715,7 +1767,7 @@ function keys(object) {
* @since 2.4.0
* @category Util
* @param {*} value The value to return from the new function.
- * @returns {Function} Returns the new function.
+ * @returns {Function} Returns the new constant function.
* @example
*
* var object = { 'user': 'fred' };
diff --git a/lodash._baseclone/package.json b/lodash._baseclone/package.json
index ee79f57b9..667b70984 100644
--- a/lodash._baseclone/package.json
+++ b/lodash._baseclone/package.json
@@ -1,6 +1,6 @@
{
"name": "lodash._baseclone",
- "version": "4.5.6",
+ "version": "4.5.7",
"description": "The internal lodash function `baseClone` exported as a module.",
"homepage": "https://lodash.com/",
"icon": "https://lodash.com/icon.svg",