mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 00:57:48 +00:00
Compare commits
1 Commits
4.16.4-amd
...
4.16.5-amd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b58a63eff1 |
2
LICENSE
2
LICENSE
@@ -1,4 +1,4 @@
|
|||||||
Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
Copyright JS Foundation and other contributors <https://js.foundation/>
|
||||||
|
|
||||||
Based on Underscore.js, copyright Jeremy Ashkenas,
|
Based on Underscore.js, copyright Jeremy Ashkenas,
|
||||||
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# lodash-amd v4.16.4
|
# lodash-amd v4.16.5
|
||||||
|
|
||||||
The [Lodash](https://lodash.com/) library exported as [AMD](https://github.com/amdjs/amdjs-api/wiki/AMD) modules.
|
The [Lodash](https://lodash.com/) library exported as [AMD](https://github.com/amdjs/amdjs-api/wiki/AMD) modules.
|
||||||
|
|
||||||
@@ -27,4 +27,4 @@ require({
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
See the [package source](https://github.com/lodash/lodash/tree/4.16.4-amd) for more details.
|
See the [package source](https://github.com/lodash/lodash/tree/4.16.5-amd) for more details.
|
||||||
|
|||||||
2
_Hash.js
2
_Hash.js
@@ -9,7 +9,7 @@ define(['./_hashClear', './_hashDelete', './_hashGet', './_hashHas', './_hashSet
|
|||||||
*/
|
*/
|
||||||
function Hash(entries) {
|
function Hash(entries) {
|
||||||
var index = -1,
|
var index = -1,
|
||||||
length = entries ? entries.length : 0;
|
length = entries == null ? 0 : entries.length;
|
||||||
|
|
||||||
this.clear();
|
this.clear();
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ define(['./_listCacheClear', './_listCacheDelete', './_listCacheGet', './_listCa
|
|||||||
*/
|
*/
|
||||||
function ListCache(entries) {
|
function ListCache(entries) {
|
||||||
var index = -1,
|
var index = -1,
|
||||||
length = entries ? entries.length : 0;
|
length = entries == null ? 0 : entries.length;
|
||||||
|
|
||||||
this.clear();
|
this.clear();
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ define(['./_mapCacheClear', './_mapCacheDelete', './_mapCacheGet', './_mapCacheH
|
|||||||
*/
|
*/
|
||||||
function MapCache(entries) {
|
function MapCache(entries) {
|
||||||
var index = -1,
|
var index = -1,
|
||||||
length = entries ? entries.length : 0;
|
length = entries == null ? 0 : entries.length;
|
||||||
|
|
||||||
this.clear();
|
this.clear();
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ define(['./_MapCache', './_setCacheAdd', './_setCacheHas'], function(MapCache, s
|
|||||||
*/
|
*/
|
||||||
function SetCache(values) {
|
function SetCache(values) {
|
||||||
var index = -1,
|
var index = -1,
|
||||||
length = values ? values.length : 0;
|
length = values == null ? 0 : values.length;
|
||||||
|
|
||||||
this.__data__ = new MapCache;
|
this.__data__ = new MapCache;
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ define([], function() {
|
|||||||
*/
|
*/
|
||||||
function arrayAggregator(array, setter, iteratee, accumulator) {
|
function arrayAggregator(array, setter, iteratee, accumulator) {
|
||||||
var index = -1,
|
var index = -1,
|
||||||
length = array ? array.length : 0;
|
length = array == null ? 0 : array.length;
|
||||||
|
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
var value = array[index];
|
var value = array[index];
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ define([], function() {
|
|||||||
*/
|
*/
|
||||||
function arrayEach(array, iteratee) {
|
function arrayEach(array, iteratee) {
|
||||||
var index = -1,
|
var index = -1,
|
||||||
length = array ? array.length : 0;
|
length = array == null ? 0 : array.length;
|
||||||
|
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
if (iteratee(array[index], index, array) === false) {
|
if (iteratee(array[index], index, array) === false) {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ define([], function() {
|
|||||||
* @returns {Array} Returns `array`.
|
* @returns {Array} Returns `array`.
|
||||||
*/
|
*/
|
||||||
function arrayEachRight(array, iteratee) {
|
function arrayEachRight(array, iteratee) {
|
||||||
var length = array ? array.length : 0;
|
var length = array == null ? 0 : array.length;
|
||||||
|
|
||||||
while (length--) {
|
while (length--) {
|
||||||
if (iteratee(array[length], length, array) === false) {
|
if (iteratee(array[length], length, array) === false) {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ define([], function() {
|
|||||||
*/
|
*/
|
||||||
function arrayEvery(array, predicate) {
|
function arrayEvery(array, predicate) {
|
||||||
var index = -1,
|
var index = -1,
|
||||||
length = array ? array.length : 0;
|
length = array == null ? 0 : array.length;
|
||||||
|
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
if (!predicate(array[index], index, array)) {
|
if (!predicate(array[index], index, array)) {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ define([], function() {
|
|||||||
*/
|
*/
|
||||||
function arrayFilter(array, predicate) {
|
function arrayFilter(array, predicate) {
|
||||||
var index = -1,
|
var index = -1,
|
||||||
length = array ? array.length : 0,
|
length = array == null ? 0 : array.length,
|
||||||
resIndex = 0,
|
resIndex = 0,
|
||||||
result = [];
|
result = [];
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ define(['./_baseIndexOf'], function(baseIndexOf) {
|
|||||||
* @returns {boolean} Returns `true` if `target` is found, else `false`.
|
* @returns {boolean} Returns `true` if `target` is found, else `false`.
|
||||||
*/
|
*/
|
||||||
function arrayIncludes(array, value) {
|
function arrayIncludes(array, value) {
|
||||||
var length = array ? array.length : 0;
|
var length = array == null ? 0 : array.length;
|
||||||
return !!length && baseIndexOf(array, value, 0) > -1;
|
return !!length && baseIndexOf(array, value, 0) > -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ define([], function() {
|
|||||||
*/
|
*/
|
||||||
function arrayIncludesWith(array, value, comparator) {
|
function arrayIncludesWith(array, value, comparator) {
|
||||||
var index = -1,
|
var index = -1,
|
||||||
length = array ? array.length : 0;
|
length = array == null ? 0 : array.length;
|
||||||
|
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
if (comparator(value, array[index])) {
|
if (comparator(value, array[index])) {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ define([], function() {
|
|||||||
*/
|
*/
|
||||||
function arrayMap(array, iteratee) {
|
function arrayMap(array, iteratee) {
|
||||||
var index = -1,
|
var index = -1,
|
||||||
length = array ? array.length : 0,
|
length = array == null ? 0 : array.length,
|
||||||
result = Array(length);
|
result = Array(length);
|
||||||
|
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ define([], function() {
|
|||||||
*/
|
*/
|
||||||
function arrayReduce(array, iteratee, accumulator, initAccum) {
|
function arrayReduce(array, iteratee, accumulator, initAccum) {
|
||||||
var index = -1,
|
var index = -1,
|
||||||
length = array ? array.length : 0;
|
length = array == null ? 0 : array.length;
|
||||||
|
|
||||||
if (initAccum && length) {
|
if (initAccum && length) {
|
||||||
accumulator = array[++index];
|
accumulator = array[++index];
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ define([], function() {
|
|||||||
* @returns {*} Returns the accumulated value.
|
* @returns {*} Returns the accumulated value.
|
||||||
*/
|
*/
|
||||||
function arrayReduceRight(array, iteratee, accumulator, initAccum) {
|
function arrayReduceRight(array, iteratee, accumulator, initAccum) {
|
||||||
var length = array ? array.length : 0;
|
var length = array == null ? 0 : array.length;
|
||||||
if (initAccum && length) {
|
if (initAccum && length) {
|
||||||
accumulator = array[--length];
|
accumulator = array[--length];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ define([], function() {
|
|||||||
*/
|
*/
|
||||||
function arraySome(array, predicate) {
|
function arraySome(array, predicate) {
|
||||||
var index = -1,
|
var index = -1,
|
||||||
length = array ? array.length : 0;
|
length = array == null ? 0 : array.length;
|
||||||
|
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
if (predicate(array[index], index, array)) {
|
if (predicate(array[index], index, array)) {
|
||||||
|
|||||||
@@ -13,12 +13,12 @@ define(['./get'], function(get) {
|
|||||||
*/
|
*/
|
||||||
function baseAt(object, paths) {
|
function baseAt(object, paths) {
|
||||||
var index = -1,
|
var index = -1,
|
||||||
isNil = object == null,
|
|
||||||
length = paths.length,
|
length = paths.length,
|
||||||
result = Array(length);
|
result = Array(length),
|
||||||
|
skip = object == null;
|
||||||
|
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
result[index] = isNil ? undefined : get(object, paths[index]);
|
result[index] = skip ? undefined : get(object, paths[index]);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ define(['./_SetCache', './_arrayIncludes', './_arrayIncludesWith', './_arrayMap'
|
|||||||
outer:
|
outer:
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
var value = array[index],
|
var value = array[index],
|
||||||
computed = iteratee ? iteratee(value) : value;
|
computed = iteratee == null ? value : iteratee(value);
|
||||||
|
|
||||||
value = (comparator || value !== 0) ? value : 0;
|
value = (comparator || value !== 0) ? value : 0;
|
||||||
if (isCommon && computed === computed) {
|
if (isCommon && computed === computed) {
|
||||||
|
|||||||
@@ -1,24 +1,30 @@
|
|||||||
define([], function() {
|
define(['./_Symbol', './_getRawTag', './_objectToString'], function(Symbol, getRawTag, objectToString) {
|
||||||
|
|
||||||
/** Used for built-in method references. */
|
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||||
var objectProto = Object.prototype;
|
var undefined;
|
||||||
|
|
||||||
|
/** `Object#toString` result references. */
|
||||||
|
var nullTag = '[object Null]',
|
||||||
|
undefinedTag = '[object Undefined]';
|
||||||
|
|
||||||
|
/** Built-in value references. */
|
||||||
|
var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to resolve the
|
* The base implementation of `getTag` without fallbacks for buggy environments.
|
||||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
||||||
* of values.
|
|
||||||
*/
|
|
||||||
var objectToString = objectProto.toString;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The base implementation of `getTag`.
|
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {*} value The value to query.
|
* @param {*} value The value to query.
|
||||||
* @returns {string} Returns the `toStringTag`.
|
* @returns {string} Returns the `toStringTag`.
|
||||||
*/
|
*/
|
||||||
function baseGetTag(value) {
|
function baseGetTag(value) {
|
||||||
return objectToString.call(value);
|
if (value == null) {
|
||||||
|
return value === undefined ? undefinedTag : nullTag;
|
||||||
|
}
|
||||||
|
value = Object(value);
|
||||||
|
return (symToStringTag && symToStringTag in value)
|
||||||
|
? getRawTag(value)
|
||||||
|
: objectToString(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return baseGetTag;
|
return baseGetTag;
|
||||||
|
|||||||
@@ -1,18 +1,8 @@
|
|||||||
define(['./isObjectLike'], function(isObjectLike) {
|
define(['./_baseGetTag', './isObjectLike'], function(baseGetTag, isObjectLike) {
|
||||||
|
|
||||||
/** `Object#toString` result references. */
|
/** `Object#toString` result references. */
|
||||||
var argsTag = '[object Arguments]';
|
var argsTag = '[object Arguments]';
|
||||||
|
|
||||||
/** Used for built-in method references. */
|
|
||||||
var objectProto = Object.prototype;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to resolve the
|
|
||||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
||||||
* of values.
|
|
||||||
*/
|
|
||||||
var objectToString = objectProto.toString;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `_.isArguments`.
|
* The base implementation of `_.isArguments`.
|
||||||
*
|
*
|
||||||
@@ -21,7 +11,7 @@ define(['./isObjectLike'], function(isObjectLike) {
|
|||||||
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
||||||
*/
|
*/
|
||||||
function baseIsArguments(value) {
|
function baseIsArguments(value) {
|
||||||
return isObjectLike(value) && objectToString.call(value) == argsTag;
|
return isObjectLike(value) && baseGetTag(value) == argsTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
return baseIsArguments;
|
return baseIsArguments;
|
||||||
|
|||||||
@@ -1,17 +1,7 @@
|
|||||||
define(['./isObjectLike'], function(isObjectLike) {
|
define(['./_baseGetTag', './isObjectLike'], function(baseGetTag, isObjectLike) {
|
||||||
|
|
||||||
var arrayBufferTag = '[object ArrayBuffer]';
|
var arrayBufferTag = '[object ArrayBuffer]';
|
||||||
|
|
||||||
/** Used for built-in method references. */
|
|
||||||
var objectProto = Object.prototype;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to resolve the
|
|
||||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
||||||
* of values.
|
|
||||||
*/
|
|
||||||
var objectToString = objectProto.toString;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `_.isArrayBuffer` without Node.js optimizations.
|
* The base implementation of `_.isArrayBuffer` without Node.js optimizations.
|
||||||
*
|
*
|
||||||
@@ -20,7 +10,7 @@ define(['./isObjectLike'], function(isObjectLike) {
|
|||||||
* @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
|
* @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
|
||||||
*/
|
*/
|
||||||
function baseIsArrayBuffer(value) {
|
function baseIsArrayBuffer(value) {
|
||||||
return isObjectLike(value) && objectToString.call(value) == arrayBufferTag;
|
return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
return baseIsArrayBuffer;
|
return baseIsArrayBuffer;
|
||||||
|
|||||||
@@ -1,18 +1,8 @@
|
|||||||
define(['./isObjectLike'], function(isObjectLike) {
|
define(['./_baseGetTag', './isObjectLike'], function(baseGetTag, isObjectLike) {
|
||||||
|
|
||||||
/** `Object#toString` result references. */
|
/** `Object#toString` result references. */
|
||||||
var dateTag = '[object Date]';
|
var dateTag = '[object Date]';
|
||||||
|
|
||||||
/** Used for built-in method references. */
|
|
||||||
var objectProto = Object.prototype;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to resolve the
|
|
||||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
||||||
* of values.
|
|
||||||
*/
|
|
||||||
var objectToString = objectProto.toString;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `_.isDate` without Node.js optimizations.
|
* The base implementation of `_.isDate` without Node.js optimizations.
|
||||||
*
|
*
|
||||||
@@ -21,7 +11,7 @@ define(['./isObjectLike'], function(isObjectLike) {
|
|||||||
* @returns {boolean} Returns `true` if `value` is a date object, else `false`.
|
* @returns {boolean} Returns `true` if `value` is a date object, else `false`.
|
||||||
*/
|
*/
|
||||||
function baseIsDate(value) {
|
function baseIsDate(value) {
|
||||||
return isObjectLike(value) && objectToString.call(value) == dateTag;
|
return isObjectLike(value) && baseGetTag(value) == dateTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
return baseIsDate;
|
return baseIsDate;
|
||||||
|
|||||||
@@ -1,18 +1,8 @@
|
|||||||
define(['./isObject'], function(isObject) {
|
define(['./_baseGetTag', './isObjectLike'], function(baseGetTag, isObjectLike) {
|
||||||
|
|
||||||
/** `Object#toString` result references. */
|
/** `Object#toString` result references. */
|
||||||
var regexpTag = '[object RegExp]';
|
var regexpTag = '[object RegExp]';
|
||||||
|
|
||||||
/** Used for built-in method references. */
|
|
||||||
var objectProto = Object.prototype;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to resolve the
|
|
||||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
||||||
* of values.
|
|
||||||
*/
|
|
||||||
var objectToString = objectProto.toString;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `_.isRegExp` without Node.js optimizations.
|
* The base implementation of `_.isRegExp` without Node.js optimizations.
|
||||||
*
|
*
|
||||||
@@ -21,7 +11,7 @@ define(['./isObject'], function(isObject) {
|
|||||||
* @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
|
* @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
|
||||||
*/
|
*/
|
||||||
function baseIsRegExp(value) {
|
function baseIsRegExp(value) {
|
||||||
return isObject(value) && objectToString.call(value) == regexpTag;
|
return isObjectLike(value) && baseGetTag(value) == regexpTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
return baseIsRegExp;
|
return baseIsRegExp;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
define(['./isLength', './isObjectLike'], function(isLength, isObjectLike) {
|
define(['./_baseGetTag', './isLength', './isObjectLike'], function(baseGetTag, isLength, isObjectLike) {
|
||||||
|
|
||||||
/** `Object#toString` result references. */
|
/** `Object#toString` result references. */
|
||||||
var argsTag = '[object Arguments]',
|
var argsTag = '[object Arguments]',
|
||||||
@@ -43,16 +43,6 @@ define(['./isLength', './isObjectLike'], function(isLength, isObjectLike) {
|
|||||||
typedArrayTags[setTag] = typedArrayTags[stringTag] =
|
typedArrayTags[setTag] = typedArrayTags[stringTag] =
|
||||||
typedArrayTags[weakMapTag] = false;
|
typedArrayTags[weakMapTag] = false;
|
||||||
|
|
||||||
/** Used for built-in method references. */
|
|
||||||
var objectProto = Object.prototype;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to resolve the
|
|
||||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
||||||
* of values.
|
|
||||||
*/
|
|
||||||
var objectToString = objectProto.toString;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `_.isTypedArray` without Node.js optimizations.
|
* The base implementation of `_.isTypedArray` without Node.js optimizations.
|
||||||
*
|
*
|
||||||
@@ -62,7 +52,7 @@ define(['./isLength', './isObjectLike'], function(isLength, isObjectLike) {
|
|||||||
*/
|
*/
|
||||||
function baseIsTypedArray(value) {
|
function baseIsTypedArray(value) {
|
||||||
return isObjectLike(value) &&
|
return isObjectLike(value) &&
|
||||||
isLength(value.length) && !!typedArrayTags[objectToString.call(value)];
|
isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
|
||||||
}
|
}
|
||||||
|
|
||||||
return baseIsTypedArray;
|
return baseIsTypedArray;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ define(['./_baseSum'], function(baseSum) {
|
|||||||
* @returns {number} Returns the mean.
|
* @returns {number} Returns the mean.
|
||||||
*/
|
*/
|
||||||
function baseMean(array, iteratee) {
|
function baseMean(array, iteratee) {
|
||||||
var length = array ? array.length : 0;
|
var length = array == null ? 0 : array.length;
|
||||||
return length ? (baseSum(array, iteratee) / length) : NAN;
|
return length ? (baseSum(array, iteratee) / length) : NAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ define(['./_baseSortedIndexBy', './identity', './isSymbol'], function(baseSorted
|
|||||||
*/
|
*/
|
||||||
function baseSortedIndex(array, value, retHighest) {
|
function baseSortedIndex(array, value, retHighest) {
|
||||||
var low = 0,
|
var low = 0,
|
||||||
high = array ? array.length : low;
|
high = array == null ? low : array.length;
|
||||||
|
|
||||||
if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
|
if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
|
||||||
while (low < high) {
|
while (low < high) {
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ define(['./isSymbol'], function(isSymbol) {
|
|||||||
value = iteratee(value);
|
value = iteratee(value);
|
||||||
|
|
||||||
var low = 0,
|
var low = 0,
|
||||||
high = array ? array.length : 0,
|
high = array == null ? 0 : array.length,
|
||||||
valIsNaN = value !== value,
|
valIsNaN = value !== value,
|
||||||
valIsNull = value === null,
|
valIsNull = value === null,
|
||||||
valIsSymbol = isSymbol(value),
|
valIsSymbol = isSymbol(value),
|
||||||
|
|||||||
25
_baseXor.js
25
_baseXor.js
@@ -1,4 +1,4 @@
|
|||||||
define(['./_arrayPush', './_baseDifference', './_baseUniq'], function(arrayPush, baseDifference, baseUniq) {
|
define(['./_baseDifference', './_baseFlatten', './_baseUniq'], function(baseDifference, baseFlatten, baseUniq) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of methods like `_.xor`, without support for
|
* The base implementation of methods like `_.xor`, without support for
|
||||||
@@ -11,18 +11,25 @@ define(['./_arrayPush', './_baseDifference', './_baseUniq'], function(arrayPush,
|
|||||||
* @returns {Array} Returns the new array of values.
|
* @returns {Array} Returns the new array of values.
|
||||||
*/
|
*/
|
||||||
function baseXor(arrays, iteratee, comparator) {
|
function baseXor(arrays, iteratee, comparator) {
|
||||||
|
var length = arrays.length;
|
||||||
|
if (length < 2) {
|
||||||
|
return length ? baseUniq(arrays[0]) : [];
|
||||||
|
}
|
||||||
var index = -1,
|
var index = -1,
|
||||||
length = arrays.length;
|
result = Array(length);
|
||||||
|
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
var result = result
|
var array = arrays[index],
|
||||||
? arrayPush(
|
othIndex = -1;
|
||||||
baseDifference(result, arrays[index], iteratee, comparator),
|
|
||||||
baseDifference(arrays[index], result, iteratee, comparator)
|
while (++othIndex < length) {
|
||||||
)
|
var othArray = arrays[othIndex];
|
||||||
: arrays[index];
|
if (othArray !== array) {
|
||||||
|
result[index] = baseDifference(result[index] || array, othArray, iteratee, comparator);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return (result && result.length) ? baseUniq(result, iteratee, comparator) : [];
|
return baseUniq(baseFlatten(result, 1), iteratee, comparator);
|
||||||
}
|
}
|
||||||
|
|
||||||
return baseXor;
|
return baseXor;
|
||||||
|
|||||||
50
_getRawTag.js
Normal file
50
_getRawTag.js
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
define(['./_Symbol'], function(Symbol) {
|
||||||
|
|
||||||
|
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||||
|
var undefined;
|
||||||
|
|
||||||
|
/** Used for built-in method references. */
|
||||||
|
var objectProto = Object.prototype;
|
||||||
|
|
||||||
|
/** Used to check objects for own properties. */
|
||||||
|
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to resolve the
|
||||||
|
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
||||||
|
* of values.
|
||||||
|
*/
|
||||||
|
var nativeObjectToString = objectProto.toString;
|
||||||
|
|
||||||
|
/** Built-in value references. */
|
||||||
|
var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {*} value The value to query.
|
||||||
|
* @returns {string} Returns the raw `toStringTag`.
|
||||||
|
*/
|
||||||
|
function getRawTag(value) {
|
||||||
|
var isOwn = hasOwnProperty.call(value, symToStringTag),
|
||||||
|
tag = value[symToStringTag];
|
||||||
|
|
||||||
|
try {
|
||||||
|
value[symToStringTag] = undefined;
|
||||||
|
var unmasked = true;
|
||||||
|
} catch (e) {}
|
||||||
|
|
||||||
|
var result = nativeObjectToString.call(value);
|
||||||
|
if (unmasked) {
|
||||||
|
if (isOwn) {
|
||||||
|
value[symToStringTag] = tag;
|
||||||
|
} else {
|
||||||
|
delete value[symToStringTag];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return getRawTag;
|
||||||
|
});
|
||||||
14
_getTag.js
14
_getTag.js
@@ -12,16 +12,6 @@ define(['./_DataView', './_Map', './_Promise', './_Set', './_WeakMap', './_baseG
|
|||||||
|
|
||||||
var dataViewTag = '[object DataView]';
|
var dataViewTag = '[object DataView]';
|
||||||
|
|
||||||
/** Used for built-in method references. */
|
|
||||||
var objectProto = Object.prototype;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to resolve the
|
|
||||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
||||||
* of values.
|
|
||||||
*/
|
|
||||||
var objectToString = objectProto.toString;
|
|
||||||
|
|
||||||
/** Used to detect maps, sets, and weakmaps. */
|
/** Used to detect maps, sets, and weakmaps. */
|
||||||
var dataViewCtorString = toSource(DataView),
|
var dataViewCtorString = toSource(DataView),
|
||||||
mapCtorString = toSource(Map),
|
mapCtorString = toSource(Map),
|
||||||
@@ -45,9 +35,9 @@ define(['./_DataView', './_Map', './_Promise', './_Set', './_WeakMap', './_baseG
|
|||||||
(Set && getTag(new Set) != setTag) ||
|
(Set && getTag(new Set) != setTag) ||
|
||||||
(WeakMap && getTag(new WeakMap) != weakMapTag)) {
|
(WeakMap && getTag(new WeakMap) != weakMapTag)) {
|
||||||
getTag = function(value) {
|
getTag = function(value) {
|
||||||
var result = objectToString.call(value),
|
var result = baseGetTag(value),
|
||||||
Ctor = result == objectTag ? value.constructor : undefined,
|
Ctor = result == objectTag ? value.constructor : undefined,
|
||||||
ctorString = Ctor ? toSource(Ctor) : undefined;
|
ctorString = Ctor ? toSource(Ctor) : '';
|
||||||
|
|
||||||
if (ctorString) {
|
if (ctorString) {
|
||||||
switch (ctorString) {
|
switch (ctorString) {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ define(['./_castPath', './isArguments', './isArray', './_isIndex', './_isKey', '
|
|||||||
if (result || ++index != length) {
|
if (result || ++index != length) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
length = object ? object.length : 0;
|
length = object == null ? 0 : object.length;
|
||||||
return !!length && isLength(length) && isIndex(key, length) &&
|
return !!length && isLength(length) && isIndex(key, length) &&
|
||||||
(isArray(object) || isArguments(object));
|
(isArray(object) || isArguments(object));
|
||||||
}
|
}
|
||||||
|
|||||||
25
_objectToString.js
Normal file
25
_objectToString.js
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
define([], function() {
|
||||||
|
|
||||||
|
/** Used for built-in method references. */
|
||||||
|
var objectProto = Object.prototype;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to resolve the
|
||||||
|
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
||||||
|
* of values.
|
||||||
|
*/
|
||||||
|
var nativeObjectToString = objectProto.toString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts `value` to a string using `Object.prototype.toString`.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {*} value The value to convert.
|
||||||
|
* @returns {string} Returns the converted string.
|
||||||
|
*/
|
||||||
|
function objectToString(value) {
|
||||||
|
return nativeObjectToString.call(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return objectToString;
|
||||||
|
});
|
||||||
@@ -4,7 +4,7 @@ define([], function() {
|
|||||||
var undefined;
|
var undefined;
|
||||||
|
|
||||||
/** Used to detect hot functions by number of calls within a span of milliseconds. */
|
/** Used to detect hot functions by number of calls within a span of milliseconds. */
|
||||||
var HOT_COUNT = 500,
|
var HOT_COUNT = 800,
|
||||||
HOT_SPAN = 16;
|
HOT_SPAN = 16;
|
||||||
|
|
||||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ define([], function() {
|
|||||||
* Converts `func` to its source code.
|
* Converts `func` to its source code.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Function} func The function to process.
|
* @param {Function} func The function to convert.
|
||||||
* @returns {string} Returns the source code.
|
* @returns {string} Returns the source code.
|
||||||
*/
|
*/
|
||||||
function toSource(func) {
|
function toSource(func) {
|
||||||
|
|||||||
@@ -31,22 +31,26 @@ define([], function() {
|
|||||||
rsZWJ = '\\u200d';
|
rsZWJ = '\\u200d';
|
||||||
|
|
||||||
/** Used to compose unicode regexes. */
|
/** Used to compose unicode regexes. */
|
||||||
var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')',
|
var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
|
||||||
rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')',
|
rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
|
||||||
rsOptLowerContr = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
|
rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
|
||||||
rsOptUpperContr = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
|
rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
|
||||||
reOptMod = rsModifier + '?',
|
reOptMod = rsModifier + '?',
|
||||||
rsOptVar = '[' + rsVarRange + ']?',
|
rsOptVar = '[' + rsVarRange + ']?',
|
||||||
rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
|
rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
|
||||||
|
rsOrdLower = '\\d*(?:(?:1st|2nd|3rd|(?![123])\\dth)\\b)',
|
||||||
|
rsOrdUpper = '\\d*(?:(?:1ST|2ND|3RD|(?![123])\\dTH)\\b)',
|
||||||
rsSeq = rsOptVar + reOptMod + rsOptJoin,
|
rsSeq = rsOptVar + reOptMod + rsOptJoin,
|
||||||
rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq;
|
rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq;
|
||||||
|
|
||||||
/** Used to match complex or compound words. */
|
/** Used to match complex or compound words. */
|
||||||
var reUnicodeWord = RegExp([
|
var reUnicodeWord = RegExp([
|
||||||
rsUpper + '?' + rsLower + '+' + rsOptLowerContr + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
|
rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
|
||||||
rsUpperMisc + '+' + rsOptUpperContr + '(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')',
|
rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
|
||||||
rsUpper + '?' + rsLowerMisc + '+' + rsOptLowerContr,
|
rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
|
||||||
rsUpper + '+' + rsOptUpperContr,
|
rsUpper + '+' + rsOptContrUpper,
|
||||||
|
rsOrdUpper,
|
||||||
|
rsOrdLower,
|
||||||
rsDigits,
|
rsDigits,
|
||||||
rsEmoji
|
rsEmoji
|
||||||
].join('|'), 'g');
|
].join('|'), 'g');
|
||||||
|
|||||||
2
chunk.js
2
chunk.js
@@ -34,7 +34,7 @@ define(['./_baseSlice', './_isIterateeCall', './toInteger'], function(baseSlice,
|
|||||||
} else {
|
} else {
|
||||||
size = nativeMax(toInteger(size), 0);
|
size = nativeMax(toInteger(size), 0);
|
||||||
}
|
}
|
||||||
var length = array ? array.length : 0;
|
var length = array == null ? 0 : array.length;
|
||||||
if (!length || size < 1) {
|
if (!length || size < 1) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
define(['./_baseClone'], function(baseClone) {
|
define(['./_baseClone'], function(baseClone) {
|
||||||
|
|
||||||
|
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||||
|
var undefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is like `_.cloneWith` except that it recursively clones `value`.
|
* This method is like `_.cloneWith` except that it recursively clones `value`.
|
||||||
*
|
*
|
||||||
@@ -29,6 +32,7 @@ define(['./_baseClone'], function(baseClone) {
|
|||||||
* // => 20
|
* // => 20
|
||||||
*/
|
*/
|
||||||
function cloneDeepWith(value, customizer) {
|
function cloneDeepWith(value, customizer) {
|
||||||
|
customizer = typeof customizer == 'function' ? customizer : undefined;
|
||||||
return baseClone(value, true, true, customizer);
|
return baseClone(value, true, true, customizer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
define(['./_baseClone'], function(baseClone) {
|
define(['./_baseClone'], function(baseClone) {
|
||||||
|
|
||||||
|
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||||
|
var undefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is like `_.clone` except that it accepts `customizer` which
|
* This method is like `_.clone` except that it accepts `customizer` which
|
||||||
* is invoked to produce the cloned value. If `customizer` returns `undefined`,
|
* is invoked to produce the cloned value. If `customizer` returns `undefined`,
|
||||||
@@ -32,6 +35,7 @@ define(['./_baseClone'], function(baseClone) {
|
|||||||
* // => 0
|
* // => 0
|
||||||
*/
|
*/
|
||||||
function cloneWith(value, customizer) {
|
function cloneWith(value, customizer) {
|
||||||
|
customizer = typeof customizer == 'function' ? customizer : undefined;
|
||||||
return baseClone(value, false, true, customizer);
|
return baseClone(value, false, true, customizer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ define([], function() {
|
|||||||
*/
|
*/
|
||||||
function compact(array) {
|
function compact(array) {
|
||||||
var index = -1,
|
var index = -1,
|
||||||
length = array ? array.length : 0,
|
length = array == null ? 0 : array.length,
|
||||||
resIndex = 0,
|
resIndex = 0,
|
||||||
result = [];
|
result = [];
|
||||||
|
|
||||||
|
|||||||
2
cond.js
2
cond.js
@@ -33,7 +33,7 @@ define(['./_apply', './_arrayMap', './_baseIteratee', './_baseRest'], function(a
|
|||||||
* // => 'no match'
|
* // => 'no match'
|
||||||
*/
|
*/
|
||||||
function cond(pairs) {
|
function cond(pairs) {
|
||||||
var length = pairs ? pairs.length : 0,
|
var length = pairs == null ? 0 : pairs.length,
|
||||||
toIteratee = baseIteratee;
|
toIteratee = baseIteratee;
|
||||||
|
|
||||||
pairs = !length ? [] : arrayMap(pairs, function(pair) {
|
pairs = !length ? [] : arrayMap(pairs, function(pair) {
|
||||||
|
|||||||
@@ -17,8 +17,7 @@ define(['./_baseAssignValue', './_createAggregator'], function(baseAssignValue,
|
|||||||
* @since 0.5.0
|
* @since 0.5.0
|
||||||
* @category Collection
|
* @category Collection
|
||||||
* @param {Array|Object} collection The collection to iterate over.
|
* @param {Array|Object} collection The collection to iterate over.
|
||||||
* @param {Function} [iteratee=_.identity]
|
* @param {Function} [iteratee=_.identity] The iteratee to transform keys.
|
||||||
* The iteratee to transform keys.
|
|
||||||
* @returns {Object} Returns the composed aggregate object.
|
* @returns {Object} Returns the composed aggregate object.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ define(['./_baseAssign', './_baseCreate'], function(baseAssign, baseCreate) {
|
|||||||
*/
|
*/
|
||||||
function create(prototype, properties) {
|
function create(prototype, properties) {
|
||||||
var result = baseCreate(prototype);
|
var result = baseCreate(prototype);
|
||||||
return properties ? baseAssign(result, properties) : result;
|
return properties == null ? result : baseAssign(result, properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
return create;
|
return create;
|
||||||
|
|||||||
2
drop.js
2
drop.js
@@ -29,7 +29,7 @@ define(['./_baseSlice', './toInteger'], function(baseSlice, toInteger) {
|
|||||||
* // => [1, 2, 3]
|
* // => [1, 2, 3]
|
||||||
*/
|
*/
|
||||||
function drop(array, n, guard) {
|
function drop(array, n, guard) {
|
||||||
var length = array ? array.length : 0;
|
var length = array == null ? 0 : array.length;
|
||||||
if (!length) {
|
if (!length) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ define(['./_baseSlice', './toInteger'], function(baseSlice, toInteger) {
|
|||||||
* // => [1, 2, 3]
|
* // => [1, 2, 3]
|
||||||
*/
|
*/
|
||||||
function dropRight(array, n, guard) {
|
function dropRight(array, n, guard) {
|
||||||
var length = array ? array.length : 0;
|
var length = array == null ? 0 : array.length;
|
||||||
if (!length) {
|
if (!length) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,7 @@ define(['./_baseIteratee', './_baseWhile'], function(baseIteratee, baseWhile) {
|
|||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
* @category Array
|
* @category Array
|
||||||
* @param {Array} array The array to query.
|
* @param {Array} array The array to query.
|
||||||
* @param {Function} [predicate=_.identity]
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
||||||
* The function invoked per iteration.
|
|
||||||
* @returns {Array} Returns the slice of `array`.
|
* @returns {Array} Returns the slice of `array`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
|
|||||||
3
every.js
3
every.js
@@ -18,8 +18,7 @@ define(['./_arrayEvery', './_baseEvery', './_baseIteratee', './isArray', './_isI
|
|||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @category Collection
|
* @category Collection
|
||||||
* @param {Array|Object} collection The collection to iterate over.
|
* @param {Array|Object} collection The collection to iterate over.
|
||||||
* @param {Function} [predicate=_.identity]
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
||||||
* The function invoked per iteration.
|
|
||||||
* @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 {boolean} Returns `true` if all elements pass the predicate check,
|
* @returns {boolean} Returns `true` if all elements pass the predicate check,
|
||||||
* else `false`.
|
* else `false`.
|
||||||
|
|||||||
2
fill.js
2
fill.js
@@ -30,7 +30,7 @@ define(['./_baseFill', './_isIterateeCall'], function(baseFill, isIterateeCall)
|
|||||||
* // => [4, '*', '*', 10]
|
* // => [4, '*', '*', 10]
|
||||||
*/
|
*/
|
||||||
function fill(array, value, start, end) {
|
function fill(array, value, start, end) {
|
||||||
var length = array ? array.length : 0;
|
var length = array == null ? 0 : array.length;
|
||||||
if (!length) {
|
if (!length) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,8 +12,7 @@ define(['./_arrayFilter', './_baseFilter', './_baseIteratee', './isArray'], func
|
|||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @category Collection
|
* @category Collection
|
||||||
* @param {Array|Object} collection The collection to iterate over.
|
* @param {Array|Object} collection The collection to iterate over.
|
||||||
* @param {Function} [predicate=_.identity]
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
||||||
* The function invoked per iteration.
|
|
||||||
* @returns {Array} Returns the new filtered array.
|
* @returns {Array} Returns the new filtered array.
|
||||||
* @see _.reject
|
* @see _.reject
|
||||||
* @example
|
* @example
|
||||||
|
|||||||
3
find.js
3
find.js
@@ -10,8 +10,7 @@ define(['./_createFind', './findIndex'], function(createFind, findIndex) {
|
|||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @category Collection
|
* @category Collection
|
||||||
* @param {Array|Object} collection The collection to inspect.
|
* @param {Array|Object} collection The collection to inspect.
|
||||||
* @param {Function} [predicate=_.identity]
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
||||||
* The function invoked per iteration.
|
|
||||||
* @param {number} [fromIndex=0] The index to search from.
|
* @param {number} [fromIndex=0] The index to search from.
|
||||||
* @returns {*} Returns the matched element, else `undefined`.
|
* @returns {*} Returns the matched element, else `undefined`.
|
||||||
* @example
|
* @example
|
||||||
|
|||||||
@@ -12,8 +12,7 @@ define(['./_baseFindIndex', './_baseIteratee', './toInteger'], function(baseFind
|
|||||||
* @since 1.1.0
|
* @since 1.1.0
|
||||||
* @category Array
|
* @category Array
|
||||||
* @param {Array} array The array to inspect.
|
* @param {Array} array The array to inspect.
|
||||||
* @param {Function} [predicate=_.identity]
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
||||||
* The function invoked per iteration.
|
|
||||||
* @param {number} [fromIndex=0] The index to search from.
|
* @param {number} [fromIndex=0] The index to search from.
|
||||||
* @returns {number} Returns the index of the found element, else `-1`.
|
* @returns {number} Returns the index of the found element, else `-1`.
|
||||||
* @example
|
* @example
|
||||||
@@ -40,7 +39,7 @@ define(['./_baseFindIndex', './_baseIteratee', './toInteger'], function(baseFind
|
|||||||
* // => 2
|
* // => 2
|
||||||
*/
|
*/
|
||||||
function findIndex(array, predicate, fromIndex) {
|
function findIndex(array, predicate, fromIndex) {
|
||||||
var length = array ? array.length : 0;
|
var length = array == null ? 0 : array.length;
|
||||||
if (!length) {
|
if (!length) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,7 @@ define(['./_createFind', './findLastIndex'], function(createFind, findLastIndex)
|
|||||||
* @since 2.0.0
|
* @since 2.0.0
|
||||||
* @category Collection
|
* @category Collection
|
||||||
* @param {Array|Object} collection The collection to inspect.
|
* @param {Array|Object} collection The collection to inspect.
|
||||||
* @param {Function} [predicate=_.identity]
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
||||||
* The function invoked per iteration.
|
|
||||||
* @param {number} [fromIndex=collection.length-1] The index to search from.
|
* @param {number} [fromIndex=collection.length-1] The index to search from.
|
||||||
* @returns {*} Returns the matched element, else `undefined`.
|
* @returns {*} Returns the matched element, else `undefined`.
|
||||||
* @example
|
* @example
|
||||||
|
|||||||
@@ -16,8 +16,7 @@ define(['./_baseFindIndex', './_baseIteratee', './toInteger'], function(baseFind
|
|||||||
* @since 2.0.0
|
* @since 2.0.0
|
||||||
* @category Array
|
* @category Array
|
||||||
* @param {Array} array The array to inspect.
|
* @param {Array} array The array to inspect.
|
||||||
* @param {Function} [predicate=_.identity]
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
||||||
* The function invoked per iteration.
|
|
||||||
* @param {number} [fromIndex=array.length-1] The index to search from.
|
* @param {number} [fromIndex=array.length-1] The index to search from.
|
||||||
* @returns {number} Returns the index of the found element, else `-1`.
|
* @returns {number} Returns the index of the found element, else `-1`.
|
||||||
* @example
|
* @example
|
||||||
@@ -44,7 +43,7 @@ define(['./_baseFindIndex', './_baseIteratee', './toInteger'], function(baseFind
|
|||||||
* // => 0
|
* // => 0
|
||||||
*/
|
*/
|
||||||
function findLastIndex(array, predicate, fromIndex) {
|
function findLastIndex(array, predicate, fromIndex) {
|
||||||
var length = array ? array.length : 0;
|
var length = array == null ? 0 : array.length;
|
||||||
if (!length) {
|
if (!length) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,7 @@ define(['./_baseFlatten', './map'], function(baseFlatten, map) {
|
|||||||
* @since 4.0.0
|
* @since 4.0.0
|
||||||
* @category Collection
|
* @category Collection
|
||||||
* @param {Array|Object} collection The collection to iterate over.
|
* @param {Array|Object} collection The collection to iterate over.
|
||||||
* @param {Function} [iteratee=_.identity]
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
||||||
* The function invoked per iteration.
|
|
||||||
* @returns {Array} Returns the new flattened array.
|
* @returns {Array} Returns the new flattened array.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -12,8 +12,7 @@ define(['./_baseFlatten', './map'], function(baseFlatten, map) {
|
|||||||
* @since 4.7.0
|
* @since 4.7.0
|
||||||
* @category Collection
|
* @category Collection
|
||||||
* @param {Array|Object} collection The collection to iterate over.
|
* @param {Array|Object} collection The collection to iterate over.
|
||||||
* @param {Function} [iteratee=_.identity]
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
||||||
* The function invoked per iteration.
|
|
||||||
* @returns {Array} Returns the new flattened array.
|
* @returns {Array} Returns the new flattened array.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -12,8 +12,7 @@ define(['./_baseFlatten', './map', './toInteger'], function(baseFlatten, map, to
|
|||||||
* @since 4.7.0
|
* @since 4.7.0
|
||||||
* @category Collection
|
* @category Collection
|
||||||
* @param {Array|Object} collection The collection to iterate over.
|
* @param {Array|Object} collection The collection to iterate over.
|
||||||
* @param {Function} [iteratee=_.identity]
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
||||||
* The function invoked per iteration.
|
|
||||||
* @param {number} [depth=1] The maximum recursion depth.
|
* @param {number} [depth=1] The maximum recursion depth.
|
||||||
* @returns {Array} Returns the new flattened array.
|
* @returns {Array} Returns the new flattened array.
|
||||||
* @example
|
* @example
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ define(['./_baseFlatten'], function(baseFlatten) {
|
|||||||
* // => [1, 2, [3, [4]], 5]
|
* // => [1, 2, [3, [4]], 5]
|
||||||
*/
|
*/
|
||||||
function flatten(array) {
|
function flatten(array) {
|
||||||
var length = array ? array.length : 0;
|
var length = array == null ? 0 : array.length;
|
||||||
return length ? baseFlatten(array, 1) : [];
|
return length ? baseFlatten(array, 1) : [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ define(['./_baseFlatten'], function(baseFlatten) {
|
|||||||
* // => [1, 2, 3, 4, 5]
|
* // => [1, 2, 3, 4, 5]
|
||||||
*/
|
*/
|
||||||
function flattenDeep(array) {
|
function flattenDeep(array) {
|
||||||
var length = array ? array.length : 0;
|
var length = array == null ? 0 : array.length;
|
||||||
return length ? baseFlatten(array, INFINITY) : [];
|
return length ? baseFlatten(array, INFINITY) : [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ define(['./_baseFlatten', './toInteger'], function(baseFlatten, toInteger) {
|
|||||||
* // => [1, 2, 3, [4], 5]
|
* // => [1, 2, 3, [4], 5]
|
||||||
*/
|
*/
|
||||||
function flattenDepth(array, depth) {
|
function flattenDepth(array, depth) {
|
||||||
var length = array ? array.length : 0;
|
var length = array == null ? 0 : array.length;
|
||||||
if (!length) {
|
if (!length) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
define(['./_arrayEach', './_baseEach', './_baseIteratee', './isArray'], function(arrayEach, baseEach, baseIteratee, isArray) {
|
define(['./_arrayEach', './_baseEach', './_castFunction', './isArray'], function(arrayEach, baseEach, castFunction, isArray) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Iterates over elements of `collection` and invokes `iteratee` for each element.
|
* Iterates over elements of `collection` and invokes `iteratee` for each element.
|
||||||
@@ -32,7 +32,7 @@ define(['./_arrayEach', './_baseEach', './_baseIteratee', './isArray'], function
|
|||||||
*/
|
*/
|
||||||
function forEach(collection, iteratee) {
|
function forEach(collection, iteratee) {
|
||||||
var func = isArray(collection) ? arrayEach : baseEach;
|
var func = isArray(collection) ? arrayEach : baseEach;
|
||||||
return func(collection, baseIteratee(iteratee, 3));
|
return func(collection, castFunction(iteratee));
|
||||||
}
|
}
|
||||||
|
|
||||||
return forEach;
|
return forEach;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
define(['./_arrayEachRight', './_baseEachRight', './_baseIteratee', './isArray'], function(arrayEachRight, baseEachRight, baseIteratee, isArray) {
|
define(['./_arrayEachRight', './_baseEachRight', './_castFunction', './isArray'], function(arrayEachRight, baseEachRight, castFunction, isArray) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is like `_.forEach` except that it iterates over elements of
|
* This method is like `_.forEach` except that it iterates over elements of
|
||||||
@@ -22,7 +22,7 @@ define(['./_arrayEachRight', './_baseEachRight', './_baseIteratee', './isArray']
|
|||||||
*/
|
*/
|
||||||
function forEachRight(collection, iteratee) {
|
function forEachRight(collection, iteratee) {
|
||||||
var func = isArray(collection) ? arrayEachRight : baseEachRight;
|
var func = isArray(collection) ? arrayEachRight : baseEachRight;
|
||||||
return func(collection, baseIteratee(iteratee, 3));
|
return func(collection, castFunction(iteratee));
|
||||||
}
|
}
|
||||||
|
|
||||||
return forEachRight;
|
return forEachRight;
|
||||||
|
|||||||
4
forIn.js
4
forIn.js
@@ -1,4 +1,4 @@
|
|||||||
define(['./_baseFor', './_baseIteratee', './keysIn'], function(baseFor, baseIteratee, keysIn) {
|
define(['./_baseFor', './_castFunction', './keysIn'], function(baseFor, castFunction, keysIn) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Iterates over own and inherited enumerable string keyed properties of an
|
* Iterates over own and inherited enumerable string keyed properties of an
|
||||||
@@ -31,7 +31,7 @@ define(['./_baseFor', './_baseIteratee', './keysIn'], function(baseFor, baseIter
|
|||||||
function forIn(object, iteratee) {
|
function forIn(object, iteratee) {
|
||||||
return object == null
|
return object == null
|
||||||
? object
|
? object
|
||||||
: baseFor(object, baseIteratee(iteratee, 3), keysIn);
|
: baseFor(object, castFunction(iteratee), keysIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
return forIn;
|
return forIn;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
define(['./_baseForRight', './_baseIteratee', './keysIn'], function(baseForRight, baseIteratee, keysIn) {
|
define(['./_baseForRight', './_castFunction', './keysIn'], function(baseForRight, castFunction, keysIn) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is like `_.forIn` except that it iterates over properties of
|
* This method is like `_.forIn` except that it iterates over properties of
|
||||||
@@ -29,7 +29,7 @@ define(['./_baseForRight', './_baseIteratee', './keysIn'], function(baseForRight
|
|||||||
function forInRight(object, iteratee) {
|
function forInRight(object, iteratee) {
|
||||||
return object == null
|
return object == null
|
||||||
? object
|
? object
|
||||||
: baseForRight(object, baseIteratee(iteratee, 3), keysIn);
|
: baseForRight(object, castFunction(iteratee), keysIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
return forInRight;
|
return forInRight;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
define(['./_baseForOwn', './_baseIteratee'], function(baseForOwn, baseIteratee) {
|
define(['./_baseForOwn', './_castFunction'], function(baseForOwn, castFunction) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Iterates over own enumerable string keyed properties of an object and
|
* Iterates over own enumerable string keyed properties of an object and
|
||||||
@@ -29,7 +29,7 @@ define(['./_baseForOwn', './_baseIteratee'], function(baseForOwn, 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, 3));
|
return object && baseForOwn(object, castFunction(iteratee));
|
||||||
}
|
}
|
||||||
|
|
||||||
return forOwn;
|
return forOwn;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
define(['./_baseForOwnRight', './_baseIteratee'], function(baseForOwnRight, baseIteratee) {
|
define(['./_baseForOwnRight', './_castFunction'], function(baseForOwnRight, castFunction) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is like `_.forOwn` except that it iterates over properties of
|
* This method is like `_.forOwn` except that it iterates over properties of
|
||||||
@@ -27,7 +27,7 @@ define(['./_baseForOwnRight', './_baseIteratee'], function(baseForOwnRight, base
|
|||||||
* // => 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, 3));
|
return object && baseForOwnRight(object, castFunction(iteratee));
|
||||||
}
|
}
|
||||||
|
|
||||||
return forOwnRight;
|
return forOwnRight;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ define([], function() {
|
|||||||
*/
|
*/
|
||||||
function fromPairs(pairs) {
|
function fromPairs(pairs) {
|
||||||
var index = -1,
|
var index = -1,
|
||||||
length = pairs ? pairs.length : 0,
|
length = pairs == null ? 0 : pairs.length,
|
||||||
result = {};
|
result = {};
|
||||||
|
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
|
|||||||
@@ -18,8 +18,7 @@ define(['./_baseAssignValue', './_createAggregator'], function(baseAssignValue,
|
|||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @category Collection
|
* @category Collection
|
||||||
* @param {Array|Object} collection The collection to iterate over.
|
* @param {Array|Object} collection The collection to iterate over.
|
||||||
* @param {Function} [iteratee=_.identity]
|
* @param {Function} [iteratee=_.identity] The iteratee to transform keys.
|
||||||
* The iteratee to transform keys.
|
|
||||||
* @returns {Object} Returns the composed aggregate object.
|
* @returns {Object} Returns the composed aggregate object.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ define(['./_baseIndexOf', './toInteger'], function(baseIndexOf, toInteger) {
|
|||||||
* // => 3
|
* // => 3
|
||||||
*/
|
*/
|
||||||
function indexOf(array, value, fromIndex) {
|
function indexOf(array, value, fromIndex) {
|
||||||
var length = array ? array.length : 0;
|
var length = array == null ? 0 : array.length;
|
||||||
if (!length) {
|
if (!length) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ define(['./_baseSlice'], function(baseSlice) {
|
|||||||
* // => [1, 2]
|
* // => [1, 2]
|
||||||
*/
|
*/
|
||||||
function initial(array) {
|
function initial(array) {
|
||||||
var length = array ? array.length : 0;
|
var length = array == null ? 0 : array.length;
|
||||||
return length ? baseSlice(array, 0, -1) : [];
|
return length ? baseSlice(array, 0, -1) : [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,9 +28,8 @@ define(['./_arrayMap', './_baseIntersection', './_baseRest', './_castArrayLikeOb
|
|||||||
var comparator = last(arrays),
|
var comparator = last(arrays),
|
||||||
mapped = arrayMap(arrays, castArrayLikeObject);
|
mapped = arrayMap(arrays, castArrayLikeObject);
|
||||||
|
|
||||||
if (comparator === last(mapped)) {
|
comparator = typeof comparator == 'function' ? comparator : undefined;
|
||||||
comparator = undefined;
|
if (comparator) {
|
||||||
} else {
|
|
||||||
mapped.pop();
|
mapped.pop();
|
||||||
}
|
}
|
||||||
return (mapped.length && mapped[0] === arrays[0])
|
return (mapped.length && mapped[0] === arrays[0])
|
||||||
|
|||||||
14
isBoolean.js
14
isBoolean.js
@@ -1,18 +1,8 @@
|
|||||||
define(['./isObjectLike'], function(isObjectLike) {
|
define(['./_baseGetTag', './isObjectLike'], function(baseGetTag, isObjectLike) {
|
||||||
|
|
||||||
/** `Object#toString` result references. */
|
/** `Object#toString` result references. */
|
||||||
var boolTag = '[object Boolean]';
|
var boolTag = '[object Boolean]';
|
||||||
|
|
||||||
/** Used for built-in method references. */
|
|
||||||
var objectProto = Object.prototype;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to resolve the
|
|
||||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
||||||
* of values.
|
|
||||||
*/
|
|
||||||
var objectToString = objectProto.toString;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if `value` is classified as a boolean primitive or object.
|
* Checks if `value` is classified as a boolean primitive or object.
|
||||||
*
|
*
|
||||||
@@ -32,7 +22,7 @@ define(['./isObjectLike'], function(isObjectLike) {
|
|||||||
*/
|
*/
|
||||||
function isBoolean(value) {
|
function isBoolean(value) {
|
||||||
return value === true || value === false ||
|
return value === true || value === false ||
|
||||||
(isObjectLike(value) && objectToString.call(value) == boolTag);
|
(isObjectLike(value) && baseGetTag(value) == boolTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
return isBoolean;
|
return isBoolean;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ define(['./isObjectLike', './isPlainObject'], function(isObjectLike, isPlainObje
|
|||||||
* // => false
|
* // => false
|
||||||
*/
|
*/
|
||||||
function isElement(value) {
|
function isElement(value) {
|
||||||
return value != null && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value);
|
return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return isElement;
|
return isElement;
|
||||||
|
|||||||
@@ -44,6 +44,9 @@ define(['./_baseKeys', './_getTag', './isArguments', './isArray', './isArrayLike
|
|||||||
* // => false
|
* // => false
|
||||||
*/
|
*/
|
||||||
function isEmpty(value) {
|
function isEmpty(value) {
|
||||||
|
if (value == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (isArrayLike(value) &&
|
if (isArrayLike(value) &&
|
||||||
(isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
|
(isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
|
||||||
isBuffer(value) || isTypedArray(value) || isArguments(value))) {
|
isBuffer(value) || isTypedArray(value) || isArguments(value))) {
|
||||||
|
|||||||
20
isError.js
20
isError.js
@@ -1,17 +1,8 @@
|
|||||||
define(['./isObjectLike'], function(isObjectLike) {
|
define(['./_baseGetTag', './isObjectLike', './isPlainObject'], function(baseGetTag, isObjectLike, isPlainObject) {
|
||||||
|
|
||||||
/** `Object#toString` result references. */
|
/** `Object#toString` result references. */
|
||||||
var errorTag = '[object Error]';
|
var domExcTag = '[object DOMException]',
|
||||||
|
errorTag = '[object Error]';
|
||||||
/** Used for built-in method references. */
|
|
||||||
var objectProto = Object.prototype;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to resolve the
|
|
||||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
||||||
* of values.
|
|
||||||
*/
|
|
||||||
var objectToString = objectProto.toString;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
|
* Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
|
||||||
@@ -35,8 +26,9 @@ define(['./isObjectLike'], function(isObjectLike) {
|
|||||||
if (!isObjectLike(value)) {
|
if (!isObjectLike(value)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return (objectToString.call(value) == errorTag) ||
|
var tag = baseGetTag(value);
|
||||||
(typeof value.message == 'string' && typeof value.name == 'string');
|
return tag == errorTag || tag == domExcTag ||
|
||||||
|
(typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
return isError;
|
return isError;
|
||||||
|
|||||||
@@ -1,20 +1,11 @@
|
|||||||
define(['./isObject'], function(isObject) {
|
define(['./_baseGetTag', './isObject'], function(baseGetTag, isObject) {
|
||||||
|
|
||||||
/** `Object#toString` result references. */
|
/** `Object#toString` result references. */
|
||||||
var funcTag = '[object Function]',
|
var asyncTag = '[object AsyncFunction]',
|
||||||
|
funcTag = '[object Function]',
|
||||||
genTag = '[object GeneratorFunction]',
|
genTag = '[object GeneratorFunction]',
|
||||||
proxyTag = '[object Proxy]';
|
proxyTag = '[object Proxy]';
|
||||||
|
|
||||||
/** Used for built-in method references. */
|
|
||||||
var objectProto = Object.prototype;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to resolve the
|
|
||||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
||||||
* of values.
|
|
||||||
*/
|
|
||||||
var objectToString = objectProto.toString;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if `value` is classified as a `Function` object.
|
* Checks if `value` is classified as a `Function` object.
|
||||||
*
|
*
|
||||||
@@ -33,10 +24,13 @@ define(['./isObject'], function(isObject) {
|
|||||||
* // => false
|
* // => false
|
||||||
*/
|
*/
|
||||||
function isFunction(value) {
|
function isFunction(value) {
|
||||||
|
if (!isObject(value)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// The use of `Object#toString` avoids issues with the `typeof` operator
|
// The use of `Object#toString` avoids issues with the `typeof` operator
|
||||||
// in Safari 9 which returns 'object' for typed array and other constructors.
|
// in Safari 9 which returns 'object' for typed arrays and other constructors.
|
||||||
var tag = isObject(value) ? objectToString.call(value) : '';
|
var tag = baseGetTag(value);
|
||||||
return tag == funcTag || tag == genTag || tag == proxyTag;
|
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
return isFunction;
|
return isFunction;
|
||||||
|
|||||||
14
isNumber.js
14
isNumber.js
@@ -1,18 +1,8 @@
|
|||||||
define(['./isObjectLike'], function(isObjectLike) {
|
define(['./_baseGetTag', './isObjectLike'], function(baseGetTag, isObjectLike) {
|
||||||
|
|
||||||
/** `Object#toString` result references. */
|
/** `Object#toString` result references. */
|
||||||
var numberTag = '[object Number]';
|
var numberTag = '[object Number]';
|
||||||
|
|
||||||
/** Used for built-in method references. */
|
|
||||||
var objectProto = Object.prototype;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to resolve the
|
|
||||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
||||||
* of values.
|
|
||||||
*/
|
|
||||||
var objectToString = objectProto.toString;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if `value` is classified as a `Number` primitive or object.
|
* Checks if `value` is classified as a `Number` primitive or object.
|
||||||
*
|
*
|
||||||
@@ -41,7 +31,7 @@ define(['./isObjectLike'], function(isObjectLike) {
|
|||||||
*/
|
*/
|
||||||
function isNumber(value) {
|
function isNumber(value) {
|
||||||
return typeof value == 'number' ||
|
return typeof value == 'number' ||
|
||||||
(isObjectLike(value) && objectToString.call(value) == numberTag);
|
(isObjectLike(value) && baseGetTag(value) == numberTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
return isNumber;
|
return isNumber;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
define(['./_getPrototype', './isObjectLike'], function(getPrototype, isObjectLike) {
|
define(['./_baseGetTag', './_getPrototype', './isObjectLike'], function(baseGetTag, getPrototype, isObjectLike) {
|
||||||
|
|
||||||
/** `Object#toString` result references. */
|
/** `Object#toString` result references. */
|
||||||
var objectTag = '[object Object]';
|
var objectTag = '[object Object]';
|
||||||
@@ -16,13 +16,6 @@ define(['./_getPrototype', './isObjectLike'], function(getPrototype, isObjectLik
|
|||||||
/** Used to infer the `Object` constructor. */
|
/** Used to infer the `Object` constructor. */
|
||||||
var objectCtorString = funcToString.call(Object);
|
var objectCtorString = funcToString.call(Object);
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to resolve the
|
|
||||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
||||||
* of values.
|
|
||||||
*/
|
|
||||||
var objectToString = objectProto.toString;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if `value` is a plain object, that is, an object created by the
|
* Checks if `value` is a plain object, that is, an object created by the
|
||||||
* `Object` constructor or one with a `[[Prototype]]` of `null`.
|
* `Object` constructor or one with a `[[Prototype]]` of `null`.
|
||||||
@@ -52,7 +45,7 @@ define(['./_getPrototype', './isObjectLike'], function(getPrototype, isObjectLik
|
|||||||
* // => true
|
* // => true
|
||||||
*/
|
*/
|
||||||
function isPlainObject(value) {
|
function isPlainObject(value) {
|
||||||
if (!isObjectLike(value) || objectToString.call(value) != objectTag) {
|
if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
var proto = getPrototype(value);
|
var proto = getPrototype(value);
|
||||||
@@ -60,8 +53,8 @@ define(['./_getPrototype', './isObjectLike'], function(getPrototype, isObjectLik
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
|
var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
|
||||||
return (typeof Ctor == 'function' &&
|
return typeof Ctor == 'function' && Ctor instanceof Ctor &&
|
||||||
Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString);
|
funcToString.call(Ctor) == objectCtorString;
|
||||||
}
|
}
|
||||||
|
|
||||||
return isPlainObject;
|
return isPlainObject;
|
||||||
|
|||||||
14
isString.js
14
isString.js
@@ -1,18 +1,8 @@
|
|||||||
define(['./isArray', './isObjectLike'], function(isArray, isObjectLike) {
|
define(['./_baseGetTag', './isArray', './isObjectLike'], function(baseGetTag, isArray, isObjectLike) {
|
||||||
|
|
||||||
/** `Object#toString` result references. */
|
/** `Object#toString` result references. */
|
||||||
var stringTag = '[object String]';
|
var stringTag = '[object String]';
|
||||||
|
|
||||||
/** Used for built-in method references. */
|
|
||||||
var objectProto = Object.prototype;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to resolve the
|
|
||||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
||||||
* of values.
|
|
||||||
*/
|
|
||||||
var objectToString = objectProto.toString;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if `value` is classified as a `String` primitive or object.
|
* Checks if `value` is classified as a `String` primitive or object.
|
||||||
*
|
*
|
||||||
@@ -32,7 +22,7 @@ define(['./isArray', './isObjectLike'], function(isArray, isObjectLike) {
|
|||||||
*/
|
*/
|
||||||
function isString(value) {
|
function isString(value) {
|
||||||
return typeof value == 'string' ||
|
return typeof value == 'string' ||
|
||||||
(!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag);
|
(!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
return isString;
|
return isString;
|
||||||
|
|||||||
14
isSymbol.js
14
isSymbol.js
@@ -1,18 +1,8 @@
|
|||||||
define(['./isObjectLike'], function(isObjectLike) {
|
define(['./_baseGetTag', './isObjectLike'], function(baseGetTag, isObjectLike) {
|
||||||
|
|
||||||
/** `Object#toString` result references. */
|
/** `Object#toString` result references. */
|
||||||
var symbolTag = '[object Symbol]';
|
var symbolTag = '[object Symbol]';
|
||||||
|
|
||||||
/** Used for built-in method references. */
|
|
||||||
var objectProto = Object.prototype;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to resolve the
|
|
||||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
||||||
* of values.
|
|
||||||
*/
|
|
||||||
var objectToString = objectProto.toString;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if `value` is classified as a `Symbol` primitive or object.
|
* Checks if `value` is classified as a `Symbol` primitive or object.
|
||||||
*
|
*
|
||||||
@@ -32,7 +22,7 @@ define(['./isObjectLike'], function(isObjectLike) {
|
|||||||
*/
|
*/
|
||||||
function isSymbol(value) {
|
function isSymbol(value) {
|
||||||
return typeof value == 'symbol' ||
|
return typeof value == 'symbol' ||
|
||||||
(isObjectLike(value) && objectToString.call(value) == symbolTag);
|
(isObjectLike(value) && baseGetTag(value) == symbolTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
return isSymbol;
|
return isSymbol;
|
||||||
|
|||||||
14
isWeakSet.js
14
isWeakSet.js
@@ -1,18 +1,8 @@
|
|||||||
define(['./isObjectLike'], function(isObjectLike) {
|
define(['./_baseGetTag', './isObjectLike'], function(baseGetTag, isObjectLike) {
|
||||||
|
|
||||||
/** `Object#toString` result references. */
|
/** `Object#toString` result references. */
|
||||||
var weakSetTag = '[object WeakSet]';
|
var weakSetTag = '[object WeakSet]';
|
||||||
|
|
||||||
/** Used for built-in method references. */
|
|
||||||
var objectProto = Object.prototype;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to resolve the
|
|
||||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
||||||
* of values.
|
|
||||||
*/
|
|
||||||
var objectToString = objectProto.toString;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if `value` is classified as a `WeakSet` object.
|
* Checks if `value` is classified as a `WeakSet` object.
|
||||||
*
|
*
|
||||||
@@ -31,7 +21,7 @@ define(['./isObjectLike'], function(isObjectLike) {
|
|||||||
* // => false
|
* // => false
|
||||||
*/
|
*/
|
||||||
function isWeakSet(value) {
|
function isWeakSet(value) {
|
||||||
return isObjectLike(value) && objectToString.call(value) == weakSetTag;
|
return isObjectLike(value) && baseGetTag(value) == weakSetTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
return isWeakSet;
|
return isWeakSet;
|
||||||
|
|||||||
2
join.js
2
join.js
@@ -22,7 +22,7 @@ define([], function() {
|
|||||||
* // => 'a~b~c'
|
* // => 'a~b~c'
|
||||||
*/
|
*/
|
||||||
function join(array, separator) {
|
function join(array, separator) {
|
||||||
return array ? nativeJoin.call(array, separator) : '';
|
return array == null ? '' : nativeJoin.call(array, separator);
|
||||||
}
|
}
|
||||||
|
|
||||||
return join;
|
return join;
|
||||||
|
|||||||
3
keyBy.js
3
keyBy.js
@@ -11,8 +11,7 @@ define(['./_baseAssignValue', './_createAggregator'], function(baseAssignValue,
|
|||||||
* @since 4.0.0
|
* @since 4.0.0
|
||||||
* @category Collection
|
* @category Collection
|
||||||
* @param {Array|Object} collection The collection to iterate over.
|
* @param {Array|Object} collection The collection to iterate over.
|
||||||
* @param {Function} [iteratee=_.identity]
|
* @param {Function} [iteratee=_.identity] The iteratee to transform keys.
|
||||||
* The iteratee to transform keys.
|
|
||||||
* @returns {Object} Returns the composed aggregate object.
|
* @returns {Object} Returns the composed aggregate object.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
|
|||||||
2
last.js
2
last.js
@@ -18,7 +18,7 @@ define([], function() {
|
|||||||
* // => 3
|
* // => 3
|
||||||
*/
|
*/
|
||||||
function last(array) {
|
function last(array) {
|
||||||
var length = array ? array.length : 0;
|
var length = array == null ? 0 : array.length;
|
||||||
return length ? array[length - 1] : undefined;
|
return length ? array[length - 1] : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ define(['./_baseFindIndex', './_baseIsNaN', './_strictLastIndexOf', './toInteger
|
|||||||
* // => 1
|
* // => 1
|
||||||
*/
|
*/
|
||||||
function lastIndexOf(array, value, fromIndex) {
|
function lastIndexOf(array, value, fromIndex) {
|
||||||
var length = array ? array.length : 0;
|
var length = array == null ? 0 : array.length;
|
||||||
if (!length) {
|
if (!length) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ define(['./_MapCache'], function(MapCache) {
|
|||||||
* function. Its creation may be customized by replacing the `_.memoize.Cache`
|
* function. Its creation may be customized by replacing the `_.memoize.Cache`
|
||||||
* constructor with one whose instances implement the
|
* constructor with one whose instances implement the
|
||||||
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
|
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
|
||||||
* method interface of `delete`, `get`, `has`, and `set`.
|
* method interface of `clear`, `delete`, `get`, `has`, and `set`.
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
@@ -48,7 +48,7 @@ define(['./_MapCache'], function(MapCache) {
|
|||||||
* _.memoize.Cache = WeakMap;
|
* _.memoize.Cache = WeakMap;
|
||||||
*/
|
*/
|
||||||
function memoize(func, resolver) {
|
function memoize(func, resolver) {
|
||||||
if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {
|
if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
|
||||||
throw new TypeError(FUNC_ERROR_TEXT);
|
throw new TypeError(FUNC_ERROR_TEXT);
|
||||||
}
|
}
|
||||||
var memoized = function() {
|
var memoized = function() {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "lodash-amd",
|
"name": "lodash-amd",
|
||||||
"version": "4.16.4",
|
"version": "4.16.5",
|
||||||
"description": "Lodash exported as AMD modules.",
|
"description": "Lodash exported as AMD modules.",
|
||||||
"keywords": "amd, modules, stdlib, util",
|
"keywords": "amd, modules, stdlib, util",
|
||||||
"homepage": "https://lodash.com/custom-builds",
|
"homepage": "https://lodash.com/custom-builds",
|
||||||
|
|||||||
@@ -13,8 +13,7 @@ define(['./_baseIteratee', './_basePullAll'], function(baseIteratee, basePullAll
|
|||||||
* @category Array
|
* @category Array
|
||||||
* @param {Array} array The array to modify.
|
* @param {Array} array The array to modify.
|
||||||
* @param {Array} values The values to remove.
|
* @param {Array} values The values to remove.
|
||||||
* @param {Function} [iteratee=_.identity]
|
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
|
||||||
* The iteratee invoked per element.
|
|
||||||
* @returns {Array} Returns `array`.
|
* @returns {Array} Returns `array`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ define(['./_arrayMap', './_baseAt', './_basePullAt', './_compareAscending', './_
|
|||||||
* // => ['b', 'd']
|
* // => ['b', 'd']
|
||||||
*/
|
*/
|
||||||
var pullAt = flatRest(function(array, indexes) {
|
var pullAt = flatRest(function(array, indexes) {
|
||||||
var length = array ? array.length : 0,
|
var length = array == null ? 0 : array.length,
|
||||||
result = baseAt(array, indexes);
|
result = baseAt(array, indexes);
|
||||||
|
|
||||||
basePullAt(array, arrayMap(indexes, function(index) {
|
basePullAt(array, arrayMap(indexes, function(index) {
|
||||||
|
|||||||
@@ -13,8 +13,7 @@ define(['./_baseIteratee', './_basePullAt'], function(baseIteratee, basePullAt)
|
|||||||
* @since 2.0.0
|
* @since 2.0.0
|
||||||
* @category Array
|
* @category Array
|
||||||
* @param {Array} array The array to modify.
|
* @param {Array} array The array to modify.
|
||||||
* @param {Function} [predicate=_.identity]
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
||||||
* The function invoked per iteration.
|
|
||||||
* @returns {Array} Returns the new array of removed elements.
|
* @returns {Array} Returns the new array of removed elements.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ define([], function() {
|
|||||||
* // => [3, 2, 1]
|
* // => [3, 2, 1]
|
||||||
*/
|
*/
|
||||||
function reverse(array) {
|
function reverse(array) {
|
||||||
return array ? nativeReverse.call(array) : array;
|
return array == null ? array : nativeReverse.call(array);
|
||||||
}
|
}
|
||||||
|
|
||||||
return reverse;
|
return reverse;
|
||||||
|
|||||||
2
slice.js
2
slice.js
@@ -20,7 +20,7 @@ define(['./_baseSlice', './_isIterateeCall', './toInteger'], function(baseSlice,
|
|||||||
* @returns {Array} Returns the slice of `array`.
|
* @returns {Array} Returns the slice of `array`.
|
||||||
*/
|
*/
|
||||||
function slice(array, start, end) {
|
function slice(array, start, end) {
|
||||||
var length = array ? array.length : 0;
|
var length = array == null ? 0 : array.length;
|
||||||
if (!length) {
|
if (!length) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,8 +11,7 @@ define(['./_baseIteratee', './_baseSortedIndexBy'], function(baseIteratee, baseS
|
|||||||
* @category Array
|
* @category Array
|
||||||
* @param {Array} array The sorted array to inspect.
|
* @param {Array} array The sorted array to inspect.
|
||||||
* @param {*} value The value to evaluate.
|
* @param {*} value The value to evaluate.
|
||||||
* @param {Function} [iteratee=_.identity]
|
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
|
||||||
* The iteratee invoked per element.
|
|
||||||
* @returns {number} Returns the index at which `value` should be inserted
|
* @returns {number} Returns the index at which `value` should be inserted
|
||||||
* into `array`.
|
* into `array`.
|
||||||
* @example
|
* @example
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ define(['./_baseSortedIndex', './eq'], function(baseSortedIndex, eq) {
|
|||||||
* // => 1
|
* // => 1
|
||||||
*/
|
*/
|
||||||
function sortedIndexOf(array, value) {
|
function sortedIndexOf(array, value) {
|
||||||
var length = array ? array.length : 0;
|
var length = array == null ? 0 : array.length;
|
||||||
if (length) {
|
if (length) {
|
||||||
var index = baseSortedIndex(array, value);
|
var index = baseSortedIndex(array, value);
|
||||||
if (index < length && eq(array[index], value)) {
|
if (index < length && eq(array[index], value)) {
|
||||||
|
|||||||
@@ -11,8 +11,7 @@ define(['./_baseIteratee', './_baseSortedIndexBy'], function(baseIteratee, baseS
|
|||||||
* @category Array
|
* @category Array
|
||||||
* @param {Array} array The sorted array to inspect.
|
* @param {Array} array The sorted array to inspect.
|
||||||
* @param {*} value The value to evaluate.
|
* @param {*} value The value to evaluate.
|
||||||
* @param {Function} [iteratee=_.identity]
|
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
|
||||||
* The iteratee invoked per element.
|
|
||||||
* @returns {number} Returns the index at which `value` should be inserted
|
* @returns {number} Returns the index at which `value` should be inserted
|
||||||
* into `array`.
|
* into `array`.
|
||||||
* @example
|
* @example
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ define(['./_baseSortedIndex', './eq'], function(baseSortedIndex, eq) {
|
|||||||
* // => 3
|
* // => 3
|
||||||
*/
|
*/
|
||||||
function sortedLastIndexOf(array, value) {
|
function sortedLastIndexOf(array, value) {
|
||||||
var length = array ? array.length : 0;
|
var length = array == null ? 0 : array.length;
|
||||||
if (length) {
|
if (length) {
|
||||||
var index = baseSortedIndex(array, value, true) - 1;
|
var index = baseSortedIndex(array, value, true) - 1;
|
||||||
if (eq(array[index], value)) {
|
if (eq(array[index], value)) {
|
||||||
|
|||||||
2
tail.js
2
tail.js
@@ -15,7 +15,7 @@ define(['./_baseSlice'], function(baseSlice) {
|
|||||||
* // => [2, 3]
|
* // => [2, 3]
|
||||||
*/
|
*/
|
||||||
function tail(array) {
|
function tail(array) {
|
||||||
var length = array ? array.length : 0;
|
var length = array == null ? 0 : array.length;
|
||||||
return length ? baseSlice(array, 1, length) : [];
|
return length ? baseSlice(array, 1, length) : [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ define(['./_baseSlice', './toInteger'], function(baseSlice, toInteger) {
|
|||||||
* // => []
|
* // => []
|
||||||
*/
|
*/
|
||||||
function takeRight(array, n, guard) {
|
function takeRight(array, n, guard) {
|
||||||
var length = array ? array.length : 0;
|
var length = array == null ? 0 : array.length;
|
||||||
if (!length) {
|
if (!length) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,7 @@ define(['./_baseIteratee', './_baseWhile'], function(baseIteratee, baseWhile) {
|
|||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
* @category Array
|
* @category Array
|
||||||
* @param {Array} array The array to query.
|
* @param {Array} array The array to query.
|
||||||
* @param {Function} [predicate=_.identity]
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
||||||
* The function invoked per iteration.
|
|
||||||
* @returns {Array} Returns the slice of `array`.
|
* @returns {Array} Returns the slice of `array`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -10,8 +10,7 @@ define(['./_baseIteratee', './_baseWhile'], function(baseIteratee, baseWhile) {
|
|||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
* @category Array
|
* @category Array
|
||||||
* @param {Array} array The array to query.
|
* @param {Array} array The array to query.
|
||||||
* @param {Function} [predicate=_.identity]
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
||||||
* The function invoked per iteration.
|
|
||||||
* @returns {Array} Returns the slice of `array`.
|
* @returns {Array} Returns the slice of `array`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user