mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-05 17:37:50 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
be1e9a3170 | ||
|
|
6778141728 | ||
|
|
d9fd2bdf9c |
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-es v4.16.2
|
# lodash-es v4.16.5
|
||||||
|
|
||||||
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.16.2-es) for more details.
|
See the [package source](https://github.com/lodash/lodash/tree/4.16.5-es) for more details.
|
||||||
|
|||||||
2
_Hash.js
2
_Hash.js
@@ -13,7 +13,7 @@ import hashSet from './_hashSet.js';
|
|||||||
*/
|
*/
|
||||||
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) {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import listCacheSet from './_listCacheSet.js';
|
|||||||
*/
|
*/
|
||||||
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) {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import mapCacheSet from './_mapCacheSet.js';
|
|||||||
*/
|
*/
|
||||||
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) {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import setCacheHas from './_setCacheHas.js';
|
|||||||
*/
|
*/
|
||||||
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) {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
*/
|
*/
|
||||||
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];
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
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) {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
* @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) {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
*/
|
*/
|
||||||
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)) {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
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 @@ import baseIndexOf from './_baseIndexOf.js';
|
|||||||
* @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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
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])) {
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import baseTimes from './_baseTimes.js';
|
import baseTimes from './_baseTimes.js';
|
||||||
import isArguments from './isArguments.js';
|
import isArguments from './isArguments.js';
|
||||||
import isArray from './isArray.js';
|
import isArray from './isArray.js';
|
||||||
|
import isBuffer from './isBuffer.js';
|
||||||
import isIndex from './_isIndex.js';
|
import isIndex from './_isIndex.js';
|
||||||
|
import isTypedArray from './isTypedArray.js';
|
||||||
|
|
||||||
/** Used for built-in method references. */
|
/** Used for built-in method references. */
|
||||||
var objectProto = Object.prototype;
|
var objectProto = Object.prototype;
|
||||||
@@ -18,18 +20,26 @@ var hasOwnProperty = objectProto.hasOwnProperty;
|
|||||||
* @returns {Array} Returns the array of property names.
|
* @returns {Array} Returns the array of property names.
|
||||||
*/
|
*/
|
||||||
function arrayLikeKeys(value, inherited) {
|
function arrayLikeKeys(value, inherited) {
|
||||||
// Safari 8.1 makes `arguments.callee` enumerable in strict mode.
|
var isArr = isArray(value),
|
||||||
// Safari 9 makes `arguments.length` enumerable in strict mode.
|
isArg = !isArr && isArguments(value),
|
||||||
var result = (isArray(value) || isArguments(value))
|
isBuff = !isArr && !isArg && isBuffer(value),
|
||||||
? baseTimes(value.length, String)
|
isType = !isArr && !isArg && !isBuff && isTypedArray(value),
|
||||||
: [];
|
skipIndexes = isArr || isArg || isBuff || isType,
|
||||||
|
result = skipIndexes ? baseTimes(value.length, String) : [],
|
||||||
var length = result.length,
|
length = result.length;
|
||||||
skipIndexes = !!length;
|
|
||||||
|
|
||||||
for (var key in value) {
|
for (var key in value) {
|
||||||
if ((inherited || hasOwnProperty.call(value, key)) &&
|
if ((inherited || hasOwnProperty.call(value, key)) &&
|
||||||
!(skipIndexes && (key == 'length' || isIndex(key, length)))) {
|
!(skipIndexes && (
|
||||||
|
// Safari 9 has enumerable `arguments.length` in strict mode.
|
||||||
|
key == 'length' ||
|
||||||
|
// Node.js 0.10 has enumerable non-index properties on buffers.
|
||||||
|
(isBuff && (key == 'offset' || key == 'parent')) ||
|
||||||
|
// PhantomJS 2 has enumerable non-index properties on typed arrays.
|
||||||
|
(isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
|
||||||
|
// Skip index properties.
|
||||||
|
isIndex(key, length)
|
||||||
|
))) {
|
||||||
result.push(key);
|
result.push(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
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) {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
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];
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
* @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];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import baseClamp from './_baseClamp.js';
|
||||||
import copyArray from './_copyArray.js';
|
import copyArray from './_copyArray.js';
|
||||||
import shuffleSelf from './_shuffleSelf.js';
|
import shuffleSelf from './_shuffleSelf.js';
|
||||||
|
|
||||||
@@ -10,7 +11,7 @@ import shuffleSelf from './_shuffleSelf.js';
|
|||||||
* @returns {Array} Returns the random elements.
|
* @returns {Array} Returns the random elements.
|
||||||
*/
|
*/
|
||||||
function arraySampleSize(array, n) {
|
function arraySampleSize(array, n) {
|
||||||
return shuffleSelf(copyArray(array), n);
|
return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
|
||||||
}
|
}
|
||||||
|
|
||||||
export default arraySampleSize;
|
export default arraySampleSize;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
*/
|
*/
|
||||||
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)) {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import eq from './eq.js';
|
|||||||
*/
|
*/
|
||||||
function assignMergeValue(object, key, value) {
|
function assignMergeValue(object, key, value) {
|
||||||
if ((value !== undefined && !eq(object[key], value)) ||
|
if ((value !== undefined && !eq(object[key], value)) ||
|
||||||
(typeof key == 'number' && value === undefined && !(key in object))) {
|
(value === undefined && !(key in object))) {
|
||||||
baseAssignValue(object, key, value);
|
baseAssignValue(object, key, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
/** Built-in value references. */
|
import defineProperty from './_defineProperty.js';
|
||||||
var defineProperty = Object.defineProperty;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `assignValue` and `assignMergeValue` without
|
* The base implementation of `assignValue` and `assignMergeValue` without
|
||||||
|
|||||||
@@ -10,12 +10,12 @@ import get from './get.js';
|
|||||||
*/
|
*/
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,9 +118,7 @@ function baseClone(value, isDeep, isFull, customizer, key, object, stack) {
|
|||||||
}
|
}
|
||||||
stack.set(value, result);
|
stack.set(value, result);
|
||||||
|
|
||||||
if (!isArr) {
|
var props = isArr ? undefined : (isFull ? getAllKeys : keys)(value);
|
||||||
var props = isFull ? getAllKeys(value) : keys(value);
|
|
||||||
}
|
|
||||||
arrayEach(props || value, function(subValue, key) {
|
arrayEach(props || value, function(subValue, key) {
|
||||||
if (props) {
|
if (props) {
|
||||||
key = subValue;
|
key = subValue;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ var baseCreate = (function() {
|
|||||||
if (objectCreate) {
|
if (objectCreate) {
|
||||||
return objectCreate(proto);
|
return objectCreate(proto);
|
||||||
}
|
}
|
||||||
object.prototype = prototype;
|
object.prototype = proto;
|
||||||
var result = new object;
|
var result = new object;
|
||||||
object.prototype = undefined;
|
object.prototype = undefined;
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ function baseDifference(array, values, iteratee, comparator) {
|
|||||||
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,22 +1,29 @@
|
|||||||
/** Used for built-in method references. */
|
import Symbol from './_Symbol.js';
|
||||||
var objectProto = Object.prototype;
|
import getRawTag from './_getRawTag.js';
|
||||||
|
import objectToString from './_objectToString.js';
|
||||||
|
|
||||||
|
/** `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);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default baseGetTag;
|
export default baseGetTag;
|
||||||
|
|||||||
18
_baseIsArguments.js
Normal file
18
_baseIsArguments.js
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import baseGetTag from './_baseGetTag.js';
|
||||||
|
import isObjectLike from './isObjectLike.js';
|
||||||
|
|
||||||
|
/** `Object#toString` result references. */
|
||||||
|
var argsTag = '[object Arguments]';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The base implementation of `_.isArguments`.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {*} value The value to check.
|
||||||
|
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
||||||
|
*/
|
||||||
|
function baseIsArguments(value) {
|
||||||
|
return isObjectLike(value) && baseGetTag(value) == argsTag;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default baseIsArguments;
|
||||||
@@ -1,17 +1,8 @@
|
|||||||
|
import baseGetTag from './_baseGetTag.js';
|
||||||
import isObjectLike from './isObjectLike.js';
|
import isObjectLike from './isObjectLike.js';
|
||||||
|
|
||||||
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 +11,7 @@ var objectToString = objectProto.toString;
|
|||||||
* @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;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default baseIsArrayBuffer;
|
export default baseIsArrayBuffer;
|
||||||
|
|||||||
@@ -1,18 +1,9 @@
|
|||||||
|
import baseGetTag from './_baseGetTag.js';
|
||||||
import isObjectLike from './isObjectLike.js';
|
import isObjectLike from './isObjectLike.js';
|
||||||
|
|
||||||
/** `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 +12,7 @@ var objectToString = objectProto.toString;
|
|||||||
* @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;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default baseIsDate;
|
export default baseIsDate;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import equalByTag from './_equalByTag.js';
|
|||||||
import equalObjects from './_equalObjects.js';
|
import equalObjects from './_equalObjects.js';
|
||||||
import getTag from './_getTag.js';
|
import getTag from './_getTag.js';
|
||||||
import isArray from './isArray.js';
|
import isArray from './isArray.js';
|
||||||
|
import isBuffer from './isBuffer.js';
|
||||||
import isTypedArray from './isTypedArray.js';
|
import isTypedArray from './isTypedArray.js';
|
||||||
|
|
||||||
/** Used to compose bitmasks for comparison styles. */
|
/** Used to compose bitmasks for comparison styles. */
|
||||||
@@ -53,6 +54,13 @@ function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) {
|
|||||||
othIsObj = othTag == objectTag,
|
othIsObj = othTag == objectTag,
|
||||||
isSameTag = objTag == othTag;
|
isSameTag = objTag == othTag;
|
||||||
|
|
||||||
|
if (isSameTag && isBuffer(object)) {
|
||||||
|
if (!isBuffer(other)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
objIsArr = true;
|
||||||
|
objIsObj = false;
|
||||||
|
}
|
||||||
if (isSameTag && !objIsObj) {
|
if (isSameTag && !objIsObj) {
|
||||||
stack || (stack = new Stack);
|
stack || (stack = new Stack);
|
||||||
return (objIsArr || isTypedArray(object))
|
return (objIsArr || isTypedArray(object))
|
||||||
|
|||||||
@@ -1,18 +1,9 @@
|
|||||||
import isObject from './isObject.js';
|
import baseGetTag from './_baseGetTag.js';
|
||||||
|
import isObjectLike from './isObjectLike.js';
|
||||||
|
|
||||||
/** `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 +12,7 @@ var objectToString = objectProto.toString;
|
|||||||
* @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;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default baseIsRegExp;
|
export default baseIsRegExp;
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import baseGetTag from './_baseGetTag.js';
|
||||||
import isLength from './isLength.js';
|
import isLength from './isLength.js';
|
||||||
import isObjectLike from './isObjectLike.js';
|
import isObjectLike from './isObjectLike.js';
|
||||||
|
|
||||||
@@ -44,16 +45,6 @@ typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
|
|||||||
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.
|
||||||
*
|
*
|
||||||
@@ -63,7 +54,7 @@ var objectToString = objectProto.toString;
|
|||||||
*/
|
*/
|
||||||
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)];
|
||||||
}
|
}
|
||||||
|
|
||||||
export default baseIsTypedArray;
|
export default baseIsTypedArray;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ var NAN = 0 / 0;
|
|||||||
* @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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
import Stack from './_Stack.js';
|
import Stack from './_Stack.js';
|
||||||
import arrayEach from './_arrayEach.js';
|
|
||||||
import assignMergeValue from './_assignMergeValue.js';
|
import assignMergeValue from './_assignMergeValue.js';
|
||||||
import baseKeysIn from './_baseKeysIn.js';
|
import baseFor from './_baseFor.js';
|
||||||
import baseMergeDeep from './_baseMergeDeep.js';
|
import baseMergeDeep from './_baseMergeDeep.js';
|
||||||
import isArray from './isArray.js';
|
|
||||||
import isObject from './isObject.js';
|
import isObject from './isObject.js';
|
||||||
import isTypedArray from './isTypedArray.js';
|
import keysIn from './keysIn.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `_.merge` without support for multiple sources.
|
* The base implementation of `_.merge` without support for multiple sources.
|
||||||
@@ -22,14 +20,7 @@ function baseMerge(object, source, srcIndex, customizer, stack) {
|
|||||||
if (object === source) {
|
if (object === source) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!(isArray(source) || isTypedArray(source))) {
|
baseFor(source, function(srcValue, key) {
|
||||||
var props = baseKeysIn(source);
|
|
||||||
}
|
|
||||||
arrayEach(props || source, function(srcValue, key) {
|
|
||||||
if (props) {
|
|
||||||
key = srcValue;
|
|
||||||
srcValue = source[key];
|
|
||||||
}
|
|
||||||
if (isObject(srcValue)) {
|
if (isObject(srcValue)) {
|
||||||
stack || (stack = new Stack);
|
stack || (stack = new Stack);
|
||||||
baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
|
baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
|
||||||
@@ -44,7 +35,7 @@ function baseMerge(object, source, srcIndex, customizer, stack) {
|
|||||||
}
|
}
|
||||||
assignMergeValue(object, key, newValue);
|
assignMergeValue(object, key, newValue);
|
||||||
}
|
}
|
||||||
});
|
}, keysIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default baseMerge;
|
export default baseMerge;
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
import assignMergeValue from './_assignMergeValue.js';
|
import assignMergeValue from './_assignMergeValue.js';
|
||||||
import baseClone from './_baseClone.js';
|
import cloneBuffer from './_cloneBuffer.js';
|
||||||
|
import cloneTypedArray from './_cloneTypedArray.js';
|
||||||
import copyArray from './_copyArray.js';
|
import copyArray from './_copyArray.js';
|
||||||
|
import initCloneObject from './_initCloneObject.js';
|
||||||
import isArguments from './isArguments.js';
|
import isArguments from './isArguments.js';
|
||||||
import isArray from './isArray.js';
|
import isArray from './isArray.js';
|
||||||
import isArrayLikeObject from './isArrayLikeObject.js';
|
import isArrayLikeObject from './isArrayLikeObject.js';
|
||||||
|
import isBuffer from './isBuffer.js';
|
||||||
import isFunction from './isFunction.js';
|
import isFunction from './isFunction.js';
|
||||||
import isObject from './isObject.js';
|
import isObject from './isObject.js';
|
||||||
import isPlainObject from './isPlainObject.js';
|
import isPlainObject from './isPlainObject.js';
|
||||||
@@ -41,29 +44,37 @@ function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, sta
|
|||||||
var isCommon = newValue === undefined;
|
var isCommon = newValue === undefined;
|
||||||
|
|
||||||
if (isCommon) {
|
if (isCommon) {
|
||||||
|
var isArr = isArray(srcValue),
|
||||||
|
isBuff = !isArr && isBuffer(srcValue),
|
||||||
|
isTyped = !isArr && !isBuff && isTypedArray(srcValue);
|
||||||
|
|
||||||
newValue = srcValue;
|
newValue = srcValue;
|
||||||
if (isArray(srcValue) || isTypedArray(srcValue)) {
|
if (isArr || isBuff || isTyped) {
|
||||||
if (isArray(objValue)) {
|
if (isArray(objValue)) {
|
||||||
newValue = objValue;
|
newValue = objValue;
|
||||||
}
|
}
|
||||||
else if (isArrayLikeObject(objValue)) {
|
else if (isArrayLikeObject(objValue)) {
|
||||||
newValue = copyArray(objValue);
|
newValue = copyArray(objValue);
|
||||||
}
|
}
|
||||||
else {
|
else if (isBuff) {
|
||||||
isCommon = false;
|
isCommon = false;
|
||||||
newValue = baseClone(srcValue, true);
|
newValue = cloneBuffer(srcValue, true);
|
||||||
|
}
|
||||||
|
else if (isTyped) {
|
||||||
|
isCommon = false;
|
||||||
|
newValue = cloneTypedArray(srcValue, true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
newValue = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (isPlainObject(srcValue) || isArguments(srcValue)) {
|
else if (isPlainObject(srcValue) || isArguments(srcValue)) {
|
||||||
|
newValue = objValue;
|
||||||
if (isArguments(objValue)) {
|
if (isArguments(objValue)) {
|
||||||
newValue = toPlainObject(objValue);
|
newValue = toPlainObject(objValue);
|
||||||
}
|
}
|
||||||
else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) {
|
else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) {
|
||||||
isCommon = false;
|
newValue = initCloneObject(srcValue);
|
||||||
newValue = baseClone(srcValue, true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
newValue = objValue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import baseClamp from './_baseClamp.js';
|
||||||
import shuffleSelf from './_shuffleSelf.js';
|
import shuffleSelf from './_shuffleSelf.js';
|
||||||
import values from './values.js';
|
import values from './values.js';
|
||||||
|
|
||||||
@@ -10,7 +11,8 @@ import values from './values.js';
|
|||||||
* @returns {Array} Returns the random elements.
|
* @returns {Array} Returns the random elements.
|
||||||
*/
|
*/
|
||||||
function baseSampleSize(collection, n) {
|
function baseSampleSize(collection, n) {
|
||||||
return shuffleSelf(values(collection), n);
|
var array = values(collection);
|
||||||
|
return shuffleSelf(array, baseClamp(n, 0, array.length));
|
||||||
}
|
}
|
||||||
|
|
||||||
export default baseSampleSize;
|
export default baseSampleSize;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import constant from './constant.js';
|
import constant from './constant.js';
|
||||||
|
import defineProperty from './_defineProperty.js';
|
||||||
import identity from './identity.js';
|
import identity from './identity.js';
|
||||||
import nativeDefineProperty from './_nativeDefineProperty.js';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `setToString` without support for hot loop shorting.
|
* The base implementation of `setToString` without support for hot loop shorting.
|
||||||
@@ -10,8 +10,8 @@ import nativeDefineProperty from './_nativeDefineProperty.js';
|
|||||||
* @param {Function} string The `toString` result.
|
* @param {Function} string The `toString` result.
|
||||||
* @returns {Function} Returns `func`.
|
* @returns {Function} Returns `func`.
|
||||||
*/
|
*/
|
||||||
var baseSetToString = !nativeDefineProperty ? identity : function(func, string) {
|
var baseSetToString = !defineProperty ? identity : function(func, string) {
|
||||||
return nativeDefineProperty(func, 'toString', {
|
return defineProperty(func, 'toString', {
|
||||||
'configurable': true,
|
'configurable': true,
|
||||||
'enumerable': false,
|
'enumerable': false,
|
||||||
'value': constant(string),
|
'value': constant(string),
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ var MAX_ARRAY_LENGTH = 4294967295,
|
|||||||
*/
|
*/
|
||||||
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) {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ function baseSortedIndexBy(array, value, iteratee, retHighest) {
|
|||||||
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),
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import Symbol from './_Symbol.js';
|
import Symbol from './_Symbol.js';
|
||||||
|
import arrayMap from './_arrayMap.js';
|
||||||
|
import isArray from './isArray.js';
|
||||||
import isSymbol from './isSymbol.js';
|
import isSymbol from './isSymbol.js';
|
||||||
|
|
||||||
/** Used as references for various `Number` constants. */
|
/** Used as references for various `Number` constants. */
|
||||||
@@ -21,6 +23,10 @@ function baseToString(value) {
|
|||||||
if (typeof value == 'string') {
|
if (typeof value == 'string') {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
if (isArray(value)) {
|
||||||
|
// Recursively convert values (susceptible to call stack limits).
|
||||||
|
return arrayMap(value, baseToString) + '';
|
||||||
|
}
|
||||||
if (isSymbol(value)) {
|
if (isSymbol(value)) {
|
||||||
return symbolToString ? symbolToString.call(value) : '';
|
return symbolToString ? symbolToString.call(value) : '';
|
||||||
}
|
}
|
||||||
|
|||||||
25
_baseXor.js
25
_baseXor.js
@@ -1,5 +1,5 @@
|
|||||||
import arrayPush from './_arrayPush.js';
|
|
||||||
import baseDifference from './_baseDifference.js';
|
import baseDifference from './_baseDifference.js';
|
||||||
|
import baseFlatten from './_baseFlatten.js';
|
||||||
import baseUniq from './_baseUniq.js';
|
import baseUniq from './_baseUniq.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -13,18 +13,25 @@ import baseUniq from './_baseUniq.js';
|
|||||||
* @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);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default baseXor;
|
export default baseXor;
|
||||||
|
|||||||
11
_defineProperty.js
Normal file
11
_defineProperty.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import getNative from './_getNative.js';
|
||||||
|
|
||||||
|
var defineProperty = (function() {
|
||||||
|
try {
|
||||||
|
var func = getNative(Object, 'defineProperty');
|
||||||
|
func({}, '', {});
|
||||||
|
return func;
|
||||||
|
} catch (e) {}
|
||||||
|
}());
|
||||||
|
|
||||||
|
export default defineProperty;
|
||||||
46
_getRawTag.js
Normal file
46
_getRawTag.js
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
import Symbol from './_Symbol.js';
|
||||||
|
|
||||||
|
/** 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default getRawTag;
|
||||||
14
_getTag.js
14
_getTag.js
@@ -15,16 +15,6 @@ var mapTag = '[object Map]',
|
|||||||
|
|
||||||
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),
|
||||||
@@ -48,9 +38,9 @@ if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
|
|||||||
(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) {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ function hasPath(object, path, hasFunc) {
|
|||||||
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));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
import getNative from './_getNative.js';
|
|
||||||
|
|
||||||
/* Built-in method references that are verified to be native. */
|
|
||||||
var nativeDefineProperty = getNative(Object, 'defineProperty');
|
|
||||||
|
|
||||||
export default nativeDefineProperty;
|
|
||||||
22
_objectToString.js
Normal file
22
_objectToString.js
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
/** 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default objectToString;
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/** 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. */
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import baseClamp from './_baseClamp.js';
|
|
||||||
import baseRandom from './_baseRandom.js';
|
import baseRandom from './_baseRandom.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -14,7 +13,7 @@ function shuffleSelf(array, size) {
|
|||||||
length = array.length,
|
length = array.length,
|
||||||
lastIndex = length - 1;
|
lastIndex = length - 1;
|
||||||
|
|
||||||
size = size === undefined ? length : baseClamp(size, 0, length);
|
size = size === undefined ? length : size;
|
||||||
while (++index < size) {
|
while (++index < size) {
|
||||||
var rand = baseRandom(index, lastIndex),
|
var rand = baseRandom(index, lastIndex),
|
||||||
value = array[rand];
|
value = array[rand];
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ var funcToString = funcProto.toString;
|
|||||||
* 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) {
|
||||||
|
|||||||
@@ -29,22 +29,26 @@ var rsApos = "['\u2019]",
|
|||||||
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
@@ -33,7 +33,7 @@ function chunk(array, size, guard) {
|
|||||||
} 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 [];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import baseClone from './_baseClone.js';
|
|||||||
* // => 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import baseClone from './_baseClone.js';
|
|||||||
* // => 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
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
@@ -36,7 +36,7 @@ var FUNC_ERROR_TEXT = 'Expected a function';
|
|||||||
* // => '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) {
|
||||||
|
|||||||
@@ -18,8 +18,7 @@ var hasOwnProperty = objectProto.hasOwnProperty;
|
|||||||
* @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
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ import baseCreate from './_baseCreate.js';
|
|||||||
*/
|
*/
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default create;
|
export default create;
|
||||||
|
|||||||
2
drop.js
2
drop.js
@@ -27,7 +27,7 @@ import toInteger from './toInteger.js';
|
|||||||
* // => [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 [];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import toInteger from './toInteger.js';
|
|||||||
* // => [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 [];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,8 +11,7 @@ import baseWhile from './_baseWhile.js';
|
|||||||
* @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
@@ -19,8 +19,7 @@ import isIterateeCall from './_isIterateeCall.js';
|
|||||||
* @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
@@ -31,7 +31,7 @@ import isIterateeCall from './_isIterateeCall.js';
|
|||||||
* // => [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 [];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,8 +15,7 @@ import isArray from './isArray.js';
|
|||||||
* @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
@@ -11,8 +11,7 @@ import findIndex from './findIndex.js';
|
|||||||
* @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
|
||||||
|
|||||||
@@ -14,8 +14,7 @@ var nativeMax = Math.max;
|
|||||||
* @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
|
||||||
@@ -42,7 +41,7 @@ var nativeMax = Math.max;
|
|||||||
* // => 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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,7 @@ import findLastIndex from './findLastIndex.js';
|
|||||||
* @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
|
||||||
|
|||||||
@@ -15,8 +15,7 @@ var nativeMax = Math.max,
|
|||||||
* @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
|
||||||
@@ -43,7 +42,7 @@ var nativeMax = Math.max,
|
|||||||
* // => 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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,8 +11,7 @@ import map from './map.js';
|
|||||||
* @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
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -13,8 +13,7 @@ var INFINITY = 1 / 0;
|
|||||||
* @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
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -11,8 +11,7 @@ import toInteger from './toInteger.js';
|
|||||||
* @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 @@ import baseFlatten from './_baseFlatten.js';
|
|||||||
* // => [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 @@ var INFINITY = 1 / 0;
|
|||||||
* // => [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) : [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import toInteger from './toInteger.js';
|
|||||||
* // => [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,6 +1,6 @@
|
|||||||
import arrayEach from './_arrayEach.js';
|
import arrayEach from './_arrayEach.js';
|
||||||
import baseEach from './_baseEach.js';
|
import baseEach from './_baseEach.js';
|
||||||
import baseIteratee from './_baseIteratee.js';
|
import castFunction from './_castFunction.js';
|
||||||
import isArray from './isArray.js';
|
import isArray from './isArray.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -35,7 +35,7 @@ import isArray from './isArray.js';
|
|||||||
*/
|
*/
|
||||||
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
export default forEach;
|
export default forEach;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import arrayEachRight from './_arrayEachRight.js';
|
import arrayEachRight from './_arrayEachRight.js';
|
||||||
import baseEachRight from './_baseEachRight.js';
|
import baseEachRight from './_baseEachRight.js';
|
||||||
import baseIteratee from './_baseIteratee.js';
|
import castFunction from './_castFunction.js';
|
||||||
import isArray from './isArray.js';
|
import isArray from './isArray.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -25,7 +25,7 @@ import isArray from './isArray.js';
|
|||||||
*/
|
*/
|
||||||
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
export default forEachRight;
|
export default forEachRight;
|
||||||
|
|||||||
4
forIn.js
4
forIn.js
@@ -1,5 +1,5 @@
|
|||||||
import baseFor from './_baseFor.js';
|
import baseFor from './_baseFor.js';
|
||||||
import baseIteratee from './_baseIteratee.js';
|
import castFunction from './_castFunction.js';
|
||||||
import keysIn from './keysIn.js';
|
import keysIn from './keysIn.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -33,7 +33,7 @@ import keysIn from './keysIn.js';
|
|||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default forIn;
|
export default forIn;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import baseForRight from './_baseForRight.js';
|
import baseForRight from './_baseForRight.js';
|
||||||
import baseIteratee from './_baseIteratee.js';
|
import castFunction from './_castFunction.js';
|
||||||
import keysIn from './keysIn.js';
|
import keysIn from './keysIn.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,7 +31,7 @@ import keysIn from './keysIn.js';
|
|||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default forInRight;
|
export default forInRight;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import baseForOwn from './_baseForOwn.js';
|
import baseForOwn from './_baseForOwn.js';
|
||||||
import baseIteratee from './_baseIteratee.js';
|
import castFunction from './_castFunction.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Iterates over own enumerable string keyed properties of an object and
|
* Iterates over own enumerable string keyed properties of an object and
|
||||||
@@ -30,7 +30,7 @@ import baseIteratee from './_baseIteratee.js';
|
|||||||
* // => 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));
|
||||||
}
|
}
|
||||||
|
|
||||||
export default forOwn;
|
export default forOwn;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import baseForOwnRight from './_baseForOwnRight.js';
|
import baseForOwnRight from './_baseForOwnRight.js';
|
||||||
import baseIteratee from './_baseIteratee.js';
|
import castFunction from './_castFunction.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is like `_.forOwn` except that it iterates over properties of
|
* This method is like `_.forOwn` except that it iterates over properties of
|
||||||
@@ -28,7 +28,7 @@ import baseIteratee from './_baseIteratee.js';
|
|||||||
* // => 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));
|
||||||
}
|
}
|
||||||
|
|
||||||
export default forOwnRight;
|
export default forOwnRight;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
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) {
|
||||||
|
|||||||
@@ -19,8 +19,7 @@ var hasOwnProperty = objectProto.hasOwnProperty;
|
|||||||
* @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
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ var nativeMax = Math.max;
|
|||||||
* // => 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 @@ import baseSlice from './_baseSlice.js';
|
|||||||
* // => [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) : [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,9 +29,8 @@ var intersectionWith = baseRest(function(arrays) {
|
|||||||
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])
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import isArrayLikeObject from './isArrayLikeObject.js';
|
import baseIsArguments from './_baseIsArguments.js';
|
||||||
|
import isObjectLike from './isObjectLike.js';
|
||||||
/** `Object#toString` result references. */
|
|
||||||
var argsTag = '[object Arguments]';
|
|
||||||
|
|
||||||
/** Used for built-in method references. */
|
/** Used for built-in method references. */
|
||||||
var objectProto = Object.prototype;
|
var objectProto = Object.prototype;
|
||||||
@@ -9,13 +7,6 @@ var objectProto = Object.prototype;
|
|||||||
/** Used to check objects for own properties. */
|
/** Used to check objects for own properties. */
|
||||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to resolve the
|
|
||||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
||||||
* of values.
|
|
||||||
*/
|
|
||||||
var objectToString = objectProto.toString;
|
|
||||||
|
|
||||||
/** Built-in value references. */
|
/** Built-in value references. */
|
||||||
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
||||||
|
|
||||||
@@ -37,10 +28,9 @@ var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
|||||||
* _.isArguments([1, 2, 3]);
|
* _.isArguments([1, 2, 3]);
|
||||||
* // => false
|
* // => false
|
||||||
*/
|
*/
|
||||||
function isArguments(value) {
|
var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
|
||||||
// Safari 8.1 makes `arguments.callee` enumerable in strict mode.
|
return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
|
||||||
return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
|
!propertyIsEnumerable.call(value, 'callee');
|
||||||
(!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
|
};
|
||||||
}
|
|
||||||
|
|
||||||
export default isArguments;
|
export default isArguments;
|
||||||
|
|||||||
13
isBoolean.js
13
isBoolean.js
@@ -1,18 +1,9 @@
|
|||||||
|
import baseGetTag from './_baseGetTag.js';
|
||||||
import isObjectLike from './isObjectLike.js';
|
import isObjectLike from './isObjectLike.js';
|
||||||
|
|
||||||
/** `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 +23,7 @@ var objectToString = objectProto.toString;
|
|||||||
*/
|
*/
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default isBoolean;
|
export default isBoolean;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import isPlainObject from './isPlainObject.js';
|
|||||||
* // => 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default isElement;
|
export default isElement;
|
||||||
|
|||||||
12
isEmpty.js
12
isEmpty.js
@@ -1,10 +1,11 @@
|
|||||||
|
import baseKeys from './_baseKeys.js';
|
||||||
import getTag from './_getTag.js';
|
import getTag from './_getTag.js';
|
||||||
import isArguments from './isArguments.js';
|
import isArguments from './isArguments.js';
|
||||||
import isArray from './isArray.js';
|
import isArray from './isArray.js';
|
||||||
import isArrayLike from './isArrayLike.js';
|
import isArrayLike from './isArrayLike.js';
|
||||||
import isBuffer from './isBuffer.js';
|
import isBuffer from './isBuffer.js';
|
||||||
import isPrototype from './_isPrototype.js';
|
import isPrototype from './_isPrototype.js';
|
||||||
import nativeKeys from './_nativeKeys.js';
|
import isTypedArray from './isTypedArray.js';
|
||||||
|
|
||||||
/** `Object#toString` result references. */
|
/** `Object#toString` result references. */
|
||||||
var mapTag = '[object Map]',
|
var mapTag = '[object Map]',
|
||||||
@@ -50,9 +51,12 @@ var hasOwnProperty = objectProto.hasOwnProperty;
|
|||||||
* // => false
|
* // => false
|
||||||
*/
|
*/
|
||||||
function isEmpty(value) {
|
function isEmpty(value) {
|
||||||
|
if (value == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (isArrayLike(value) &&
|
if (isArrayLike(value) &&
|
||||||
(isArray(value) || typeof value == 'string' ||
|
(isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
|
||||||
typeof value.splice == 'function' || isBuffer(value) || isArguments(value))) {
|
isBuffer(value) || isTypedArray(value) || isArguments(value))) {
|
||||||
return !value.length;
|
return !value.length;
|
||||||
}
|
}
|
||||||
var tag = getTag(value);
|
var tag = getTag(value);
|
||||||
@@ -60,7 +64,7 @@ function isEmpty(value) {
|
|||||||
return !value.size;
|
return !value.size;
|
||||||
}
|
}
|
||||||
if (isPrototype(value)) {
|
if (isPrototype(value)) {
|
||||||
return !nativeKeys(value).length;
|
return !baseKeys(value).length;
|
||||||
}
|
}
|
||||||
for (var key in value) {
|
for (var key in value) {
|
||||||
if (hasOwnProperty.call(value, key)) {
|
if (hasOwnProperty.call(value, key)) {
|
||||||
|
|||||||
20
isError.js
20
isError.js
@@ -1,17 +1,10 @@
|
|||||||
|
import baseGetTag from './_baseGetTag.js';
|
||||||
import isObjectLike from './isObjectLike.js';
|
import isObjectLike from './isObjectLike.js';
|
||||||
|
import isPlainObject from './isPlainObject.js';
|
||||||
|
|
||||||
/** `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 +28,9 @@ function isError(value) {
|
|||||||
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
export default isError;
|
export default isError;
|
||||||
|
|||||||
@@ -1,18 +1,11 @@
|
|||||||
|
import baseGetTag from './_baseGetTag.js';
|
||||||
import isObject from './isObject.js';
|
import isObject from './isObject.js';
|
||||||
|
|
||||||
/** `Object#toString` result references. */
|
/** `Object#toString` result references. */
|
||||||
var funcTag = '[object Function]',
|
var asyncTag = '[object AsyncFunction]',
|
||||||
genTag = '[object GeneratorFunction]';
|
funcTag = '[object Function]',
|
||||||
|
genTag = '[object GeneratorFunction]',
|
||||||
/** Used for built-in method references. */
|
proxyTag = '[object Proxy]';
|
||||||
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.
|
||||||
@@ -32,10 +25,13 @@ var objectToString = objectProto.toString;
|
|||||||
* // => 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 8-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;
|
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default isFunction;
|
export default isFunction;
|
||||||
|
|||||||
13
isNumber.js
13
isNumber.js
@@ -1,18 +1,9 @@
|
|||||||
|
import baseGetTag from './_baseGetTag.js';
|
||||||
import isObjectLike from './isObjectLike.js';
|
import isObjectLike from './isObjectLike.js';
|
||||||
|
|
||||||
/** `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 +32,7 @@ var objectToString = objectProto.toString;
|
|||||||
*/
|
*/
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default isNumber;
|
export default isNumber;
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import baseGetTag from './_baseGetTag.js';
|
||||||
import getPrototype from './_getPrototype.js';
|
import getPrototype from './_getPrototype.js';
|
||||||
import isObjectLike from './isObjectLike.js';
|
import isObjectLike from './isObjectLike.js';
|
||||||
|
|
||||||
@@ -17,13 +18,6 @@ var hasOwnProperty = objectProto.hasOwnProperty;
|
|||||||
/** 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`.
|
||||||
@@ -53,7 +47,7 @@ var objectToString = objectProto.toString;
|
|||||||
* // => 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);
|
||||||
@@ -61,8 +55,8 @@ function isPlainObject(value) {
|
|||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default isPlainObject;
|
export default isPlainObject;
|
||||||
|
|||||||
13
isString.js
13
isString.js
@@ -1,19 +1,10 @@
|
|||||||
|
import baseGetTag from './_baseGetTag.js';
|
||||||
import isArray from './isArray.js';
|
import isArray from './isArray.js';
|
||||||
import isObjectLike from './isObjectLike.js';
|
import isObjectLike from './isObjectLike.js';
|
||||||
|
|
||||||
/** `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.
|
||||||
*
|
*
|
||||||
@@ -33,7 +24,7 @@ var objectToString = objectProto.toString;
|
|||||||
*/
|
*/
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default isString;
|
export default isString;
|
||||||
|
|||||||
13
isSymbol.js
13
isSymbol.js
@@ -1,18 +1,9 @@
|
|||||||
|
import baseGetTag from './_baseGetTag.js';
|
||||||
import isObjectLike from './isObjectLike.js';
|
import isObjectLike from './isObjectLike.js';
|
||||||
|
|
||||||
/** `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 +23,7 @@ var objectToString = objectProto.toString;
|
|||||||
*/
|
*/
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default isSymbol;
|
export default isSymbol;
|
||||||
|
|||||||
13
isWeakSet.js
13
isWeakSet.js
@@ -1,18 +1,9 @@
|
|||||||
|
import baseGetTag from './_baseGetTag.js';
|
||||||
import isObjectLike from './isObjectLike.js';
|
import isObjectLike from './isObjectLike.js';
|
||||||
|
|
||||||
/** `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 +22,7 @@ var objectToString = objectProto.toString;
|
|||||||
* // => false
|
* // => false
|
||||||
*/
|
*/
|
||||||
function isWeakSet(value) {
|
function isWeakSet(value) {
|
||||||
return isObjectLike(value) && objectToString.call(value) == weakSetTag;
|
return isObjectLike(value) && baseGetTag(value) == weakSetTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default isWeakSet;
|
export default isWeakSet;
|
||||||
|
|||||||
2
join.js
2
join.js
@@ -20,7 +20,7 @@ var nativeJoin = arrayProto.join;
|
|||||||
* // => '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);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default join;
|
export default join;
|
||||||
|
|||||||
3
keyBy.js
3
keyBy.js
@@ -12,8 +12,7 @@ import createAggregator from './_createAggregator.js';
|
|||||||
* @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
@@ -13,7 +13,7 @@
|
|||||||
* // => 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 @@ var nativeMax = Math.max,
|
|||||||
* // => 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;
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user