mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
Bump to v4.12.0.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# lodash-es v4.11.2
|
||||
# lodash-es v4.12.0
|
||||
|
||||
The [Lodash](https://lodash.com/) library exported as [ES](http://www.ecma-international.org/ecma-262/6.0/) modules.
|
||||
|
||||
@@ -7,4 +7,4 @@ Generated using [lodash-cli](https://www.npmjs.com/package/lodash-cli):
|
||||
$ lodash modularize exports=es -o ./
|
||||
```
|
||||
|
||||
See the [package source](https://github.com/lodash/lodash/tree/4.11.2-es) for more details.
|
||||
See the [package source](https://github.com/lodash/lodash/tree/4.12.0-es) for more details.
|
||||
|
||||
30
_Hash.js
30
_Hash.js
@@ -1,18 +1,32 @@
|
||||
import nativeCreate from './_nativeCreate';
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var objectProto = Object.prototype;
|
||||
import hashClear from './_hashClear';
|
||||
import hashDelete from './_hashDelete';
|
||||
import hashGet from './_hashGet';
|
||||
import hashHas from './_hashHas';
|
||||
import hashSet from './_hashSet';
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
// Avoid inheriting from `Object.prototype` when possible.
|
||||
Hash.prototype = nativeCreate ? nativeCreate(null) : objectProto;
|
||||
this.clear();
|
||||
while (++index < length) {
|
||||
var entry = entries[index];
|
||||
this.set(entry[0], entry[1]);
|
||||
}
|
||||
}
|
||||
|
||||
// Add methods to `Hash`.
|
||||
Hash.prototype.clear = hashClear;
|
||||
Hash.prototype['delete'] = hashDelete;
|
||||
Hash.prototype.get = hashGet;
|
||||
Hash.prototype.has = hashHas;
|
||||
Hash.prototype.set = hashSet;
|
||||
|
||||
export default Hash;
|
||||
|
||||
32
_ListCache.js
Normal file
32
_ListCache.js
Normal file
@@ -0,0 +1,32 @@
|
||||
import listCacheClear from './_listCacheClear';
|
||||
import listCacheDelete from './_listCacheDelete';
|
||||
import listCacheGet from './_listCacheGet';
|
||||
import listCacheHas from './_listCacheHas';
|
||||
import listCacheSet from './_listCacheSet';
|
||||
|
||||
/**
|
||||
* 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]);
|
||||
}
|
||||
}
|
||||
|
||||
// Add methods to `ListCache`.
|
||||
ListCache.prototype.clear = listCacheClear;
|
||||
ListCache.prototype['delete'] = listCacheDelete;
|
||||
ListCache.prototype.get = listCacheGet;
|
||||
ListCache.prototype.has = listCacheHas;
|
||||
ListCache.prototype.set = listCacheSet;
|
||||
|
||||
export default ListCache;
|
||||
28
_MapCache.js
28
_MapCache.js
@@ -1,32 +1,32 @@
|
||||
import mapClear from './_mapClear';
|
||||
import mapDelete from './_mapDelete';
|
||||
import mapGet from './_mapGet';
|
||||
import mapHas from './_mapHas';
|
||||
import mapSet from './_mapSet';
|
||||
import mapCacheClear from './_mapCacheClear';
|
||||
import mapCacheDelete from './_mapCacheDelete';
|
||||
import mapCacheGet from './_mapCacheGet';
|
||||
import mapCacheHas from './_mapCacheHas';
|
||||
import mapCacheSet from './_mapCacheSet';
|
||||
|
||||
/**
|
||||
* 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]);
|
||||
}
|
||||
}
|
||||
|
||||
// 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;
|
||||
|
||||
export default MapCache;
|
||||
|
||||
10
_SetCache.js
10
_SetCache.js
@@ -1,9 +1,10 @@
|
||||
import MapCache from './_MapCache';
|
||||
import cachePush from './_cachePush';
|
||||
import setCacheAdd from './_setCacheAdd';
|
||||
import setCacheHas from './_setCacheHas';
|
||||
|
||||
/**
|
||||
*
|
||||
* Creates a set cache object to store unique values.
|
||||
* Creates an array cache object to store unique values.
|
||||
*
|
||||
* @private
|
||||
* @constructor
|
||||
@@ -15,11 +16,12 @@ function SetCache(values) {
|
||||
|
||||
this.__data__ = new MapCache;
|
||||
while (++index < length) {
|
||||
this.push(values[index]);
|
||||
this.add(values[index]);
|
||||
}
|
||||
}
|
||||
|
||||
// Add methods to `SetCache`.
|
||||
SetCache.prototype.push = cachePush;
|
||||
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
|
||||
SetCache.prototype.has = setCacheHas;
|
||||
|
||||
export default SetCache;
|
||||
|
||||
14
_Stack.js
14
_Stack.js
@@ -1,3 +1,4 @@
|
||||
import ListCache from './_ListCache';
|
||||
import stackClear from './_stackClear';
|
||||
import stackDelete from './_stackDelete';
|
||||
import stackGet from './_stackGet';
|
||||
@@ -9,17 +10,10 @@ import stackSet from './_stackSet';
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
|
||||
// Add methods to `Stack`.
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
/**
|
||||
* Creates a new array concatenating `array` with `other`.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The first array to concatenate.
|
||||
* @param {Array} other The second array to concatenate.
|
||||
* @returns {Array} Returns the new concatenated array.
|
||||
*/
|
||||
function arrayConcat(array, other) {
|
||||
var index = -1,
|
||||
length = array.length,
|
||||
othIndex = -1,
|
||||
othLength = other.length,
|
||||
result = Array(length + othLength);
|
||||
|
||||
while (++index < length) {
|
||||
result[index] = array[index];
|
||||
}
|
||||
while (++othIndex < othLength) {
|
||||
result[index++] = other[othIndex];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
export default arrayConcat;
|
||||
16
_assocGet.js
16
_assocGet.js
@@ -1,16 +0,0 @@
|
||||
import assocIndexOf from './_assocIndexOf';
|
||||
|
||||
/**
|
||||
* 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];
|
||||
}
|
||||
|
||||
export default assocGet;
|
||||
20
_assocSet.js
20
_assocSet.js
@@ -1,20 +0,0 @@
|
||||
import assocIndexOf from './_assocIndexOf';
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
|
||||
export default assocSet;
|
||||
@@ -6,7 +6,7 @@ import get from './get';
|
||||
* @private
|
||||
* @param {Object} object The object to iterate over.
|
||||
* @param {string[]} paths The property paths of elements to pick.
|
||||
* @returns {Array} Returns the new array of picked elements.
|
||||
* @returns {Array} Returns the picked elements.
|
||||
*/
|
||||
function baseAt(object, paths) {
|
||||
var index = -1,
|
||||
|
||||
@@ -5,7 +5,7 @@ import keys from './keys';
|
||||
*
|
||||
* @private
|
||||
* @param {Object} source The object of property predicates to conform to.
|
||||
* @returns {Function} Returns the new function.
|
||||
* @returns {Function} Returns the new spec function.
|
||||
*/
|
||||
function baseConforms(source) {
|
||||
var props = keys(source),
|
||||
|
||||
@@ -8,7 +8,7 @@ import isFunction from './isFunction';
|
||||
* @private
|
||||
* @param {Object} object The object to inspect.
|
||||
* @param {Array} props The property names to filter.
|
||||
* @returns {Array} Returns the new array of filtered property names.
|
||||
* @returns {Array} Returns the function names.
|
||||
*/
|
||||
function baseFunctions(object, props) {
|
||||
return arrayFilter(props, function(key) {
|
||||
|
||||
@@ -14,9 +14,7 @@ import isArray from './isArray';
|
||||
*/
|
||||
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));
|
||||
}
|
||||
|
||||
export default baseGetAllKeys;
|
||||
|
||||
@@ -7,7 +7,7 @@ import matchesStrictComparable from './_matchesStrictComparable';
|
||||
*
|
||||
* @private
|
||||
* @param {Object} source The object of property values to match.
|
||||
* @returns {Function} Returns the new function.
|
||||
* @returns {Function} Returns the new spec function.
|
||||
*/
|
||||
function baseMatches(source) {
|
||||
var matchData = getMatchData(source);
|
||||
|
||||
@@ -16,7 +16,7 @@ var UNORDERED_COMPARE_FLAG = 1,
|
||||
* @private
|
||||
* @param {string} path The path of the property to get.
|
||||
* @param {*} srcValue The value to match.
|
||||
* @returns {Function} Returns the new function.
|
||||
* @returns {Function} Returns the new spec function.
|
||||
*/
|
||||
function baseMatchesProperty(path, srcValue) {
|
||||
if (isKey(path) && isStrictComparable(srcValue)) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* @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) {
|
||||
|
||||
@@ -5,7 +5,7 @@ import baseGet from './_baseGet';
|
||||
*
|
||||
* @private
|
||||
* @param {Array|string} path The path of the property to get.
|
||||
* @returns {Function} Returns the new function.
|
||||
* @returns {Function} Returns the new accessor function.
|
||||
*/
|
||||
function basePropertyDeep(path) {
|
||||
return function(object) {
|
||||
|
||||
@@ -11,7 +11,7 @@ var nativeCeil = Math.ceil,
|
||||
* @param {number} end The end of the range.
|
||||
* @param {number} step The value to increment or decrement by.
|
||||
* @param {boolean} [fromRight] Specify iterating from right to left.
|
||||
* @returns {Array} Returns the new array of numbers.
|
||||
* @returns {Array} Returns the range of numbers.
|
||||
*/
|
||||
function baseRange(start, end, step, fromRight) {
|
||||
var index = -1,
|
||||
|
||||
@@ -7,7 +7,7 @@ import arrayMap from './_arrayMap';
|
||||
* @private
|
||||
* @param {Object} object The object to query.
|
||||
* @param {Array} props The property names to get values for.
|
||||
* @returns {Object} Returns the new array of key-value pairs.
|
||||
* @returns {Object} Returns the key-value pairs.
|
||||
*/
|
||||
function baseToPairs(object, props) {
|
||||
return arrayMap(props, function(key) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* @private
|
||||
* @param {Function} func The function to cap arguments for.
|
||||
* @returns {Function} Returns the new function.
|
||||
* @returns {Function} Returns the new capped function.
|
||||
*/
|
||||
function baseUnary(func) {
|
||||
return function(value) {
|
||||
|
||||
24
_cacheHas.js
24
_cacheHas.js
@@ -1,25 +1,13 @@
|
||||
import isKeyable from './_isKeyable';
|
||||
|
||||
/** Used to stand-in for `undefined` hash values. */
|
||||
var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
||||
|
||||
/**
|
||||
* Checks if `value` is in `cache`.
|
||||
* Checks if a cache value for `key` exists.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} cache The set cache to search.
|
||||
* @param {*} value The value to search for.
|
||||
* @returns {number} Returns `true` if `value` is found, else `false`.
|
||||
* @param {Object} cache The cache 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 cacheHas(cache, value) {
|
||||
var map = cache.__data__;
|
||||
if (isKeyable(value)) {
|
||||
var data = map.__data__,
|
||||
hash = typeof value == 'string' ? data.string : data.hash;
|
||||
|
||||
return hash[value] === HASH_UNDEFINED;
|
||||
}
|
||||
return map.has(value);
|
||||
function cacheHas(cache, key) {
|
||||
return cache.has(key);
|
||||
}
|
||||
|
||||
export default cacheHas;
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
import isKeyable from './_isKeyable';
|
||||
|
||||
/** Used to stand-in for `undefined` hash values. */
|
||||
var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
||||
|
||||
/**
|
||||
* Adds `value` to the set cache.
|
||||
*
|
||||
* @private
|
||||
* @name push
|
||||
* @memberOf SetCache
|
||||
* @param {*} value The value to cache.
|
||||
*/
|
||||
function cachePush(value) {
|
||||
var map = this.__data__;
|
||||
if (isKeyable(value)) {
|
||||
var data = map.__data__,
|
||||
hash = typeof value == 'string' ? data.string : data.hash;
|
||||
|
||||
hash[value] = HASH_UNDEFINED;
|
||||
}
|
||||
else {
|
||||
map.set(value, HASH_UNDEFINED);
|
||||
}
|
||||
}
|
||||
|
||||
export default cachePush;
|
||||
@@ -6,7 +6,7 @@ var nativeMax = Math.max;
|
||||
* placeholders, and provided arguments into a single array of arguments.
|
||||
*
|
||||
* @private
|
||||
* @param {Array|Object} args The provided arguments.
|
||||
* @param {Array} args The provided arguments.
|
||||
* @param {Array} partials The arguments to prepend to those provided.
|
||||
* @param {Array} holders The `partials` placeholder indexes.
|
||||
* @params {boolean} [isCurried] Specify composing for a curried function.
|
||||
|
||||
@@ -6,7 +6,7 @@ var nativeMax = Math.max;
|
||||
* is tailored for `_.partialRight`.
|
||||
*
|
||||
* @private
|
||||
* @param {Array|Object} args The provided arguments.
|
||||
* @param {Array} args The provided arguments.
|
||||
* @param {Array} partials The arguments to append to those provided.
|
||||
* @param {Array} holders The `partials` placeholder indexes.
|
||||
* @params {boolean} [isCurried] Specify composing for a curried function.
|
||||
|
||||
@@ -15,7 +15,7 @@ function createAssigner(assigner) {
|
||||
customizer = length > 1 ? sources[length - 1] : undefined,
|
||||
guard = length > 2 ? sources[2] : undefined;
|
||||
|
||||
customizer = typeof customizer == 'function'
|
||||
customizer = (assigner.length > 3 && typeof customizer == 'function')
|
||||
? (length--, customizer)
|
||||
: undefined;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import toString from './toString';
|
||||
*
|
||||
* @private
|
||||
* @param {string} methodName The name of the `String` case method to use.
|
||||
* @returns {Function} Returns the new function.
|
||||
* @returns {Function} Returns the new case function.
|
||||
*/
|
||||
function createCaseFirst(methodName) {
|
||||
return function(string) {
|
||||
|
||||
@@ -2,7 +2,7 @@ import apply from './_apply';
|
||||
import createCtorWrapper from './_createCtorWrapper';
|
||||
import createHybridWrapper from './_createHybridWrapper';
|
||||
import createRecurryWrapper from './_createRecurryWrapper';
|
||||
import getPlaceholder from './_getPlaceholder';
|
||||
import getHolder from './_getHolder';
|
||||
import replaceHolders from './_replaceHolders';
|
||||
import root from './_root';
|
||||
|
||||
@@ -23,7 +23,7 @@ function createCurryWrapper(func, bitmask, arity) {
|
||||
var length = arguments.length,
|
||||
args = Array(length),
|
||||
index = length,
|
||||
placeholder = getPlaceholder(wrapper);
|
||||
placeholder = getHolder(wrapper);
|
||||
|
||||
while (index--) {
|
||||
args[index] = arguments[index];
|
||||
|
||||
@@ -3,7 +3,7 @@ import composeArgsRight from './_composeArgsRight';
|
||||
import countHolders from './_countHolders';
|
||||
import createCtorWrapper from './_createCtorWrapper';
|
||||
import createRecurryWrapper from './_createRecurryWrapper';
|
||||
import getPlaceholder from './_getPlaceholder';
|
||||
import getHolder from './_getHolder';
|
||||
import reorder from './_reorder';
|
||||
import replaceHolders from './_replaceHolders';
|
||||
import root from './_root';
|
||||
@@ -46,14 +46,14 @@ function createHybridWrapper(func, bitmask, thisArg, partials, holders, partials
|
||||
|
||||
function wrapper() {
|
||||
var length = arguments.length,
|
||||
index = length,
|
||||
args = Array(length);
|
||||
args = Array(length),
|
||||
index = length;
|
||||
|
||||
while (index--) {
|
||||
args[index] = arguments[index];
|
||||
}
|
||||
if (isCurried) {
|
||||
var placeholder = getPlaceholder(wrapper),
|
||||
var placeholder = getHolder(wrapper),
|
||||
holdersCount = countHolders(args, placeholder);
|
||||
}
|
||||
if (partials) {
|
||||
|
||||
@@ -12,7 +12,7 @@ import rest from './rest';
|
||||
*
|
||||
* @private
|
||||
* @param {Function} arrayFunc The function to iterate over iteratees.
|
||||
* @returns {Function} Returns the new invoker function.
|
||||
* @returns {Function} Returns the new over function.
|
||||
*/
|
||||
function createOver(arrayFunc) {
|
||||
return rest(function(iteratees) {
|
||||
|
||||
30
_createToPairs.js
Normal file
30
_createToPairs.js
Normal file
@@ -0,0 +1,30 @@
|
||||
import baseToPairs from './_baseToPairs';
|
||||
import getTag from './_getTag';
|
||||
import mapToArray from './_mapToArray';
|
||||
import setToPairs from './_setToPairs';
|
||||
|
||||
/** `Object#toString` result references. */
|
||||
var mapTag = '[object Map]',
|
||||
setTag = '[object Set]';
|
||||
|
||||
/**
|
||||
* Creates a `_.toPairs` or `_.toPairsIn` function.
|
||||
*
|
||||
* @private
|
||||
* @param {Function} keysFunc The function to get the keys of a given object.
|
||||
* @returns {Function} Returns the new pairs function.
|
||||
*/
|
||||
function createToPairs(keysFunc) {
|
||||
return function(object) {
|
||||
var tag = getTag(object);
|
||||
if (tag == mapTag) {
|
||||
return mapToArray(object);
|
||||
}
|
||||
if (tag == setTag) {
|
||||
return setToPairs(object);
|
||||
}
|
||||
return baseToPairs(object, keysFunc(object));
|
||||
};
|
||||
}
|
||||
|
||||
export default createToPairs;
|
||||
@@ -39,6 +39,7 @@ var nativeMax = Math.max;
|
||||
* 64 - `_.partialRight`
|
||||
* 128 - `_.rearg`
|
||||
* 256 - `_.ary`
|
||||
* 512 - `_.flip`
|
||||
* @param {*} [thisArg] The `this` binding of `func`.
|
||||
* @param {Array} [partials] The arguments to be partially applied.
|
||||
* @param {Array} [holders] The `partials` placeholder indexes.
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import SetCache from './_SetCache';
|
||||
import arraySome from './_arraySome';
|
||||
|
||||
/** Used to compose bitmasks for comparison styles. */
|
||||
@@ -19,9 +20,7 @@ var UNORDERED_COMPARE_FLAG = 1,
|
||||
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
|
||||
*/
|
||||
function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
|
||||
var index = -1,
|
||||
isPartial = bitmask & PARTIAL_COMPARE_FLAG,
|
||||
isUnordered = bitmask & UNORDERED_COMPARE_FLAG,
|
||||
var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
|
||||
arrLength = array.length,
|
||||
othLength = other.length;
|
||||
|
||||
@@ -33,7 +32,10 @@ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
|
||||
if (stacked) {
|
||||
return stacked == other;
|
||||
}
|
||||
var result = true;
|
||||
var index = -1,
|
||||
result = true,
|
||||
seen = (bitmask & UNORDERED_COMPARE_FLAG) ? new SetCache : undefined;
|
||||
|
||||
stack.set(array, other);
|
||||
|
||||
// Ignore non-index properties.
|
||||
@@ -54,10 +56,12 @@ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
|
||||
break;
|
||||
}
|
||||
// Recursively compare arrays (susceptible to call stack limits).
|
||||
if (isUnordered) {
|
||||
if (!arraySome(other, function(othValue) {
|
||||
return arrValue === othValue ||
|
||||
equalFunc(arrValue, othValue, customizer, bitmask, stack);
|
||||
if (seen) {
|
||||
if (!arraySome(other, function(othValue, othIndex) {
|
||||
if (!seen.has(othIndex) &&
|
||||
(arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) {
|
||||
return seen.add(othIndex);
|
||||
}
|
||||
})) {
|
||||
result = false;
|
||||
break;
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
* @param {Function} func The function to inspect.
|
||||
* @returns {*} Returns the placeholder value.
|
||||
*/
|
||||
function getPlaceholder(func) {
|
||||
function getHolder(func) {
|
||||
var object = func;
|
||||
return object.placeholder;
|
||||
}
|
||||
|
||||
export default getPlaceholder;
|
||||
export default getHolder;
|
||||
18
_getMapData.js
Normal file
18
_getMapData.js
Normal file
@@ -0,0 +1,18 @@
|
||||
import isKeyable from './_isKeyable';
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
export default getMapData;
|
||||
14
_hashClear.js
Normal file
14
_hashClear.js
Normal file
@@ -0,0 +1,14 @@
|
||||
import nativeCreate from './_nativeCreate';
|
||||
|
||||
/**
|
||||
* Removes all key-value entries from the hash.
|
||||
*
|
||||
* @private
|
||||
* @name clear
|
||||
* @memberOf Hash
|
||||
*/
|
||||
function hashClear() {
|
||||
this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
||||
}
|
||||
|
||||
export default hashClear;
|
||||
@@ -1,15 +1,15 @@
|
||||
import hashHas from './_hashHas';
|
||||
|
||||
/**
|
||||
* 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];
|
||||
}
|
||||
|
||||
export default hashDelete;
|
||||
|
||||
10
_hashGet.js
10
_hashGet.js
@@ -13,16 +13,18 @@ var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
* 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;
|
||||
}
|
||||
|
||||
export default hashGet;
|
||||
|
||||
@@ -10,12 +10,14 @@ var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
* 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);
|
||||
}
|
||||
|
||||
export default hashHas;
|
||||
|
||||
10
_hashSet.js
10
_hashSet.js
@@ -7,12 +7,16 @@ var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
||||
* 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;
|
||||
}
|
||||
|
||||
export default hashSet;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import isArguments from './isArguments';
|
||||
import isArray from './isArray';
|
||||
import isArrayLikeObject from './isArrayLikeObject';
|
||||
|
||||
/**
|
||||
* Checks if `value` is a flattenable `arguments` object or array.
|
||||
@@ -10,7 +9,7 @@ import isArrayLikeObject from './isArrayLikeObject';
|
||||
* @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
|
||||
*/
|
||||
function isFlattenable(value) {
|
||||
return isArrayLikeObject(value) && (isArray(value) || isArguments(value));
|
||||
return isArray(value) || isArguments(value);
|
||||
}
|
||||
|
||||
export default isFlattenable;
|
||||
|
||||
12
_listCacheClear.js
Normal file
12
_listCacheClear.js
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Removes all key-value entries from the list cache.
|
||||
*
|
||||
* @private
|
||||
* @name clear
|
||||
* @memberOf ListCache
|
||||
*/
|
||||
function listCacheClear() {
|
||||
this.__data__ = [];
|
||||
}
|
||||
|
||||
export default listCacheClear;
|
||||
@@ -7,25 +7,28 @@ var arrayProto = Array.prototype;
|
||||
var splice = arrayProto.splice;
|
||||
|
||||
/**
|
||||
* Removes `key` and its value from the associative array.
|
||||
* Removes `key` and its value from the list cache.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to modify.
|
||||
* @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 assocDelete(array, key) {
|
||||
var index = assocIndexOf(array, key);
|
||||
function listCacheDelete(key) {
|
||||
var data = this.__data__,
|
||||
index = assocIndexOf(data, key);
|
||||
|
||||
if (index < 0) {
|
||||
return false;
|
||||
}
|
||||
var lastIndex = array.length - 1;
|
||||
var lastIndex = data.length - 1;
|
||||
if (index == lastIndex) {
|
||||
array.pop();
|
||||
data.pop();
|
||||
} else {
|
||||
splice.call(array, index, 1);
|
||||
splice.call(data, index, 1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
export default assocDelete;
|
||||
export default listCacheDelete;
|
||||
19
_listCacheGet.js
Normal file
19
_listCacheGet.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import assocIndexOf from './_assocIndexOf';
|
||||
|
||||
/**
|
||||
* 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];
|
||||
}
|
||||
|
||||
export default listCacheGet;
|
||||
@@ -1,15 +1,16 @@
|
||||
import assocIndexOf from './_assocIndexOf';
|
||||
|
||||
/**
|
||||
* Checks if an associative array value for `key` exists.
|
||||
* Checks if a list cache value for `key` exists.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to query.
|
||||
* @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 assocHas(array, key) {
|
||||
return assocIndexOf(array, key) > -1;
|
||||
function listCacheHas(key) {
|
||||
return assocIndexOf(this.__data__, key) > -1;
|
||||
}
|
||||
|
||||
export default assocHas;
|
||||
export default listCacheHas;
|
||||
25
_listCacheSet.js
Normal file
25
_listCacheSet.js
Normal file
@@ -0,0 +1,25 @@
|
||||
import assocIndexOf from './_assocIndexOf';
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
export default listCacheSet;
|
||||
@@ -1,4 +1,5 @@
|
||||
import Hash from './_Hash';
|
||||
import ListCache from './_ListCache';
|
||||
import Map from './_Map';
|
||||
|
||||
/**
|
||||
@@ -8,12 +9,12 @@ import Map from './_Map';
|
||||
* @name clear
|
||||
* @memberOf MapCache
|
||||
*/
|
||||
function mapClear() {
|
||||
function mapCacheClear() {
|
||||
this.__data__ = {
|
||||
'hash': new Hash,
|
||||
'map': Map ? new Map : [],
|
||||
'map': new (Map || ListCache),
|
||||
'string': new Hash
|
||||
};
|
||||
}
|
||||
|
||||
export default mapClear;
|
||||
export default mapCacheClear;
|
||||
16
_mapCacheDelete.js
Normal file
16
_mapCacheDelete.js
Normal file
@@ -0,0 +1,16 @@
|
||||
import getMapData from './_getMapData';
|
||||
|
||||
/**
|
||||
* Removes `key` and its value from the map.
|
||||
*
|
||||
* @private
|
||||
* @name delete
|
||||
* @memberOf MapCache
|
||||
* @param {string} key The key of the value to remove.
|
||||
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
||||
*/
|
||||
function mapCacheDelete(key) {
|
||||
return getMapData(this, key)['delete'](key);
|
||||
}
|
||||
|
||||
export default mapCacheDelete;
|
||||
16
_mapCacheGet.js
Normal file
16
_mapCacheGet.js
Normal file
@@ -0,0 +1,16 @@
|
||||
import getMapData from './_getMapData';
|
||||
|
||||
/**
|
||||
* Gets the map value for `key`.
|
||||
*
|
||||
* @private
|
||||
* @name get
|
||||
* @memberOf MapCache
|
||||
* @param {string} key The key of the value to get.
|
||||
* @returns {*} Returns the entry value.
|
||||
*/
|
||||
function mapCacheGet(key) {
|
||||
return getMapData(this, key).get(key);
|
||||
}
|
||||
|
||||
export default mapCacheGet;
|
||||
16
_mapCacheHas.js
Normal file
16
_mapCacheHas.js
Normal file
@@ -0,0 +1,16 @@
|
||||
import getMapData from './_getMapData';
|
||||
|
||||
/**
|
||||
* Checks if a map value for `key` exists.
|
||||
*
|
||||
* @private
|
||||
* @name has
|
||||
* @memberOf MapCache
|
||||
* @param {string} key The key of the entry to check.
|
||||
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
||||
*/
|
||||
function mapCacheHas(key) {
|
||||
return getMapData(this, key).has(key);
|
||||
}
|
||||
|
||||
export default mapCacheHas;
|
||||
18
_mapCacheSet.js
Normal file
18
_mapCacheSet.js
Normal file
@@ -0,0 +1,18 @@
|
||||
import getMapData from './_getMapData';
|
||||
|
||||
/**
|
||||
* Sets the map `key` to `value`.
|
||||
*
|
||||
* @private
|
||||
* @name set
|
||||
* @memberOf MapCache
|
||||
* @param {string} key The key of the value to set.
|
||||
* @param {*} value The value to set.
|
||||
* @returns {Object} Returns the map cache instance.
|
||||
*/
|
||||
function mapCacheSet(key, value) {
|
||||
getMapData(this, key).set(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
export default mapCacheSet;
|
||||
@@ -1,23 +0,0 @@
|
||||
import Map from './_Map';
|
||||
import assocDelete from './_assocDelete';
|
||||
import hashDelete from './_hashDelete';
|
||||
import isKeyable from './_isKeyable';
|
||||
|
||||
/**
|
||||
* Removes `key` and its value from the map.
|
||||
*
|
||||
* @private
|
||||
* @name delete
|
||||
* @memberOf MapCache
|
||||
* @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);
|
||||
}
|
||||
|
||||
export default mapDelete;
|
||||
23
_mapGet.js
23
_mapGet.js
@@ -1,23 +0,0 @@
|
||||
import Map from './_Map';
|
||||
import assocGet from './_assocGet';
|
||||
import hashGet from './_hashGet';
|
||||
import isKeyable from './_isKeyable';
|
||||
|
||||
/**
|
||||
* Gets the map value for `key`.
|
||||
*
|
||||
* @private
|
||||
* @name get
|
||||
* @memberOf MapCache
|
||||
* @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);
|
||||
}
|
||||
|
||||
export default mapGet;
|
||||
23
_mapHas.js
23
_mapHas.js
@@ -1,23 +0,0 @@
|
||||
import Map from './_Map';
|
||||
import assocHas from './_assocHas';
|
||||
import hashHas from './_hashHas';
|
||||
import isKeyable from './_isKeyable';
|
||||
|
||||
/**
|
||||
* Checks if a map value for `key` exists.
|
||||
*
|
||||
* @private
|
||||
* @name has
|
||||
* @memberOf MapCache
|
||||
* @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);
|
||||
}
|
||||
|
||||
export default mapHas;
|
||||
28
_mapSet.js
28
_mapSet.js
@@ -1,28 +0,0 @@
|
||||
import Map from './_Map';
|
||||
import assocSet from './_assocSet';
|
||||
import hashSet from './_hashSet';
|
||||
import isKeyable from './_isKeyable';
|
||||
|
||||
/**
|
||||
* Sets the map `key` to `value`.
|
||||
*
|
||||
* @private
|
||||
* @name set
|
||||
* @memberOf MapCache
|
||||
* @param {string} key The key of the value to set.
|
||||
* @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);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
export default mapSet;
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* 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,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* @private
|
||||
* @param {string} key The key of the property to get.
|
||||
* @param {*} srcValue The value to match.
|
||||
* @returns {Function} Returns the new function.
|
||||
* @returns {Function} Returns the new spec function.
|
||||
*/
|
||||
function matchesStrictComparable(key, srcValue) {
|
||||
return function(object) {
|
||||
|
||||
19
_setCacheAdd.js
Normal file
19
_setCacheAdd.js
Normal file
@@ -0,0 +1,19 @@
|
||||
/** Used to stand-in for `undefined` hash values. */
|
||||
var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
||||
|
||||
/**
|
||||
* Adds `value` to the array cache.
|
||||
*
|
||||
* @private
|
||||
* @name add
|
||||
* @memberOf SetCache
|
||||
* @alias push
|
||||
* @param {*} value The value to cache.
|
||||
* @returns {Object} Returns the cache instance.
|
||||
*/
|
||||
function setCacheAdd(value) {
|
||||
this.__data__.set(value, HASH_UNDEFINED);
|
||||
return this;
|
||||
}
|
||||
|
||||
export default setCacheAdd;
|
||||
14
_setCacheHas.js
Normal file
14
_setCacheHas.js
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Checks if `value` is in the array cache.
|
||||
*
|
||||
* @private
|
||||
* @name has
|
||||
* @memberOf SetCache
|
||||
* @param {*} value The value to search for.
|
||||
* @returns {number} Returns `true` if `value` is found, else `false`.
|
||||
*/
|
||||
function setCacheHas(value) {
|
||||
return this.__data__.has(value);
|
||||
}
|
||||
|
||||
export default setCacheHas;
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* 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,
|
||||
|
||||
18
_setToPairs.js
Normal file
18
_setToPairs.js
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Converts `set` to its value-value pairs.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} set The set to convert.
|
||||
* @returns {Array} Returns the value-value pairs.
|
||||
*/
|
||||
function setToPairs(set) {
|
||||
var index = -1,
|
||||
result = Array(set.size);
|
||||
|
||||
set.forEach(function(value) {
|
||||
result[++index] = [value, value];
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
export default setToPairs;
|
||||
@@ -1,3 +1,5 @@
|
||||
import ListCache from './_ListCache';
|
||||
|
||||
/**
|
||||
* Removes all key-value entries from the stack.
|
||||
*
|
||||
@@ -6,7 +8,7 @@
|
||||
* @memberOf Stack
|
||||
*/
|
||||
function stackClear() {
|
||||
this.__data__ = { 'array': [], 'map': null };
|
||||
this.__data__ = new ListCache;
|
||||
}
|
||||
|
||||
export default stackClear;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import assocDelete from './_assocDelete';
|
||||
|
||||
/**
|
||||
* Removes `key` and its value from the stack.
|
||||
*
|
||||
@@ -10,10 +8,7 @@ import assocDelete from './_assocDelete';
|
||||
* @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);
|
||||
}
|
||||
|
||||
export default stackDelete;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import assocGet from './_assocGet';
|
||||
|
||||
/**
|
||||
* Gets the stack value for `key`.
|
||||
*
|
||||
@@ -10,10 +8,7 @@ import assocGet from './_assocGet';
|
||||
* @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);
|
||||
}
|
||||
|
||||
export default stackGet;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import assocHas from './_assocHas';
|
||||
|
||||
/**
|
||||
* Checks if a stack value for `key` exists.
|
||||
*
|
||||
@@ -10,10 +8,7 @@ import assocHas from './_assocHas';
|
||||
* @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);
|
||||
}
|
||||
|
||||
export default stackHas;
|
||||
|
||||
20
_stackSet.js
20
_stackSet.js
@@ -1,5 +1,5 @@
|
||||
import ListCache from './_ListCache';
|
||||
import MapCache from './_MapCache';
|
||||
import assocSet from './_assocSet';
|
||||
|
||||
/** Used as the size to enable large array optimizations. */
|
||||
var LARGE_ARRAY_SIZE = 200;
|
||||
@@ -15,21 +15,11 @@ var LARGE_ARRAY_SIZE = 200;
|
||||
* @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;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import dropWhile from './dropWhile';
|
||||
import fill from './fill';
|
||||
import findIndex from './findIndex';
|
||||
import findLastIndex from './findLastIndex';
|
||||
import first from './first';
|
||||
import flatten from './flatten';
|
||||
import flattenDeep from './flattenDeep';
|
||||
import flattenDepth from './flattenDepth';
|
||||
@@ -66,15 +67,15 @@ import zipWith from './zipWith';
|
||||
export default {
|
||||
chunk, compact, concat, difference, differenceBy,
|
||||
differenceWith, drop, dropRight, dropRightWhile, dropWhile,
|
||||
fill, findIndex, findLastIndex, flatten, flattenDeep,
|
||||
flattenDepth, fromPairs, head, indexOf, initial,
|
||||
intersection, intersectionBy, intersectionWith, join, last,
|
||||
lastIndexOf, nth, pull, pullAll, pullAllBy,
|
||||
pullAllWith, pullAt, remove, reverse, slice,
|
||||
sortedIndex, sortedIndexBy, sortedIndexOf, sortedLastIndex, sortedLastIndexBy,
|
||||
sortedLastIndexOf, sortedUniq, sortedUniqBy, tail, take,
|
||||
takeRight, takeRightWhile, takeWhile, union, unionBy,
|
||||
unionWith, uniq, uniqBy, uniqWith, unzip,
|
||||
unzipWith, without, xor, xorBy, xorWith,
|
||||
zip, zipObject, zipObjectDeep, zipWith
|
||||
fill, findIndex, findLastIndex, first, flatten,
|
||||
flattenDeep, flattenDepth, fromPairs, head, indexOf,
|
||||
initial, intersection, intersectionBy, intersectionWith, join,
|
||||
last, lastIndexOf, nth, pull, pullAll,
|
||||
pullAllBy, pullAllWith, pullAt, remove, reverse,
|
||||
slice, sortedIndex, sortedIndexBy, sortedIndexOf, sortedLastIndex,
|
||||
sortedLastIndexBy, sortedLastIndexOf, sortedUniq, sortedUniqBy, tail,
|
||||
take, takeRight, takeRightWhile, takeWhile, union,
|
||||
unionBy, unionWith, uniq, uniqBy, uniqWith,
|
||||
unzip, unzipWith, without, xor, xorBy,
|
||||
xorWith, zip, zipObject, zipObjectDeep, zipWith
|
||||
};
|
||||
|
||||
1
array.js
1
array.js
@@ -11,6 +11,7 @@ export { default as dropWhile } from './dropWhile';
|
||||
export { default as fill } from './fill';
|
||||
export { default as findIndex } from './findIndex';
|
||||
export { default as findLastIndex } from './findLastIndex';
|
||||
export { default as first } from './first';
|
||||
export { default as flatten } from './flatten';
|
||||
export { default as flattenDeep } from './flattenDeep';
|
||||
export { default as flattenDepth } from './flattenDepth';
|
||||
|
||||
2
ary.js
2
ary.js
@@ -14,7 +14,7 @@ var ARY_FLAG = 128;
|
||||
* @param {Function} func The function to cap arguments for.
|
||||
* @param {number} [n=func.length] The arity cap.
|
||||
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
||||
* @returns {Function} Returns the new function.
|
||||
* @returns {Function} Returns the new capped function.
|
||||
* @example
|
||||
*
|
||||
* _.map(['6', '8', '10'], _.ary(parseInt, 1));
|
||||
|
||||
2
at.js
2
at.js
@@ -11,7 +11,7 @@ import rest from './rest';
|
||||
* @category Object
|
||||
* @param {Object} object The object to iterate over.
|
||||
* @param {...(string|string[])} [paths] The property paths of elements to pick.
|
||||
* @returns {Array} Returns the new array of picked elements.
|
||||
* @returns {Array} Returns the picked values.
|
||||
* @example
|
||||
*
|
||||
* var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
|
||||
|
||||
4
bind.js
4
bind.js
@@ -1,5 +1,5 @@
|
||||
import createWrapper from './_createWrapper';
|
||||
import getPlaceholder from './_getPlaceholder';
|
||||
import getHolder from './_getHolder';
|
||||
import replaceHolders from './_replaceHolders';
|
||||
import rest from './rest';
|
||||
|
||||
@@ -45,7 +45,7 @@ var BIND_FLAG = 1,
|
||||
var bind = rest(function(func, thisArg, partials) {
|
||||
var bitmask = BIND_FLAG;
|
||||
if (partials.length) {
|
||||
var holders = replaceHolders(partials, getPlaceholder(bind));
|
||||
var holders = replaceHolders(partials, getHolder(bind));
|
||||
bitmask |= PARTIAL_FLAG;
|
||||
}
|
||||
return createWrapper(func, bitmask, thisArg, partials, holders);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import createWrapper from './_createWrapper';
|
||||
import getPlaceholder from './_getPlaceholder';
|
||||
import getHolder from './_getHolder';
|
||||
import replaceHolders from './_replaceHolders';
|
||||
import rest from './rest';
|
||||
|
||||
@@ -56,7 +56,7 @@ var BIND_FLAG = 1,
|
||||
var bindKey = rest(function(object, key, partials) {
|
||||
var bitmask = BIND_FLAG | BIND_KEY_FLAG;
|
||||
if (partials.length) {
|
||||
var holders = replaceHolders(partials, getPlaceholder(bindKey));
|
||||
var holders = replaceHolders(partials, getHolder(bindKey));
|
||||
bitmask |= PARTIAL_FLAG;
|
||||
}
|
||||
return createWrapper(key, bitmask, object, partials, holders);
|
||||
|
||||
2
chunk.js
2
chunk.js
@@ -18,7 +18,7 @@ var nativeCeil = Math.ceil,
|
||||
* @param {Array} array The array to process.
|
||||
* @param {number} [size=1] The length of each chunk
|
||||
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
||||
* @returns {Array} Returns the new array containing chunks.
|
||||
* @returns {Array} Returns the new array of chunks.
|
||||
* @example
|
||||
*
|
||||
* _.chunk(['a', 'b', 'c', 'd'], 2);
|
||||
|
||||
20
concat.js
20
concat.js
@@ -1,7 +1,7 @@
|
||||
import arrayConcat from './_arrayConcat';
|
||||
import arrayPush from './_arrayPush';
|
||||
import baseFlatten from './_baseFlatten';
|
||||
import castArray from './castArray';
|
||||
import copyArray from './_copyArray';
|
||||
import isArray from './isArray';
|
||||
|
||||
/**
|
||||
* Creates a new array concatenating `array` with any additional arrays
|
||||
@@ -27,16 +27,16 @@ import copyArray from './_copyArray';
|
||||
*/
|
||||
function concat() {
|
||||
var length = arguments.length,
|
||||
array = castArray(arguments[0]);
|
||||
args = Array(length ? length - 1 : 0),
|
||||
array = arguments[0],
|
||||
index = length;
|
||||
|
||||
if (length < 2) {
|
||||
return length ? copyArray(array) : [];
|
||||
while (index--) {
|
||||
args[index - 1] = arguments[index];
|
||||
}
|
||||
var args = Array(length - 1);
|
||||
while (length--) {
|
||||
args[length - 1] = arguments[length];
|
||||
}
|
||||
return arrayConcat(array, baseFlatten(args, 1));
|
||||
return length
|
||||
? arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1))
|
||||
: [];
|
||||
}
|
||||
|
||||
export default concat;
|
||||
|
||||
2
cond.js
2
cond.js
@@ -17,7 +17,7 @@ var FUNC_ERROR_TEXT = 'Expected a function';
|
||||
* @since 4.0.0
|
||||
* @category Util
|
||||
* @param {Array} pairs The predicate-function pairs.
|
||||
* @returns {Function} Returns the new function.
|
||||
* @returns {Function} Returns the new composite function.
|
||||
* @example
|
||||
*
|
||||
* var func = _.cond([
|
||||
|
||||
@@ -11,7 +11,7 @@ import baseConforms from './_baseConforms';
|
||||
* @since 4.0.0
|
||||
* @category Util
|
||||
* @param {Object} source The object of property predicates to conform to.
|
||||
* @returns {Function} Returns the new function.
|
||||
* @returns {Function} Returns the new spec function.
|
||||
* @example
|
||||
*
|
||||
* var users = [
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* @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' };
|
||||
|
||||
2
flip.js
2
flip.js
@@ -11,7 +11,7 @@ var FLIP_FLAG = 512;
|
||||
* @since 4.0.0
|
||||
* @category Function
|
||||
* @param {Function} func The function to flip arguments for.
|
||||
* @returns {Function} Returns the new function.
|
||||
* @returns {Function} Returns the new flipped function.
|
||||
* @example
|
||||
*
|
||||
* var flipped = _.flip(function() {
|
||||
|
||||
2
flow.js
2
flow.js
@@ -10,7 +10,7 @@ import createFlow from './_createFlow';
|
||||
* @since 3.0.0
|
||||
* @category Util
|
||||
* @param {...(Function|Function[])} [funcs] Functions to invoke.
|
||||
* @returns {Function} Returns the new function.
|
||||
* @returns {Function} Returns the new composite function.
|
||||
* @see _.flowRight
|
||||
* @example
|
||||
*
|
||||
|
||||
@@ -9,7 +9,7 @@ import createFlow from './_createFlow';
|
||||
* @memberOf _
|
||||
* @category Util
|
||||
* @param {...(Function|Function[])} [funcs] Functions to invoke.
|
||||
* @returns {Function} Returns the new function.
|
||||
* @returns {Function} Returns the new composite function.
|
||||
* @see _.flow
|
||||
* @example
|
||||
*
|
||||
|
||||
@@ -34,9 +34,8 @@ import isArray from './isArray';
|
||||
* // => Logs 'a' then 'b' (iteration order is not guaranteed).
|
||||
*/
|
||||
function forEach(collection, iteratee) {
|
||||
return (typeof iteratee == 'function' && isArray(collection))
|
||||
? arrayEach(collection, iteratee)
|
||||
: baseEach(collection, baseIteratee(iteratee));
|
||||
var func = isArray(collection) ? arrayEach : baseEach;
|
||||
return func(collection, baseIteratee(iteratee, 3));
|
||||
}
|
||||
|
||||
export default forEach;
|
||||
|
||||
@@ -24,9 +24,8 @@ import isArray from './isArray';
|
||||
* // => Logs `2` then `1`.
|
||||
*/
|
||||
function forEachRight(collection, iteratee) {
|
||||
return (typeof iteratee == 'function' && isArray(collection))
|
||||
? arrayEachRight(collection, iteratee)
|
||||
: baseEachRight(collection, baseIteratee(iteratee));
|
||||
var func = isArray(collection) ? arrayEachRight : baseEachRight;
|
||||
return func(collection, baseIteratee(iteratee, 3));
|
||||
}
|
||||
|
||||
export default forEachRight;
|
||||
|
||||
2
forIn.js
2
forIn.js
@@ -33,7 +33,7 @@ import keysIn from './keysIn';
|
||||
function forIn(object, iteratee) {
|
||||
return object == null
|
||||
? object
|
||||
: baseFor(object, baseIteratee(iteratee), keysIn);
|
||||
: baseFor(object, baseIteratee(iteratee, 3), keysIn);
|
||||
}
|
||||
|
||||
export default forIn;
|
||||
|
||||
@@ -31,7 +31,7 @@ import keysIn from './keysIn';
|
||||
function forInRight(object, iteratee) {
|
||||
return object == null
|
||||
? object
|
||||
: baseForRight(object, baseIteratee(iteratee), keysIn);
|
||||
: baseForRight(object, baseIteratee(iteratee, 3), keysIn);
|
||||
}
|
||||
|
||||
export default forInRight;
|
||||
|
||||
@@ -30,7 +30,7 @@ import baseIteratee from './_baseIteratee';
|
||||
* // => Logs 'a' then 'b' (iteration order is not guaranteed).
|
||||
*/
|
||||
function forOwn(object, iteratee) {
|
||||
return object && baseForOwn(object, baseIteratee(iteratee));
|
||||
return object && baseForOwn(object, baseIteratee(iteratee, 3));
|
||||
}
|
||||
|
||||
export default forOwn;
|
||||
|
||||
@@ -28,7 +28,7 @@ import baseIteratee from './_baseIteratee';
|
||||
* // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
|
||||
*/
|
||||
function forOwnRight(object, iteratee) {
|
||||
return object && baseForOwnRight(object, baseIteratee(iteratee));
|
||||
return object && baseForOwnRight(object, baseIteratee(iteratee, 3));
|
||||
}
|
||||
|
||||
export default forOwnRight;
|
||||
|
||||
@@ -10,7 +10,7 @@ import keys from './keys';
|
||||
* @memberOf _
|
||||
* @category Object
|
||||
* @param {Object} object The object to inspect.
|
||||
* @returns {Array} Returns the new array of property names.
|
||||
* @returns {Array} Returns the function names.
|
||||
* @see _.functionsIn
|
||||
* @example
|
||||
*
|
||||
|
||||
@@ -10,7 +10,7 @@ import keysIn from './keysIn';
|
||||
* @since 4.0.0
|
||||
* @category Object
|
||||
* @param {Object} object The object to inspect.
|
||||
* @returns {Array} Returns the new array of property names.
|
||||
* @returns {Array} Returns the function names.
|
||||
* @see _.functions
|
||||
* @example
|
||||
*
|
||||
|
||||
@@ -21,14 +21,14 @@ var nativeIsFinite = root.isFinite;
|
||||
* _.isFinite(3);
|
||||
* // => true
|
||||
*
|
||||
* _.isFinite(Number.MAX_VALUE);
|
||||
* // => true
|
||||
*
|
||||
* _.isFinite(3.14);
|
||||
* _.isFinite(Number.MIN_VALUE);
|
||||
* // => true
|
||||
*
|
||||
* _.isFinite(Infinity);
|
||||
* // => false
|
||||
*
|
||||
* _.isFinite('3');
|
||||
* // => false
|
||||
*/
|
||||
function isFinite(value) {
|
||||
return typeof value == 'number' && nativeIsFinite(value);
|
||||
|
||||
@@ -46,6 +46,7 @@ import isWeakSet from './isWeakSet';
|
||||
import lt from './lt';
|
||||
import lte from './lte';
|
||||
import toArray from './toArray';
|
||||
import toFinite from './toFinite';
|
||||
import toInteger from './toInteger';
|
||||
import toLength from './toLength';
|
||||
import toNumber from './toNumber';
|
||||
@@ -63,6 +64,6 @@ export default {
|
||||
isNil, isNull, isNumber, isObject, isObjectLike,
|
||||
isPlainObject, isRegExp, isSafeInteger, isSet, isString,
|
||||
isSymbol, isTypedArray, isUndefined, isWeakMap, isWeakSet,
|
||||
lt, lte, toArray, toInteger, toLength,
|
||||
toNumber, toPlainObject, toSafeInteger, toString
|
||||
lt, lte, toArray, toFinite, toInteger,
|
||||
toLength, toNumber, toPlainObject, toSafeInteger, toString
|
||||
};
|
||||
|
||||
1
lang.js
1
lang.js
@@ -46,6 +46,7 @@ export { default as isWeakSet } from './isWeakSet';
|
||||
export { default as lt } from './lt';
|
||||
export { default as lte } from './lte';
|
||||
export { default as toArray } from './toArray';
|
||||
export { default as toFinite } from './toFinite';
|
||||
export { default as toInteger } from './toInteger';
|
||||
export { default as toLength } from './toLength';
|
||||
export { default as toNumber } from './toNumber';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @license
|
||||
* lodash 4.11.2 (Custom Build) <https://lodash.com/>
|
||||
* lodash (Custom Build) <https://lodash.com/>
|
||||
* Build: `lodash modularize exports="es" -o ./`
|
||||
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
||||
* Released under MIT license <https://lodash.com/license>
|
||||
@@ -44,7 +44,7 @@ import toInteger from './toInteger';
|
||||
import lodash from './wrapperLodash';
|
||||
|
||||
/** Used as the semantic version number. */
|
||||
var VERSION = '4.11.2';
|
||||
var VERSION = '4.12.0';
|
||||
|
||||
/** Used to compose bitmasks for wrapper metadata. */
|
||||
var BIND_KEY_FLAG = 2;
|
||||
@@ -373,6 +373,7 @@ lodash.sum = math.sum;
|
||||
lodash.sumBy = math.sumBy;
|
||||
lodash.template = string.template;
|
||||
lodash.times = util.times;
|
||||
lodash.toFinite = lang.toFinite;
|
||||
lodash.toInteger = toInteger;
|
||||
lodash.toLength = lang.toLength;
|
||||
lodash.toLower = string.toLower;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @license
|
||||
* lodash 4.11.2 (Custom Build) <https://lodash.com/>
|
||||
* lodash (Custom Build) <https://lodash.com/>
|
||||
* Build: `lodash modularize exports="es" -o ./`
|
||||
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
||||
* Released under MIT license <https://lodash.com/license>
|
||||
@@ -74,6 +74,7 @@ export { default as findKey } from './findKey';
|
||||
export { default as findLast } from './findLast';
|
||||
export { default as findLastIndex } from './findLastIndex';
|
||||
export { default as findLastKey } from './findLastKey';
|
||||
export { default as first } from './first';
|
||||
export { default as flatMap } from './flatMap';
|
||||
export { default as flatMapDeep } from './flatMapDeep';
|
||||
export { default as flatMapDepth } from './flatMapDepth';
|
||||
@@ -262,6 +263,7 @@ export { default as throttle } from './throttle';
|
||||
export { default as thru } from './thru';
|
||||
export { default as times } from './times';
|
||||
export { default as toArray } from './toArray';
|
||||
export { default as toFinite } from './toFinite';
|
||||
export { default as toInteger } from './toInteger';
|
||||
export { default as toIterator } from './toIterator';
|
||||
export { default as toJSON } from './toJSON';
|
||||
|
||||
@@ -14,7 +14,7 @@ import baseMatches from './_baseMatches';
|
||||
* @since 3.0.0
|
||||
* @category Util
|
||||
* @param {Object} source The object of property values to match.
|
||||
* @returns {Function} Returns the new function.
|
||||
* @returns {Function} Returns the new spec function.
|
||||
* @example
|
||||
*
|
||||
* var users = [
|
||||
|
||||
@@ -14,7 +14,7 @@ import baseMatchesProperty from './_baseMatchesProperty';
|
||||
* @category Util
|
||||
* @param {Array|string} path The path of the property to get.
|
||||
* @param {*} srcValue The value to match.
|
||||
* @returns {Function} Returns the new function.
|
||||
* @returns {Function} Returns the new spec function.
|
||||
* @example
|
||||
*
|
||||
* var users = [
|
||||
|
||||
@@ -22,7 +22,7 @@ var FUNC_ERROR_TEXT = 'Expected a function';
|
||||
* @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 };
|
||||
|
||||
2
merge.js
2
merge.js
@@ -6,7 +6,7 @@ import createAssigner from './_createAssigner';
|
||||
* inherited enumerable string keyed properties of source objects into the
|
||||
* destination object. Source properties that resolve to `undefined` are
|
||||
* skipped if a destination value exists. Array and plain object properties
|
||||
* are merged recursively.Other objects and value types are overridden by
|
||||
* are merged recursively. Other objects and value types are overridden by
|
||||
* assignment. Source objects are applied from left to right. Subsequent
|
||||
* sources overwrite property assignments of previous sources.
|
||||
*
|
||||
|
||||
@@ -11,7 +11,7 @@ import rest from './rest';
|
||||
* @category Util
|
||||
* @param {Array|string} path The path of the method to invoke.
|
||||
* @param {...*} [args] The arguments to invoke the method with.
|
||||
* @returns {Function} Returns the new function.
|
||||
* @returns {Function} Returns the new invoker function.
|
||||
* @example
|
||||
*
|
||||
* var objects = [
|
||||
|
||||
@@ -12,7 +12,7 @@ import rest from './rest';
|
||||
* @category Util
|
||||
* @param {Object} object The object to query.
|
||||
* @param {...*} [args] The arguments to invoke the method with.
|
||||
* @returns {Function} Returns the new function.
|
||||
* @returns {Function} Returns the new invoker function.
|
||||
* @example
|
||||
*
|
||||
* var array = _.times(3, _.constant),
|
||||
|
||||
@@ -11,7 +11,7 @@ var FUNC_ERROR_TEXT = 'Expected a function';
|
||||
* @since 3.0.0
|
||||
* @category Function
|
||||
* @param {Function} predicate The predicate to negate.
|
||||
* @returns {Function} Returns the new function.
|
||||
* @returns {Function} Returns the new negated function.
|
||||
* @example
|
||||
*
|
||||
* function isEven(n) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user