|
|
|
|
@@ -1,5 +1,5 @@
|
|
|
|
|
/**
|
|
|
|
|
* lodash 4.5.4 (Custom Build) <https://lodash.com/>
|
|
|
|
|
* lodash (Custom Build) <https://lodash.com/>
|
|
|
|
|
* Build: `lodash modularize exports="npm" -o ./`
|
|
|
|
|
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
|
|
|
|
* Released under MIT license <https://lodash.com/license>
|
|
|
|
|
@@ -46,7 +46,10 @@ var arrayBufferTag = '[object ArrayBuffer]',
|
|
|
|
|
uint16Tag = '[object Uint16Array]',
|
|
|
|
|
uint32Tag = '[object Uint32Array]';
|
|
|
|
|
|
|
|
|
|
/** Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). */
|
|
|
|
|
/**
|
|
|
|
|
* Used to match `RegExp`
|
|
|
|
|
* [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns).
|
|
|
|
|
*/
|
|
|
|
|
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
|
|
|
|
|
|
|
|
/** Used to match `RegExp` flags from their coerced string values. */
|
|
|
|
|
@@ -259,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,
|
|
|
|
|
@@ -290,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,
|
|
|
|
|
@@ -317,7 +306,8 @@ var funcToString = Function.prototype.toString;
|
|
|
|
|
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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;
|
|
|
|
|
@@ -350,94 +340,240 @@ var DataView = getNative(root, 'DataView'),
|
|
|
|
|
nativeCreate = getNative(Object, 'create');
|
|
|
|
|
|
|
|
|
|
/** Used to detect maps, sets, and weakmaps. */
|
|
|
|
|
var dataViewCtorString = DataView ? (DataView + '') : '',
|
|
|
|
|
mapCtorString = Map ? funcToString.call(Map) : '',
|
|
|
|
|
promiseCtorString = Promise ? funcToString.call(Promise) : '',
|
|
|
|
|
setCtorString = Set ? funcToString.call(Set) : '',
|
|
|
|
|
weakMapCtorString = WeakMap ? funcToString.call(WeakMap) : '';
|
|
|
|
|
var dataViewCtorString = toSource(DataView),
|
|
|
|
|
mapCtorString = toSource(Map),
|
|
|
|
|
promiseCtorString = toSource(Promise),
|
|
|
|
|
setCtorString = toSource(Set),
|
|
|
|
|
weakMapCtorString = toSource(WeakMap);
|
|
|
|
|
|
|
|
|
|
/** Used to convert symbols to primitives and strings. */
|
|
|
|
|
var symbolProto = Symbol ? Symbol.prototype : undefined,
|
|
|
|
|
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates an hash object.
|
|
|
|
|
* 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]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -449,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
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
@@ -466,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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@@ -483,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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@@ -500,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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@@ -518,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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@@ -563,7 +673,7 @@ function Stack(values) {
|
|
|
|
|
* @memberOf Stack
|
|
|
|
|
*/
|
|
|
|
|
function stackClear() {
|
|
|
|
|
this.__data__ = { 'array': [], 'map': null };
|
|
|
|
|
this.__data__ = new ListCache;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@@ -576,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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@@ -592,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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@@ -608,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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@@ -625,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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -651,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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@@ -715,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.
|
|
|
|
|
@@ -863,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));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@@ -901,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) {
|
|
|
|
|
@@ -1043,24 +1068,10 @@ function copyArray(source, array) {
|
|
|
|
|
* @param {Object} source The object to copy properties from.
|
|
|
|
|
* @param {Array} props The property identifiers to copy.
|
|
|
|
|
* @param {Object} [object={}] The object to copy properties to.
|
|
|
|
|
* @returns {Object} Returns `object`.
|
|
|
|
|
*/
|
|
|
|
|
function copyObject(source, props, object) {
|
|
|
|
|
return copyObjectWith(source, props, object);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This function is like `copyObject` except that it accepts a function to
|
|
|
|
|
* customize copied values.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {Object} source The object to copy properties from.
|
|
|
|
|
* @param {Array} props The property identifiers to copy.
|
|
|
|
|
* @param {Object} [object={}] The object to copy properties to.
|
|
|
|
|
* @param {Function} [customizer] The function to customize copied values.
|
|
|
|
|
* @returns {Object} Returns `object`.
|
|
|
|
|
*/
|
|
|
|
|
function copyObjectWith(source, props, object, customizer) {
|
|
|
|
|
function copyObject(source, props, object, customizer) {
|
|
|
|
|
object || (object = {});
|
|
|
|
|
|
|
|
|
|
var index = -1,
|
|
|
|
|
@@ -1114,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`.
|
|
|
|
|
*
|
|
|
|
|
@@ -1178,8 +1204,8 @@ if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
|
|
|
|
|
(WeakMap && getTag(new WeakMap) != weakMapTag)) {
|
|
|
|
|
getTag = function(value) {
|
|
|
|
|
var result = objectToString.call(value),
|
|
|
|
|
Ctor = result == objectTag ? value.constructor : null,
|
|
|
|
|
ctorString = typeof Ctor == 'function' ? funcToString.call(Ctor) : '';
|
|
|
|
|
Ctor = result == objectTag ? value.constructor : undefined,
|
|
|
|
|
ctorString = Ctor ? toSource(Ctor) : undefined;
|
|
|
|
|
|
|
|
|
|
if (ctorString) {
|
|
|
|
|
switch (ctorString) {
|
|
|
|
|
@@ -1292,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.
|
|
|
|
|
*
|
|
|
|
|
@@ -1301,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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@@ -1319,6 +1361,25 @@ function isPrototype(value) {
|
|
|
|
|
return value === proto;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Converts `func` to its source code.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {Function} func The function to process.
|
|
|
|
|
* @returns {string} Returns the source code.
|
|
|
|
|
*/
|
|
|
|
|
function toSource(func) {
|
|
|
|
|
if (func != null) {
|
|
|
|
|
try {
|
|
|
|
|
return funcToString.call(func);
|
|
|
|
|
} catch (e) {}
|
|
|
|
|
try {
|
|
|
|
|
return (func + '');
|
|
|
|
|
} catch (e) {}
|
|
|
|
|
}
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Performs a
|
|
|
|
|
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
|
|
|
|
@@ -1544,8 +1605,9 @@ function isLength(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 _
|
|
|
|
|
@@ -1619,14 +1681,11 @@ function isObjectLike(value) {
|
|
|
|
|
* // => false
|
|
|
|
|
*/
|
|
|
|
|
function isNative(value) {
|
|
|
|
|
if (value == null) {
|
|
|
|
|
if (!isObject(value)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (isFunction(value)) {
|
|
|
|
|
return reIsNative.test(funcToString.call(value));
|
|
|
|
|
}
|
|
|
|
|
return isObjectLike(value) &&
|
|
|
|
|
(isHostObject(value) ? reIsNative : reIsHostCtor).test(value);
|
|
|
|
|
var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
|
|
|
|
|
return pattern.test(toSource(value));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@@ -1708,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' };
|
|
|
|
|
|