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