Compare commits

...

1 Commits

Author SHA1 Message Date
John-David Dalton
529ca45adf Bump to v4.5.7. 2019-07-09 21:54:46 -07:00
4 changed files with 248 additions and 196 deletions

View File

@@ -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. The [lodash](https://lodash.com/) library exported as [npm packages](https://www.npmjs.com/browse/keyword/lodash-modularized) per method.

View File

@@ -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. 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'); 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.

View File

@@ -1,5 +1,5 @@
/** /**
* lodash 4.5.6 (Custom Build) <https://lodash.com/> * lodash (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="npm" -o ./` * Build: `lodash modularize exports="npm" -o ./`
* Copyright jQuery Foundation and other contributors <https://jquery.org/> * Copyright jQuery Foundation and other contributors <https://jquery.org/>
* Released under MIT license <https://lodash.com/license> * Released under MIT license <https://lodash.com/license>
@@ -262,25 +262,11 @@ function isHostObject(value) {
} }
/** /**
* Checks if `value` is a valid array-like index. * Converts `map` to its key-value pairs.
*
* @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.
* *
* @private * @private
* @param {Object} map The map to convert. * @param {Object} map The map to convert.
* @returns {Array} Returns the converted array. * @returns {Array} Returns the key-value pairs.
*/ */
function mapToArray(map) { function mapToArray(map) {
var index = -1, var index = -1,
@@ -293,11 +279,11 @@ function mapToArray(map) {
} }
/** /**
* Converts `set` to an array. * Converts `set` to an array of its values.
* *
* @private * @private
* @param {Object} set The set to convert. * @param {Object} set The set to convert.
* @returns {Array} Returns the converted array. * @returns {Array} Returns the values.
*/ */
function setToArray(set) { function setToArray(set) {
var index = -1, var index = -1,
@@ -369,79 +355,225 @@ var symbolProto = Symbol ? Symbol.prototype : undefined,
* *
* @private * @private
* @constructor * @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. * Removes `key` and its value from the hash.
* *
* @private * @private
* @name delete
* @memberOf Hash
* @param {Object} hash The hash to modify. * @param {Object} hash The hash to modify.
* @param {string} key The key of the value to remove. * @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/ */
function hashDelete(hash, key) { function hashDelete(key) {
return hashHas(hash, key) && delete hash[key]; return this.has(key) && delete this.__data__[key];
} }
/** /**
* Gets the hash value for `key`. * Gets the hash value for `key`.
* *
* @private * @private
* @param {Object} hash The hash to query. * @name get
* @memberOf Hash
* @param {string} key The key of the value to get. * @param {string} key The key of the value to get.
* @returns {*} Returns the entry value. * @returns {*} Returns the entry value.
*/ */
function hashGet(hash, key) { function hashGet(key) {
var data = this.__data__;
if (nativeCreate) { if (nativeCreate) {
var result = hash[key]; var result = data[key];
return result === HASH_UNDEFINED ? undefined : result; 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. * Checks if a hash value for `key` exists.
* *
* @private * @private
* @param {Object} hash The hash to query. * @name has
* @memberOf Hash
* @param {string} key The key of the entry to check. * @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/ */
function hashHas(hash, key) { function hashHas(key) {
return nativeCreate ? hash[key] !== undefined : hasOwnProperty.call(hash, key); var data = this.__data__;
return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
} }
/** /**
* Sets the hash `key` to `value`. * Sets the hash `key` to `value`.
* *
* @private * @private
* @param {Object} hash The hash to modify. * @name set
* @memberOf Hash
* @param {string} key The key of the value to set. * @param {string} key The key of the value to set.
* @param {*} value The value to set. * @param {*} value The value to set.
* @returns {Object} Returns the hash instance.
*/ */
function hashSet(hash, key, value) { function hashSet(key, value) {
hash[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; var data = this.__data__;
data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
return this;
} }
// Avoid inheriting from `Object.prototype` when possible. // Add methods to `Hash`.
Hash.prototype = nativeCreate ? nativeCreate(null) : objectProto; 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. * Creates a map cache object to store key-value pairs.
* *
* @private * @private
* @constructor * @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, var index = -1,
length = values ? values.length : 0; length = entries ? entries.length : 0;
this.clear(); this.clear();
while (++index < length) { while (++index < length) {
var entry = values[index]; var entry = entries[index];
this.set(entry[0], entry[1]); this.set(entry[0], entry[1]);
} }
} }
@@ -453,10 +585,10 @@ function MapCache(values) {
* @name clear * @name clear
* @memberOf MapCache * @memberOf MapCache
*/ */
function mapClear() { function mapCacheClear() {
this.__data__ = { this.__data__ = {
'hash': new Hash, 'hash': new Hash,
'map': Map ? new Map : [], 'map': new (Map || ListCache),
'string': new Hash 'string': new Hash
}; };
} }
@@ -470,12 +602,8 @@ function mapClear() {
* @param {string} key The key of the value to remove. * @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/ */
function mapDelete(key) { function mapCacheDelete(key) {
var data = this.__data__; return getMapData(this, key)['delete'](key);
if (isKeyable(key)) {
return hashDelete(typeof key == 'string' ? data.string : data.hash, key);
}
return Map ? data.map['delete'](key) : assocDelete(data.map, key);
} }
/** /**
@@ -487,12 +615,8 @@ function mapDelete(key) {
* @param {string} key The key of the value to get. * @param {string} key The key of the value to get.
* @returns {*} Returns the entry value. * @returns {*} Returns the entry value.
*/ */
function mapGet(key) { function mapCacheGet(key) {
var data = this.__data__; return getMapData(this, key).get(key);
if (isKeyable(key)) {
return hashGet(typeof key == 'string' ? data.string : data.hash, key);
}
return Map ? data.map.get(key) : assocGet(data.map, key);
} }
/** /**
@@ -504,12 +628,8 @@ function mapGet(key) {
* @param {string} key The key of the entry to check. * @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/ */
function mapHas(key) { function mapCacheHas(key) {
var data = this.__data__; return getMapData(this, key).has(key);
if (isKeyable(key)) {
return hashHas(typeof key == 'string' ? data.string : data.hash, key);
}
return Map ? data.map.has(key) : assocHas(data.map, key);
} }
/** /**
@@ -522,41 +642,27 @@ function mapHas(key) {
* @param {*} value The value to set. * @param {*} value The value to set.
* @returns {Object} Returns the map cache instance. * @returns {Object} Returns the map cache instance.
*/ */
function mapSet(key, value) { function mapCacheSet(key, value) {
var data = this.__data__; getMapData(this, key).set(key, value);
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);
}
return this; return this;
} }
// Add methods to `MapCache`. // Add methods to `MapCache`.
MapCache.prototype.clear = mapClear; MapCache.prototype.clear = mapCacheClear;
MapCache.prototype['delete'] = mapDelete; MapCache.prototype['delete'] = mapCacheDelete;
MapCache.prototype.get = mapGet; MapCache.prototype.get = mapCacheGet;
MapCache.prototype.has = mapHas; MapCache.prototype.has = mapCacheHas;
MapCache.prototype.set = mapSet; MapCache.prototype.set = mapCacheSet;
/** /**
* Creates a stack cache object to store key-value pairs. * Creates a stack cache object to store key-value pairs.
* *
* @private * @private
* @constructor * @constructor
* @param {Array} [values] The values to cache. * @param {Array} [entries] The key-value pairs to cache.
*/ */
function Stack(values) { function Stack(entries) {
var index = -1, this.__data__ = new ListCache(entries);
length = values ? values.length : 0;
this.clear();
while (++index < length) {
var entry = values[index];
this.set(entry[0], entry[1]);
}
} }
/** /**
@@ -567,7 +673,7 @@ function Stack(values) {
* @memberOf Stack * @memberOf Stack
*/ */
function stackClear() { 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`. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/ */
function stackDelete(key) { function stackDelete(key) {
var data = this.__data__, return this.__data__['delete'](key);
array = data.array;
return array ? assocDelete(array, key) : data.map['delete'](key);
} }
/** /**
@@ -596,10 +699,7 @@ function stackDelete(key) {
* @returns {*} Returns the entry value. * @returns {*} Returns the entry value.
*/ */
function stackGet(key) { function stackGet(key) {
var data = this.__data__, return this.__data__.get(key);
array = data.array;
return array ? assocGet(array, key) : data.map.get(key);
} }
/** /**
@@ -612,10 +712,7 @@ function stackGet(key) {
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/ */
function stackHas(key) { function stackHas(key) {
var data = this.__data__, return this.__data__.has(key);
array = data.array;
return array ? assocHas(array, key) : data.map.has(key);
} }
/** /**
@@ -629,21 +726,11 @@ function stackHas(key) {
* @returns {Object} Returns the stack cache instance. * @returns {Object} Returns the stack cache instance.
*/ */
function stackSet(key, value) { function stackSet(key, value) {
var data = this.__data__, var cache = this.__data__;
array = data.array; if (cache instanceof ListCache && cache.__data__.length == LARGE_ARRAY_SIZE) {
cache = this.__data__ = new MapCache(cache.__data__);
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);
} }
cache.set(key, value);
return this; return this;
} }
@@ -655,50 +742,21 @@ Stack.prototype.has = stackHas;
Stack.prototype.set = stackSet; 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 * @private
* @param {Array} array The array to modify. * @param {Object} object The object to modify.
* @param {string} key The key of the value to remove. * @param {string} key The key of the property to assign.
* @returns {boolean} Returns `true` if the entry was removed, else `false`. * @param {*} value The value to assign.
*/ */
function assocDelete(array, key) { function assignValue(object, key, value) {
var index = assocIndexOf(array, key); var objValue = object[key];
if (index < 0) { if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
return false; (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; 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 * The base implementation of `_.assign` without support for multiple sources
* or `customizer` functions. * or `customizer` functions.
@@ -867,9 +890,7 @@ function baseCreate(proto) {
*/ */
function baseGetAllKeys(object, keysFunc, symbolsFunc) { function baseGetAllKeys(object, keysFunc, symbolsFunc) {
var result = keysFunc(object); var result = keysFunc(object);
return isArray(object) return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
? result
: arrayPush(result, symbolsFunc(object));
} }
/** /**
@@ -905,7 +926,7 @@ function baseKeys(object) {
* *
* @private * @private
* @param {string} key The key of the property to get. * @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) { function baseProperty(key) {
return function(object) { return function(object) {
@@ -1104,6 +1125,21 @@ function getAllKeys(object) {
*/ */
var getLength = baseProperty('length'); 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`. * Gets the native function at `key` of `object`.
* *
@@ -1282,6 +1318,21 @@ function indexKeys(object) {
return null; 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. * Checks if `value` is suitable for use as unique object key.
* *
@@ -1291,8 +1342,9 @@ function indexKeys(object) {
*/ */
function isKeyable(value) { function isKeyable(value) {
var type = typeof value; var type = typeof value;
return type == 'number' || type == 'boolean' || return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
(type == 'string' && value != '__proto__') || value == null; ? (value !== '__proto__')
: (value === null);
} }
/** /**
@@ -1715,7 +1767,7 @@ function keys(object) {
* @since 2.4.0 * @since 2.4.0
* @category Util * @category Util
* @param {*} value The value to return from the new function. * @param {*} value The value to return from the new function.
* @returns {Function} Returns the new function. * @returns {Function} Returns the new constant function.
* @example * @example
* *
* var object = { 'user': 'fred' }; * var object = { 'user': 'fred' };

View File

@@ -1,6 +1,6 @@
{ {
"name": "lodash._baseclone", "name": "lodash._baseclone",
"version": "4.5.6", "version": "4.5.7",
"description": "The internal lodash function `baseClone` exported as a module.", "description": "The internal lodash function `baseClone` exported as a module.",
"homepage": "https://lodash.com/", "homepage": "https://lodash.com/",
"icon": "https://lodash.com/icon.svg", "icon": "https://lodash.com/icon.svg",