diff --git a/LICENSE b/LICENSE
index e0c69d560..c6f2f6145 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright jQuery Foundation and other contributors
+Copyright JS Foundation and other contributors
Based on Underscore.js, copyright Jeremy Ashkenas,
DocumentCloud and Investigative Reporters & Editors
diff --git a/README.md b/README.md
index d06860546..e9151999c 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# lodash-es v4.16.4
+# lodash-es v4.16.5
The [Lodash](https://lodash.com/) library exported as [ES](http://www.ecma-international.org/ecma-262/6.0/) modules.
@@ -7,4 +7,4 @@ Generated using [lodash-cli](https://www.npmjs.com/package/lodash-cli):
$ lodash modularize exports=es -o ./
```
-See the [package source](https://github.com/lodash/lodash/tree/4.16.4-es) for more details.
+See the [package source](https://github.com/lodash/lodash/tree/4.16.5-es) for more details.
diff --git a/_Hash.js b/_Hash.js
index 494e9a7b8..8ecacb008 100644
--- a/_Hash.js
+++ b/_Hash.js
@@ -13,7 +13,7 @@ import hashSet from './_hashSet.js';
*/
function Hash(entries) {
var index = -1,
- length = entries ? entries.length : 0;
+ length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
diff --git a/_ListCache.js b/_ListCache.js
index 08aaca649..bafa2afc5 100644
--- a/_ListCache.js
+++ b/_ListCache.js
@@ -13,7 +13,7 @@ import listCacheSet from './_listCacheSet.js';
*/
function ListCache(entries) {
var index = -1,
- length = entries ? entries.length : 0;
+ length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
diff --git a/_MapCache.js b/_MapCache.js
index e37c21d85..deef22ed3 100644
--- a/_MapCache.js
+++ b/_MapCache.js
@@ -13,7 +13,7 @@ import mapCacheSet from './_mapCacheSet.js';
*/
function MapCache(entries) {
var index = -1,
- length = entries ? entries.length : 0;
+ length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
diff --git a/_SetCache.js b/_SetCache.js
index c5e8d8a9a..12455ff42 100644
--- a/_SetCache.js
+++ b/_SetCache.js
@@ -12,7 +12,7 @@ import setCacheHas from './_setCacheHas.js';
*/
function SetCache(values) {
var index = -1,
- length = values ? values.length : 0;
+ length = values == null ? 0 : values.length;
this.__data__ = new MapCache;
while (++index < length) {
diff --git a/_arrayAggregator.js b/_arrayAggregator.js
index 55cb5c061..d45187929 100644
--- a/_arrayAggregator.js
+++ b/_arrayAggregator.js
@@ -10,7 +10,7 @@
*/
function arrayAggregator(array, setter, iteratee, accumulator) {
var index = -1,
- length = array ? array.length : 0;
+ length = array == null ? 0 : array.length;
while (++index < length) {
var value = array[index];
diff --git a/_arrayEach.js b/_arrayEach.js
index abe06e1f5..2a570bf7f 100644
--- a/_arrayEach.js
+++ b/_arrayEach.js
@@ -9,7 +9,7 @@
*/
function arrayEach(array, iteratee) {
var index = -1,
- length = array ? array.length : 0;
+ length = array == null ? 0 : array.length;
while (++index < length) {
if (iteratee(array[index], index, array) === false) {
diff --git a/_arrayEachRight.js b/_arrayEachRight.js
index 54dcf2903..ce87d1acc 100644
--- a/_arrayEachRight.js
+++ b/_arrayEachRight.js
@@ -8,7 +8,7 @@
* @returns {Array} Returns `array`.
*/
function arrayEachRight(array, iteratee) {
- var length = array ? array.length : 0;
+ var length = array == null ? 0 : array.length;
while (length--) {
if (iteratee(array[length], length, array) === false) {
diff --git a/_arrayEvery.js b/_arrayEvery.js
index 3659b1c95..93f30a9bc 100644
--- a/_arrayEvery.js
+++ b/_arrayEvery.js
@@ -10,7 +10,7 @@
*/
function arrayEvery(array, predicate) {
var index = -1,
- length = array ? array.length : 0;
+ length = array == null ? 0 : array.length;
while (++index < length) {
if (!predicate(array[index], index, array)) {
diff --git a/_arrayFilter.js b/_arrayFilter.js
index 09cfaf8cb..20d376994 100644
--- a/_arrayFilter.js
+++ b/_arrayFilter.js
@@ -9,7 +9,7 @@
*/
function arrayFilter(array, predicate) {
var index = -1,
- length = array ? array.length : 0,
+ length = array == null ? 0 : array.length,
resIndex = 0,
result = [];
diff --git a/_arrayIncludes.js b/_arrayIncludes.js
index 12b48843f..d515af900 100644
--- a/_arrayIncludes.js
+++ b/_arrayIncludes.js
@@ -10,7 +10,7 @@ import baseIndexOf from './_baseIndexOf.js';
* @returns {boolean} Returns `true` if `target` is found, else `false`.
*/
function arrayIncludes(array, value) {
- var length = array ? array.length : 0;
+ var length = array == null ? 0 : array.length;
return !!length && baseIndexOf(array, value, 0) > -1;
}
diff --git a/_arrayIncludesWith.js b/_arrayIncludesWith.js
index 817ab7613..9dedaa253 100644
--- a/_arrayIncludesWith.js
+++ b/_arrayIncludesWith.js
@@ -9,7 +9,7 @@
*/
function arrayIncludesWith(array, value, comparator) {
var index = -1,
- length = array ? array.length : 0;
+ length = array == null ? 0 : array.length;
while (++index < length) {
if (comparator(value, array[index])) {
diff --git a/_arrayMap.js b/_arrayMap.js
index c9dfd1e63..8d32a4e65 100644
--- a/_arrayMap.js
+++ b/_arrayMap.js
@@ -9,7 +9,7 @@
*/
function arrayMap(array, iteratee) {
var index = -1,
- length = array ? array.length : 0,
+ length = array == null ? 0 : array.length,
result = Array(length);
while (++index < length) {
diff --git a/_arrayReduce.js b/_arrayReduce.js
index 5c009765e..58e1df310 100644
--- a/_arrayReduce.js
+++ b/_arrayReduce.js
@@ -12,7 +12,7 @@
*/
function arrayReduce(array, iteratee, accumulator, initAccum) {
var index = -1,
- length = array ? array.length : 0;
+ length = array == null ? 0 : array.length;
if (initAccum && length) {
accumulator = array[++index];
diff --git a/_arrayReduceRight.js b/_arrayReduceRight.js
index 01fc473bf..c185bebef 100644
--- a/_arrayReduceRight.js
+++ b/_arrayReduceRight.js
@@ -11,7 +11,7 @@
* @returns {*} Returns the accumulated value.
*/
function arrayReduceRight(array, iteratee, accumulator, initAccum) {
- var length = array ? array.length : 0;
+ var length = array == null ? 0 : array.length;
if (initAccum && length) {
accumulator = array[--length];
}
diff --git a/_arraySome.js b/_arraySome.js
index 2da32de54..d66f4c320 100644
--- a/_arraySome.js
+++ b/_arraySome.js
@@ -10,7 +10,7 @@
*/
function arraySome(array, predicate) {
var index = -1,
- length = array ? array.length : 0;
+ length = array == null ? 0 : array.length;
while (++index < length) {
if (predicate(array[index], index, array)) {
diff --git a/_baseAt.js b/_baseAt.js
index e54eef3fe..0f5a61087 100644
--- a/_baseAt.js
+++ b/_baseAt.js
@@ -10,12 +10,12 @@ import get from './get.js';
*/
function baseAt(object, paths) {
var index = -1,
- isNil = object == null,
length = paths.length,
- result = Array(length);
+ result = Array(length),
+ skip = object == null;
while (++index < length) {
- result[index] = isNil ? undefined : get(object, paths[index]);
+ result[index] = skip ? undefined : get(object, paths[index]);
}
return result;
}
diff --git a/_baseDifference.js b/_baseDifference.js
index 040d04b9e..9916db72d 100644
--- a/_baseDifference.js
+++ b/_baseDifference.js
@@ -45,7 +45,7 @@ function baseDifference(array, values, iteratee, comparator) {
outer:
while (++index < length) {
var value = array[index],
- computed = iteratee ? iteratee(value) : value;
+ computed = iteratee == null ? value : iteratee(value);
value = (comparator || value !== 0) ? value : 0;
if (isCommon && computed === computed) {
diff --git a/_baseGetTag.js b/_baseGetTag.js
index 2ca148557..8e9663176 100644
--- a/_baseGetTag.js
+++ b/_baseGetTag.js
@@ -1,22 +1,29 @@
-/** Used for built-in method references. */
-var objectProto = Object.prototype;
+import Symbol from './_Symbol.js';
+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
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
- * of values.
- */
-var objectToString = objectProto.toString;
-
-/**
- * The base implementation of `getTag`.
+ * The base implementation of `getTag` without fallbacks for buggy environments.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
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;
diff --git a/_baseIsArguments.js b/_baseIsArguments.js
index f4ff1fc6f..cbf4ca686 100644
--- a/_baseIsArguments.js
+++ b/_baseIsArguments.js
@@ -1,18 +1,9 @@
+import baseGetTag from './_baseGetTag.js';
import isObjectLike from './isObjectLike.js';
/** `Object#toString` result references. */
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`.
*
@@ -21,7 +12,7 @@ var objectToString = objectProto.toString;
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
*/
function baseIsArguments(value) {
- return isObjectLike(value) && objectToString.call(value) == argsTag;
+ return isObjectLike(value) && baseGetTag(value) == argsTag;
}
export default baseIsArguments;
diff --git a/_baseIsArrayBuffer.js b/_baseIsArrayBuffer.js
index b7a84f119..7a25a8f61 100644
--- a/_baseIsArrayBuffer.js
+++ b/_baseIsArrayBuffer.js
@@ -1,17 +1,8 @@
+import baseGetTag from './_baseGetTag.js';
import isObjectLike from './isObjectLike.js';
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.
*
@@ -20,7 +11,7 @@ var objectToString = objectProto.toString;
* @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
*/
function baseIsArrayBuffer(value) {
- return isObjectLike(value) && objectToString.call(value) == arrayBufferTag;
+ return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
}
export default baseIsArrayBuffer;
diff --git a/_baseIsDate.js b/_baseIsDate.js
index f58ea3cb6..5487cb51b 100644
--- a/_baseIsDate.js
+++ b/_baseIsDate.js
@@ -1,18 +1,9 @@
+import baseGetTag from './_baseGetTag.js';
import isObjectLike from './isObjectLike.js';
/** `Object#toString` result references. */
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.
*
@@ -21,7 +12,7 @@ var objectToString = objectProto.toString;
* @returns {boolean} Returns `true` if `value` is a date object, else `false`.
*/
function baseIsDate(value) {
- return isObjectLike(value) && objectToString.call(value) == dateTag;
+ return isObjectLike(value) && baseGetTag(value) == dateTag;
}
export default baseIsDate;
diff --git a/_baseIsRegExp.js b/_baseIsRegExp.js
index 45e6ad90c..e73971b39 100644
--- a/_baseIsRegExp.js
+++ b/_baseIsRegExp.js
@@ -1,18 +1,9 @@
-import isObject from './isObject.js';
+import baseGetTag from './_baseGetTag.js';
+import isObjectLike from './isObjectLike.js';
/** `Object#toString` result references. */
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.
*
@@ -21,7 +12,7 @@ var objectToString = objectProto.toString;
* @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
*/
function baseIsRegExp(value) {
- return isObject(value) && objectToString.call(value) == regexpTag;
+ return isObjectLike(value) && baseGetTag(value) == regexpTag;
}
export default baseIsRegExp;
diff --git a/_baseIsTypedArray.js b/_baseIsTypedArray.js
index 37e8193f1..0a18d1c1a 100644
--- a/_baseIsTypedArray.js
+++ b/_baseIsTypedArray.js
@@ -1,3 +1,4 @@
+import baseGetTag from './_baseGetTag.js';
import isLength from './isLength.js';
import isObjectLike from './isObjectLike.js';
@@ -44,16 +45,6 @@ typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
typedArrayTags[setTag] = typedArrayTags[stringTag] =
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.
*
@@ -63,7 +54,7 @@ var objectToString = objectProto.toString;
*/
function baseIsTypedArray(value) {
return isObjectLike(value) &&
- isLength(value.length) && !!typedArrayTags[objectToString.call(value)];
+ isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
}
export default baseIsTypedArray;
diff --git a/_baseMean.js b/_baseMean.js
index 1a95e7f2f..f2f1c57fb 100644
--- a/_baseMean.js
+++ b/_baseMean.js
@@ -13,7 +13,7 @@ var NAN = 0 / 0;
* @returns {number} Returns the mean.
*/
function baseMean(array, iteratee) {
- var length = array ? array.length : 0;
+ var length = array == null ? 0 : array.length;
return length ? (baseSum(array, iteratee) / length) : NAN;
}
diff --git a/_baseSortedIndex.js b/_baseSortedIndex.js
index 9abab9ccd..c19250591 100644
--- a/_baseSortedIndex.js
+++ b/_baseSortedIndex.js
@@ -20,7 +20,7 @@ var MAX_ARRAY_LENGTH = 4294967295,
*/
function baseSortedIndex(array, value, retHighest) {
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) {
while (low < high) {
diff --git a/_baseSortedIndexBy.js b/_baseSortedIndexBy.js
index 3aef164a8..20a90d0ad 100644
--- a/_baseSortedIndexBy.js
+++ b/_baseSortedIndexBy.js
@@ -25,7 +25,7 @@ function baseSortedIndexBy(array, value, iteratee, retHighest) {
value = iteratee(value);
var low = 0,
- high = array ? array.length : 0,
+ high = array == null ? 0 : array.length,
valIsNaN = value !== value,
valIsNull = value === null,
valIsSymbol = isSymbol(value),
diff --git a/_baseXor.js b/_baseXor.js
index e5190f416..05dce1258 100644
--- a/_baseXor.js
+++ b/_baseXor.js
@@ -1,5 +1,5 @@
-import arrayPush from './_arrayPush.js';
import baseDifference from './_baseDifference.js';
+import baseFlatten from './_baseFlatten.js';
import baseUniq from './_baseUniq.js';
/**
@@ -13,18 +13,25 @@ import baseUniq from './_baseUniq.js';
* @returns {Array} Returns the new array of values.
*/
function baseXor(arrays, iteratee, comparator) {
+ var length = arrays.length;
+ if (length < 2) {
+ return length ? baseUniq(arrays[0]) : [];
+ }
var index = -1,
- length = arrays.length;
+ result = Array(length);
while (++index < length) {
- var result = result
- ? arrayPush(
- baseDifference(result, arrays[index], iteratee, comparator),
- baseDifference(arrays[index], result, iteratee, comparator)
- )
- : arrays[index];
+ var array = arrays[index],
+ othIndex = -1;
+
+ while (++othIndex < length) {
+ var othArray = arrays[othIndex];
+ 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;
diff --git a/_getRawTag.js b/_getRawTag.js
new file mode 100644
index 000000000..a89a35b1c
--- /dev/null
+++ b/_getRawTag.js
@@ -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;
diff --git a/_getTag.js b/_getTag.js
index 2b921e200..0c86db0f9 100644
--- a/_getTag.js
+++ b/_getTag.js
@@ -15,16 +15,6 @@ var mapTag = '[object Map]',
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. */
var dataViewCtorString = toSource(DataView),
mapCtorString = toSource(Map),
@@ -48,9 +38,9 @@ if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
(Set && getTag(new Set) != setTag) ||
(WeakMap && getTag(new WeakMap) != weakMapTag)) {
getTag = function(value) {
- var result = objectToString.call(value),
+ var result = baseGetTag(value),
Ctor = result == objectTag ? value.constructor : undefined,
- ctorString = Ctor ? toSource(Ctor) : undefined;
+ ctorString = Ctor ? toSource(Ctor) : '';
if (ctorString) {
switch (ctorString) {
diff --git a/_hasPath.js b/_hasPath.js
index 866605ed4..a0698dc52 100644
--- a/_hasPath.js
+++ b/_hasPath.js
@@ -32,7 +32,7 @@ function hasPath(object, path, hasFunc) {
if (result || ++index != length) {
return result;
}
- length = object ? object.length : 0;
+ length = object == null ? 0 : object.length;
return !!length && isLength(length) && isIndex(key, length) &&
(isArray(object) || isArguments(object));
}
diff --git a/_objectToString.js b/_objectToString.js
new file mode 100644
index 000000000..749a5f9ca
--- /dev/null
+++ b/_objectToString.js
@@ -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;
diff --git a/_shortOut.js b/_shortOut.js
index e792abb00..78fadcd41 100644
--- a/_shortOut.js
+++ b/_shortOut.js
@@ -1,5 +1,5 @@
/** 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;
/* Built-in method references for those with the same name as other `lodash` methods. */
diff --git a/_toSource.js b/_toSource.js
index 2a7f05f1f..2696f7aff 100644
--- a/_toSource.js
+++ b/_toSource.js
@@ -8,7 +8,7 @@ var funcToString = funcProto.toString;
* Converts `func` to its source code.
*
* @private
- * @param {Function} func The function to process.
+ * @param {Function} func The function to convert.
* @returns {string} Returns the source code.
*/
function toSource(func) {
diff --git a/_unicodeWords.js b/_unicodeWords.js
index 9d605fe11..4ca2d4ca4 100644
--- a/_unicodeWords.js
+++ b/_unicodeWords.js
@@ -29,22 +29,26 @@ var rsApos = "['\u2019]",
rsZWJ = '\\u200d';
/** Used to compose unicode regexes. */
-var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')',
- rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')',
- rsOptLowerContr = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
- rsOptUpperContr = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
+var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
+ rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
+ rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
+ rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
reOptMod = rsModifier + '?',
rsOptVar = '[' + rsVarRange + ']?',
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,
rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq;
/** Used to match complex or compound words. */
var reUnicodeWord = RegExp([
- rsUpper + '?' + rsLower + '+' + rsOptLowerContr + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
- rsUpperMisc + '+' + rsOptUpperContr + '(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')',
- rsUpper + '?' + rsLowerMisc + '+' + rsOptLowerContr,
- rsUpper + '+' + rsOptUpperContr,
+ rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
+ rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
+ rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
+ rsUpper + '+' + rsOptContrUpper,
+ rsOrdUpper,
+ rsOrdLower,
rsDigits,
rsEmoji
].join('|'), 'g');
diff --git a/chunk.js b/chunk.js
index d0cf6b30c..70dd98333 100644
--- a/chunk.js
+++ b/chunk.js
@@ -33,7 +33,7 @@ function chunk(array, size, guard) {
} else {
size = nativeMax(toInteger(size), 0);
}
- var length = array ? array.length : 0;
+ var length = array == null ? 0 : array.length;
if (!length || size < 1) {
return [];
}
diff --git a/cloneDeepWith.js b/cloneDeepWith.js
index b1933966b..f2fb895e8 100644
--- a/cloneDeepWith.js
+++ b/cloneDeepWith.js
@@ -29,6 +29,7 @@ import baseClone from './_baseClone.js';
* // => 20
*/
function cloneDeepWith(value, customizer) {
+ customizer = typeof customizer == 'function' ? customizer : undefined;
return baseClone(value, true, true, customizer);
}
diff --git a/cloneWith.js b/cloneWith.js
index 390f18879..7a97b21e5 100644
--- a/cloneWith.js
+++ b/cloneWith.js
@@ -32,6 +32,7 @@ import baseClone from './_baseClone.js';
* // => 0
*/
function cloneWith(value, customizer) {
+ customizer = typeof customizer == 'function' ? customizer : undefined;
return baseClone(value, false, true, customizer);
}
diff --git a/compact.js b/compact.js
index 24e98d2b6..b644f2804 100644
--- a/compact.js
+++ b/compact.js
@@ -15,7 +15,7 @@
*/
function compact(array) {
var index = -1,
- length = array ? array.length : 0,
+ length = array == null ? 0 : array.length,
resIndex = 0,
result = [];
diff --git a/cond.js b/cond.js
index 9c0183131..21eec1301 100644
--- a/cond.js
+++ b/cond.js
@@ -36,7 +36,7 @@ var FUNC_ERROR_TEXT = 'Expected a function';
* // => 'no match'
*/
function cond(pairs) {
- var length = pairs ? pairs.length : 0,
+ var length = pairs == null ? 0 : pairs.length,
toIteratee = baseIteratee;
pairs = !length ? [] : arrayMap(pairs, function(pair) {
diff --git a/countBy.js b/countBy.js
index a770f46bf..2d0121308 100644
--- a/countBy.js
+++ b/countBy.js
@@ -18,8 +18,7 @@ var hasOwnProperty = objectProto.hasOwnProperty;
* @since 0.5.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Function} [iteratee=_.identity]
- * The iteratee to transform keys.
+ * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
* @returns {Object} Returns the composed aggregate object.
* @example
*
diff --git a/create.js b/create.js
index deb77460f..5a9aa3702 100644
--- a/create.js
+++ b/create.js
@@ -37,7 +37,7 @@ import baseCreate from './_baseCreate.js';
*/
function create(prototype, properties) {
var result = baseCreate(prototype);
- return properties ? baseAssign(result, properties) : result;
+ return properties == null ? result : baseAssign(result, properties);
}
export default create;
diff --git a/drop.js b/drop.js
index f172708c4..03e59a922 100644
--- a/drop.js
+++ b/drop.js
@@ -27,7 +27,7 @@ import toInteger from './toInteger.js';
* // => [1, 2, 3]
*/
function drop(array, n, guard) {
- var length = array ? array.length : 0;
+ var length = array == null ? 0 : array.length;
if (!length) {
return [];
}
diff --git a/dropRight.js b/dropRight.js
index 2ad39b4df..642f241b0 100644
--- a/dropRight.js
+++ b/dropRight.js
@@ -27,7 +27,7 @@ import toInteger from './toInteger.js';
* // => [1, 2, 3]
*/
function dropRight(array, n, guard) {
- var length = array ? array.length : 0;
+ var length = array == null ? 0 : array.length;
if (!length) {
return [];
}
diff --git a/dropWhile.js b/dropWhile.js
index d9b718ee9..688c4dccd 100644
--- a/dropWhile.js
+++ b/dropWhile.js
@@ -11,8 +11,7 @@ import baseWhile from './_baseWhile.js';
* @since 3.0.0
* @category Array
* @param {Array} array The array to query.
- * @param {Function} [predicate=_.identity]
- * The function invoked per iteration.
+ * @param {Function} [predicate=_.identity] The function invoked per iteration.
* @returns {Array} Returns the slice of `array`.
* @example
*
diff --git a/every.js b/every.js
index d953c56b3..f44d02cf5 100644
--- a/every.js
+++ b/every.js
@@ -19,8 +19,7 @@ import isIterateeCall from './_isIterateeCall.js';
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Function} [predicate=_.identity]
- * The function invoked per iteration.
+ * @param {Function} [predicate=_.identity] The function invoked per iteration.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {boolean} Returns `true` if all elements pass the predicate check,
* else `false`.
diff --git a/fill.js b/fill.js
index 6f8423646..42c2ba795 100644
--- a/fill.js
+++ b/fill.js
@@ -31,7 +31,7 @@ import isIterateeCall from './_isIterateeCall.js';
* // => [4, '*', '*', 10]
*/
function fill(array, value, start, end) {
- var length = array ? array.length : 0;
+ var length = array == null ? 0 : array.length;
if (!length) {
return [];
}
diff --git a/filter.js b/filter.js
index 451f63fa7..e45a7ba57 100644
--- a/filter.js
+++ b/filter.js
@@ -15,8 +15,7 @@ import isArray from './isArray.js';
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Function} [predicate=_.identity]
- * The function invoked per iteration.
+ * @param {Function} [predicate=_.identity] The function invoked per iteration.
* @returns {Array} Returns the new filtered array.
* @see _.reject
* @example
diff --git a/find.js b/find.js
index 24a792b56..fd8de527e 100644
--- a/find.js
+++ b/find.js
@@ -11,8 +11,7 @@ import findIndex from './findIndex.js';
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to inspect.
- * @param {Function} [predicate=_.identity]
- * The function invoked per iteration.
+ * @param {Function} [predicate=_.identity] The function invoked per iteration.
* @param {number} [fromIndex=0] The index to search from.
* @returns {*} Returns the matched element, else `undefined`.
* @example
diff --git a/findIndex.js b/findIndex.js
index 084f48af2..c1cd7cdb3 100644
--- a/findIndex.js
+++ b/findIndex.js
@@ -14,8 +14,7 @@ var nativeMax = Math.max;
* @since 1.1.0
* @category Array
* @param {Array} array The array to inspect.
- * @param {Function} [predicate=_.identity]
- * The function invoked per iteration.
+ * @param {Function} [predicate=_.identity] The function invoked per iteration.
* @param {number} [fromIndex=0] The index to search from.
* @returns {number} Returns the index of the found element, else `-1`.
* @example
@@ -42,7 +41,7 @@ var nativeMax = Math.max;
* // => 2
*/
function findIndex(array, predicate, fromIndex) {
- var length = array ? array.length : 0;
+ var length = array == null ? 0 : array.length;
if (!length) {
return -1;
}
diff --git a/findLast.js b/findLast.js
index 236ed2624..02373864e 100644
--- a/findLast.js
+++ b/findLast.js
@@ -10,8 +10,7 @@ import findLastIndex from './findLastIndex.js';
* @since 2.0.0
* @category Collection
* @param {Array|Object} collection The collection to inspect.
- * @param {Function} [predicate=_.identity]
- * The function invoked per iteration.
+ * @param {Function} [predicate=_.identity] The function invoked per iteration.
* @param {number} [fromIndex=collection.length-1] The index to search from.
* @returns {*} Returns the matched element, else `undefined`.
* @example
diff --git a/findLastIndex.js b/findLastIndex.js
index 1881ea16d..c2bb6dc1a 100644
--- a/findLastIndex.js
+++ b/findLastIndex.js
@@ -15,8 +15,7 @@ var nativeMax = Math.max,
* @since 2.0.0
* @category Array
* @param {Array} array The array to inspect.
- * @param {Function} [predicate=_.identity]
- * The function invoked per iteration.
+ * @param {Function} [predicate=_.identity] The function invoked per iteration.
* @param {number} [fromIndex=array.length-1] The index to search from.
* @returns {number} Returns the index of the found element, else `-1`.
* @example
@@ -43,7 +42,7 @@ var nativeMax = Math.max,
* // => 0
*/
function findLastIndex(array, predicate, fromIndex) {
- var length = array ? array.length : 0;
+ var length = array == null ? 0 : array.length;
if (!length) {
return -1;
}
diff --git a/flatMap.js b/flatMap.js
index e65beb1c4..52a6a7aeb 100644
--- a/flatMap.js
+++ b/flatMap.js
@@ -11,8 +11,7 @@ import map from './map.js';
* @since 4.0.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Function} [iteratee=_.identity]
- * The function invoked per iteration.
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Array} Returns the new flattened array.
* @example
*
diff --git a/flatMapDeep.js b/flatMapDeep.js
index 125049ce6..d33d219e4 100644
--- a/flatMapDeep.js
+++ b/flatMapDeep.js
@@ -13,8 +13,7 @@ var INFINITY = 1 / 0;
* @since 4.7.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Function} [iteratee=_.identity]
- * The function invoked per iteration.
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Array} Returns the new flattened array.
* @example
*
diff --git a/flatMapDepth.js b/flatMapDepth.js
index 141ebf3ad..4be00964c 100644
--- a/flatMapDepth.js
+++ b/flatMapDepth.js
@@ -11,8 +11,7 @@ import toInteger from './toInteger.js';
* @since 4.7.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Function} [iteratee=_.identity]
- * The function invoked per iteration.
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @param {number} [depth=1] The maximum recursion depth.
* @returns {Array} Returns the new flattened array.
* @example
diff --git a/flatten.js b/flatten.js
index 009b3906d..399b2a762 100644
--- a/flatten.js
+++ b/flatten.js
@@ -15,7 +15,7 @@ import baseFlatten from './_baseFlatten.js';
* // => [1, 2, [3, [4]], 5]
*/
function flatten(array) {
- var length = array ? array.length : 0;
+ var length = array == null ? 0 : array.length;
return length ? baseFlatten(array, 1) : [];
}
diff --git a/flattenDeep.js b/flattenDeep.js
index 55afc054a..4a7a9a98b 100644
--- a/flattenDeep.js
+++ b/flattenDeep.js
@@ -18,7 +18,7 @@ var INFINITY = 1 / 0;
* // => [1, 2, 3, 4, 5]
*/
function flattenDeep(array) {
- var length = array ? array.length : 0;
+ var length = array == null ? 0 : array.length;
return length ? baseFlatten(array, INFINITY) : [];
}
diff --git a/flattenDepth.js b/flattenDepth.js
index 1f6d9e550..101dc3f0f 100644
--- a/flattenDepth.js
+++ b/flattenDepth.js
@@ -22,7 +22,7 @@ import toInteger from './toInteger.js';
* // => [1, 2, 3, [4], 5]
*/
function flattenDepth(array, depth) {
- var length = array ? array.length : 0;
+ var length = array == null ? 0 : array.length;
if (!length) {
return [];
}
diff --git a/forEach.js b/forEach.js
index c0aa120df..ac1310ced 100644
--- a/forEach.js
+++ b/forEach.js
@@ -1,6 +1,6 @@
import arrayEach from './_arrayEach.js';
import baseEach from './_baseEach.js';
-import baseIteratee from './_baseIteratee.js';
+import castFunction from './_castFunction.js';
import isArray from './isArray.js';
/**
@@ -35,7 +35,7 @@ import isArray from './isArray.js';
*/
function forEach(collection, iteratee) {
var func = isArray(collection) ? arrayEach : baseEach;
- return func(collection, baseIteratee(iteratee, 3));
+ return func(collection, castFunction(iteratee));
}
export default forEach;
diff --git a/forEachRight.js b/forEachRight.js
index 73c39866a..924548eba 100644
--- a/forEachRight.js
+++ b/forEachRight.js
@@ -1,6 +1,6 @@
import arrayEachRight from './_arrayEachRight.js';
import baseEachRight from './_baseEachRight.js';
-import baseIteratee from './_baseIteratee.js';
+import castFunction from './_castFunction.js';
import isArray from './isArray.js';
/**
@@ -25,7 +25,7 @@ import isArray from './isArray.js';
*/
function forEachRight(collection, iteratee) {
var func = isArray(collection) ? arrayEachRight : baseEachRight;
- return func(collection, baseIteratee(iteratee, 3));
+ return func(collection, castFunction(iteratee));
}
export default forEachRight;
diff --git a/forIn.js b/forIn.js
index 6355127dc..436f319d2 100644
--- a/forIn.js
+++ b/forIn.js
@@ -1,5 +1,5 @@
import baseFor from './_baseFor.js';
-import baseIteratee from './_baseIteratee.js';
+import castFunction from './_castFunction.js';
import keysIn from './keysIn.js';
/**
@@ -33,7 +33,7 @@ import keysIn from './keysIn.js';
function forIn(object, iteratee) {
return object == null
? object
- : baseFor(object, baseIteratee(iteratee, 3), keysIn);
+ : baseFor(object, castFunction(iteratee), keysIn);
}
export default forIn;
diff --git a/forInRight.js b/forInRight.js
index a9d3adf2c..cc92970fb 100644
--- a/forInRight.js
+++ b/forInRight.js
@@ -1,5 +1,5 @@
import baseForRight from './_baseForRight.js';
-import baseIteratee from './_baseIteratee.js';
+import castFunction from './_castFunction.js';
import keysIn from './keysIn.js';
/**
@@ -31,7 +31,7 @@ import keysIn from './keysIn.js';
function forInRight(object, iteratee) {
return object == null
? object
- : baseForRight(object, baseIteratee(iteratee, 3), keysIn);
+ : baseForRight(object, castFunction(iteratee), keysIn);
}
export default forInRight;
diff --git a/forOwn.js b/forOwn.js
index fec2df37f..fe661690c 100644
--- a/forOwn.js
+++ b/forOwn.js
@@ -1,5 +1,5 @@
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
@@ -30,7 +30,7 @@ import baseIteratee from './_baseIteratee.js';
* // => Logs 'a' then 'b' (iteration order is not guaranteed).
*/
function forOwn(object, iteratee) {
- return object && baseForOwn(object, baseIteratee(iteratee, 3));
+ return object && baseForOwn(object, castFunction(iteratee));
}
export default forOwn;
diff --git a/forOwnRight.js b/forOwnRight.js
index efe146e58..fe2dd281a 100644
--- a/forOwnRight.js
+++ b/forOwnRight.js
@@ -1,5 +1,5 @@
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
@@ -28,7 +28,7 @@ import baseIteratee from './_baseIteratee.js';
* // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
*/
function forOwnRight(object, iteratee) {
- return object && baseForOwnRight(object, baseIteratee(iteratee, 3));
+ return object && baseForOwnRight(object, castFunction(iteratee));
}
export default forOwnRight;
diff --git a/fromPairs.js b/fromPairs.js
index 3fe428d21..4267cfbdc 100644
--- a/fromPairs.js
+++ b/fromPairs.js
@@ -15,7 +15,7 @@
*/
function fromPairs(pairs) {
var index = -1,
- length = pairs ? pairs.length : 0,
+ length = pairs == null ? 0 : pairs.length,
result = {};
while (++index < length) {
diff --git a/groupBy.js b/groupBy.js
index 610aeaddf..ba83631cb 100644
--- a/groupBy.js
+++ b/groupBy.js
@@ -19,8 +19,7 @@ var hasOwnProperty = objectProto.hasOwnProperty;
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Function} [iteratee=_.identity]
- * The iteratee to transform keys.
+ * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
* @returns {Object} Returns the composed aggregate object.
* @example
*
diff --git a/indexOf.js b/indexOf.js
index 7da26981b..ea3f95961 100644
--- a/indexOf.js
+++ b/indexOf.js
@@ -28,7 +28,7 @@ var nativeMax = Math.max;
* // => 3
*/
function indexOf(array, value, fromIndex) {
- var length = array ? array.length : 0;
+ var length = array == null ? 0 : array.length;
if (!length) {
return -1;
}
diff --git a/initial.js b/initial.js
index d4d51a763..908e5608c 100644
--- a/initial.js
+++ b/initial.js
@@ -15,7 +15,7 @@ import baseSlice from './_baseSlice.js';
* // => [1, 2]
*/
function initial(array) {
- var length = array ? array.length : 0;
+ var length = array == null ? 0 : array.length;
return length ? baseSlice(array, 0, -1) : [];
}
diff --git a/intersectionWith.js b/intersectionWith.js
index 45e93e6a4..79e9424aa 100644
--- a/intersectionWith.js
+++ b/intersectionWith.js
@@ -29,9 +29,8 @@ var intersectionWith = baseRest(function(arrays) {
var comparator = last(arrays),
mapped = arrayMap(arrays, castArrayLikeObject);
- if (comparator === last(mapped)) {
- comparator = undefined;
- } else {
+ comparator = typeof comparator == 'function' ? comparator : undefined;
+ if (comparator) {
mapped.pop();
}
return (mapped.length && mapped[0] === arrays[0])
diff --git a/isBoolean.js b/isBoolean.js
index 3171b2583..883cee97b 100644
--- a/isBoolean.js
+++ b/isBoolean.js
@@ -1,18 +1,9 @@
+import baseGetTag from './_baseGetTag.js';
import isObjectLike from './isObjectLike.js';
/** `Object#toString` result references. */
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.
*
@@ -32,7 +23,7 @@ var objectToString = objectProto.toString;
*/
function isBoolean(value) {
return value === true || value === false ||
- (isObjectLike(value) && objectToString.call(value) == boolTag);
+ (isObjectLike(value) && baseGetTag(value) == boolTag);
}
export default isBoolean;
diff --git a/isElement.js b/isElement.js
index 9ff1ce10a..c79ba5b03 100644
--- a/isElement.js
+++ b/isElement.js
@@ -19,7 +19,7 @@ import isPlainObject from './isPlainObject.js';
* // => false
*/
function isElement(value) {
- return value != null && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value);
+ return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
}
export default isElement;
diff --git a/isEmpty.js b/isEmpty.js
index 9fbccd579..c2e55f8ec 100644
--- a/isEmpty.js
+++ b/isEmpty.js
@@ -51,6 +51,9 @@ var hasOwnProperty = objectProto.hasOwnProperty;
* // => false
*/
function isEmpty(value) {
+ if (value == null) {
+ return true;
+ }
if (isArrayLike(value) &&
(isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
isBuffer(value) || isTypedArray(value) || isArguments(value))) {
diff --git a/isError.js b/isError.js
index 39c986f8c..c57a38bfd 100644
--- a/isError.js
+++ b/isError.js
@@ -1,17 +1,10 @@
+import baseGetTag from './_baseGetTag.js';
import isObjectLike from './isObjectLike.js';
+import isPlainObject from './isPlainObject.js';
/** `Object#toString` result references. */
-var 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;
+var domExcTag = '[object DOMException]',
+ errorTag = '[object Error]';
/**
* Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
@@ -35,8 +28,9 @@ function isError(value) {
if (!isObjectLike(value)) {
return false;
}
- return (objectToString.call(value) == errorTag) ||
- (typeof value.message == 'string' && typeof value.name == 'string');
+ var tag = baseGetTag(value);
+ return tag == errorTag || tag == domExcTag ||
+ (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
}
export default isError;
diff --git a/isFunction.js b/isFunction.js
index f1a819b35..57c133d90 100644
--- a/isFunction.js
+++ b/isFunction.js
@@ -1,20 +1,12 @@
+import baseGetTag from './_baseGetTag.js';
import isObject from './isObject.js';
/** `Object#toString` result references. */
-var funcTag = '[object Function]',
+var asyncTag = '[object AsyncFunction]',
+ funcTag = '[object Function]',
genTag = '[object GeneratorFunction]',
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.
*
@@ -33,10 +25,13 @@ var objectToString = objectProto.toString;
* // => false
*/
function isFunction(value) {
+ if (!isObject(value)) {
+ return false;
+ }
// The use of `Object#toString` avoids issues with the `typeof` operator
- // in Safari 9 which returns 'object' for typed array and other constructors.
- var tag = isObject(value) ? objectToString.call(value) : '';
- return tag == funcTag || tag == genTag || tag == proxyTag;
+ // in Safari 9 which returns 'object' for typed arrays and other constructors.
+ var tag = baseGetTag(value);
+ return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
}
export default isFunction;
diff --git a/isNumber.js b/isNumber.js
index 658fa6a52..8cbdaa6e1 100644
--- a/isNumber.js
+++ b/isNumber.js
@@ -1,18 +1,9 @@
+import baseGetTag from './_baseGetTag.js';
import isObjectLike from './isObjectLike.js';
/** `Object#toString` result references. */
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.
*
@@ -41,7 +32,7 @@ var objectToString = objectProto.toString;
*/
function isNumber(value) {
return typeof value == 'number' ||
- (isObjectLike(value) && objectToString.call(value) == numberTag);
+ (isObjectLike(value) && baseGetTag(value) == numberTag);
}
export default isNumber;
diff --git a/isPlainObject.js b/isPlainObject.js
index a6c81da16..45ec39f2d 100644
--- a/isPlainObject.js
+++ b/isPlainObject.js
@@ -1,3 +1,4 @@
+import baseGetTag from './_baseGetTag.js';
import getPrototype from './_getPrototype.js';
import isObjectLike from './isObjectLike.js';
@@ -17,13 +18,6 @@ var hasOwnProperty = objectProto.hasOwnProperty;
/** Used to infer the `Object` constructor. */
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
* `Object` constructor or one with a `[[Prototype]]` of `null`.
@@ -53,7 +47,7 @@ var objectToString = objectProto.toString;
* // => true
*/
function isPlainObject(value) {
- if (!isObjectLike(value) || objectToString.call(value) != objectTag) {
+ if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
return false;
}
var proto = getPrototype(value);
@@ -61,8 +55,8 @@ function isPlainObject(value) {
return true;
}
var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
- return (typeof Ctor == 'function' &&
- Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString);
+ return typeof Ctor == 'function' && Ctor instanceof Ctor &&
+ funcToString.call(Ctor) == objectCtorString;
}
export default isPlainObject;
diff --git a/isString.js b/isString.js
index 1e8aac7e4..a42295488 100644
--- a/isString.js
+++ b/isString.js
@@ -1,19 +1,10 @@
+import baseGetTag from './_baseGetTag.js';
import isArray from './isArray.js';
import isObjectLike from './isObjectLike.js';
/** `Object#toString` result references. */
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.
*
@@ -33,7 +24,7 @@ var objectToString = objectProto.toString;
*/
function isString(value) {
return typeof value == 'string' ||
- (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag);
+ (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
}
export default isString;
diff --git a/isSymbol.js b/isSymbol.js
index 66cac0520..61702c6e6 100644
--- a/isSymbol.js
+++ b/isSymbol.js
@@ -1,18 +1,9 @@
+import baseGetTag from './_baseGetTag.js';
import isObjectLike from './isObjectLike.js';
/** `Object#toString` result references. */
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.
*
@@ -32,7 +23,7 @@ var objectToString = objectProto.toString;
*/
function isSymbol(value) {
return typeof value == 'symbol' ||
- (isObjectLike(value) && objectToString.call(value) == symbolTag);
+ (isObjectLike(value) && baseGetTag(value) == symbolTag);
}
export default isSymbol;
diff --git a/isWeakSet.js b/isWeakSet.js
index d89f2eea1..69ad22e53 100644
--- a/isWeakSet.js
+++ b/isWeakSet.js
@@ -1,18 +1,9 @@
+import baseGetTag from './_baseGetTag.js';
import isObjectLike from './isObjectLike.js';
/** `Object#toString` result references. */
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.
*
@@ -31,7 +22,7 @@ var objectToString = objectProto.toString;
* // => false
*/
function isWeakSet(value) {
- return isObjectLike(value) && objectToString.call(value) == weakSetTag;
+ return isObjectLike(value) && baseGetTag(value) == weakSetTag;
}
export default isWeakSet;
diff --git a/join.js b/join.js
index 250a2d9dd..61dd65b2a 100644
--- a/join.js
+++ b/join.js
@@ -20,7 +20,7 @@ var nativeJoin = arrayProto.join;
* // => 'a~b~c'
*/
function join(array, separator) {
- return array ? nativeJoin.call(array, separator) : '';
+ return array == null ? '' : nativeJoin.call(array, separator);
}
export default join;
diff --git a/keyBy.js b/keyBy.js
index 561f3f147..334952219 100644
--- a/keyBy.js
+++ b/keyBy.js
@@ -12,8 +12,7 @@ import createAggregator from './_createAggregator.js';
* @since 4.0.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Function} [iteratee=_.identity]
- * The iteratee to transform keys.
+ * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
* @returns {Object} Returns the composed aggregate object.
* @example
*
diff --git a/last.js b/last.js
index 16ef297bc..b4135f703 100644
--- a/last.js
+++ b/last.js
@@ -13,7 +13,7 @@
* // => 3
*/
function last(array) {
- var length = array ? array.length : 0;
+ var length = array == null ? 0 : array.length;
return length ? array[length - 1] : undefined;
}
diff --git a/lastIndexOf.js b/lastIndexOf.js
index edd01a4e9..bf6eac8c4 100644
--- a/lastIndexOf.js
+++ b/lastIndexOf.js
@@ -29,7 +29,7 @@ var nativeMax = Math.max,
* // => 1
*/
function lastIndexOf(array, value, fromIndex) {
- var length = array ? array.length : 0;
+ var length = array == null ? 0 : array.length;
if (!length) {
return -1;
}
diff --git a/lodash.default.js b/lodash.default.js
index 995eca22f..ec38361dd 100644
--- a/lodash.default.js
+++ b/lodash.default.js
@@ -2,7 +2,7 @@
* @license
* lodash (Custom Build)
* Build: `lodash modularize exports="es" -o ./`
- * Copyright jQuery Foundation and other contributors
+ * Copyright JS Foundation and other contributors
* Released under MIT license
* Based on Underscore.js 1.8.3
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
@@ -45,7 +45,7 @@ import toInteger from './toInteger.js';
import lodash from './wrapperLodash.js';
/** Used as the semantic version number. */
-var VERSION = '4.16.4';
+var VERSION = '4.16.5';
/** Used to compose bitmasks for function metadata. */
var BIND_KEY_FLAG = 2;
@@ -65,7 +65,7 @@ var arrayProto = Array.prototype,
var hasOwnProperty = objectProto.hasOwnProperty;
/** Built-in value references. */
-var iteratorSymbol = Symbol ? Symbol.iterator : undefined;
+var symIterator = Symbol ? Symbol.iterator : undefined;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax = Math.max,
@@ -636,8 +636,8 @@ lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = se
// Add lazy aliases.
lodash.prototype.first = lodash.prototype.head;
-if (iteratorSymbol) {
- lodash.prototype[iteratorSymbol] = seq.toIterator;
+if (symIterator) {
+ lodash.prototype[symIterator] = seq.toIterator;
}
export default lodash;
diff --git a/lodash.js b/lodash.js
index c02d382d5..ee47962da 100644
--- a/lodash.js
+++ b/lodash.js
@@ -2,7 +2,7 @@
* @license
* lodash (Custom Build)
* Build: `lodash modularize exports="es" -o ./`
- * Copyright jQuery Foundation and other contributors
+ * Copyright JS Foundation and other contributors
* Released under MIT license
* Based on Underscore.js 1.8.3
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
diff --git a/memoize.js b/memoize.js
index 8889a56bc..41a1615ab 100644
--- a/memoize.js
+++ b/memoize.js
@@ -14,7 +14,7 @@ var FUNC_ERROR_TEXT = 'Expected a function';
* function. Its creation may be customized by replacing the `_.memoize.Cache`
* constructor with one whose instances implement the
* [`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
* @memberOf _
@@ -48,7 +48,7 @@ var FUNC_ERROR_TEXT = 'Expected a function';
* _.memoize.Cache = WeakMap;
*/
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);
}
var memoized = function() {
diff --git a/package.json b/package.json
index 6a5e709f9..3007767fe 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "lodash-es",
- "version": "4.16.4",
+ "version": "4.16.5",
"description": "Lodash exported as ES modules.",
"keywords": "es6, modules, stdlib, util",
"homepage": "https://lodash.com/custom-builds",
diff --git a/pullAllBy.js b/pullAllBy.js
index b98c973fd..2f9e41573 100644
--- a/pullAllBy.js
+++ b/pullAllBy.js
@@ -14,8 +14,7 @@ import basePullAll from './_basePullAll.js';
* @category Array
* @param {Array} array The array to modify.
* @param {Array} values The values to remove.
- * @param {Function} [iteratee=_.identity]
- * The iteratee invoked per element.
+ * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
* @returns {Array} Returns `array`.
* @example
*
diff --git a/pullAt.js b/pullAt.js
index 1b84fe25e..23213c73a 100644
--- a/pullAt.js
+++ b/pullAt.js
@@ -30,7 +30,7 @@ import isIndex from './_isIndex.js';
* // => ['b', 'd']
*/
var pullAt = flatRest(function(array, indexes) {
- var length = array ? array.length : 0,
+ var length = array == null ? 0 : array.length,
result = baseAt(array, indexes);
basePullAt(array, arrayMap(indexes, function(index) {
diff --git a/remove.js b/remove.js
index 631249724..c1e775f10 100644
--- a/remove.js
+++ b/remove.js
@@ -14,8 +14,7 @@ import basePullAt from './_basePullAt.js';
* @since 2.0.0
* @category Array
* @param {Array} array The array to modify.
- * @param {Function} [predicate=_.identity]
- * The function invoked per iteration.
+ * @param {Function} [predicate=_.identity] The function invoked per iteration.
* @returns {Array} Returns the new array of removed elements.
* @example
*
diff --git a/reverse.js b/reverse.js
index 59779480d..33156a237 100644
--- a/reverse.js
+++ b/reverse.js
@@ -28,7 +28,7 @@ var nativeReverse = arrayProto.reverse;
* // => [3, 2, 1]
*/
function reverse(array) {
- return array ? nativeReverse.call(array) : array;
+ return array == null ? array : nativeReverse.call(array);
}
export default reverse;
diff --git a/slice.js b/slice.js
index f8ca0bdb3..02d03d7ea 100644
--- a/slice.js
+++ b/slice.js
@@ -19,7 +19,7 @@ import toInteger from './toInteger.js';
* @returns {Array} Returns the slice of `array`.
*/
function slice(array, start, end) {
- var length = array ? array.length : 0;
+ var length = array == null ? 0 : array.length;
if (!length) {
return [];
}
diff --git a/sortedIndexBy.js b/sortedIndexBy.js
index dc42fb081..b5ee6db89 100644
--- a/sortedIndexBy.js
+++ b/sortedIndexBy.js
@@ -12,8 +12,7 @@ import baseSortedIndexBy from './_baseSortedIndexBy.js';
* @category Array
* @param {Array} array The sorted array to inspect.
* @param {*} value The value to evaluate.
- * @param {Function} [iteratee=_.identity]
- * The iteratee invoked per element.
+ * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
* @returns {number} Returns the index at which `value` should be inserted
* into `array`.
* @example
diff --git a/sortedIndexOf.js b/sortedIndexOf.js
index 49ea3763f..f9410d79a 100644
--- a/sortedIndexOf.js
+++ b/sortedIndexOf.js
@@ -18,7 +18,7 @@ import eq from './eq.js';
* // => 1
*/
function sortedIndexOf(array, value) {
- var length = array ? array.length : 0;
+ var length = array == null ? 0 : array.length;
if (length) {
var index = baseSortedIndex(array, value);
if (index < length && eq(array[index], value)) {
diff --git a/sortedLastIndexBy.js b/sortedLastIndexBy.js
index e7752327a..bb84f81b0 100644
--- a/sortedLastIndexBy.js
+++ b/sortedLastIndexBy.js
@@ -12,8 +12,7 @@ import baseSortedIndexBy from './_baseSortedIndexBy.js';
* @category Array
* @param {Array} array The sorted array to inspect.
* @param {*} value The value to evaluate.
- * @param {Function} [iteratee=_.identity]
- * The iteratee invoked per element.
+ * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
* @returns {number} Returns the index at which `value` should be inserted
* into `array`.
* @example
diff --git a/sortedLastIndexOf.js b/sortedLastIndexOf.js
index f9738385e..802ebe4fa 100644
--- a/sortedLastIndexOf.js
+++ b/sortedLastIndexOf.js
@@ -18,7 +18,7 @@ import eq from './eq.js';
* // => 3
*/
function sortedLastIndexOf(array, value) {
- var length = array ? array.length : 0;
+ var length = array == null ? 0 : array.length;
if (length) {
var index = baseSortedIndex(array, value, true) - 1;
if (eq(array[index], value)) {
diff --git a/tail.js b/tail.js
index 93c5f7dd3..d8b979616 100644
--- a/tail.js
+++ b/tail.js
@@ -15,7 +15,7 @@ import baseSlice from './_baseSlice.js';
* // => [2, 3]
*/
function tail(array) {
- var length = array ? array.length : 0;
+ var length = array == null ? 0 : array.length;
return length ? baseSlice(array, 1, length) : [];
}
diff --git a/takeRight.js b/takeRight.js
index c7ed8da89..36399de8e 100644
--- a/takeRight.js
+++ b/takeRight.js
@@ -27,7 +27,7 @@ import toInteger from './toInteger.js';
* // => []
*/
function takeRight(array, n, guard) {
- var length = array ? array.length : 0;
+ var length = array == null ? 0 : array.length;
if (!length) {
return [];
}
diff --git a/takeRightWhile.js b/takeRightWhile.js
index fe234db13..642454336 100644
--- a/takeRightWhile.js
+++ b/takeRightWhile.js
@@ -11,8 +11,7 @@ import baseWhile from './_baseWhile.js';
* @since 3.0.0
* @category Array
* @param {Array} array The array to query.
- * @param {Function} [predicate=_.identity]
- * The function invoked per iteration.
+ * @param {Function} [predicate=_.identity] The function invoked per iteration.
* @returns {Array} Returns the slice of `array`.
* @example
*
diff --git a/takeWhile.js b/takeWhile.js
index cacb766cd..a1a794d1b 100644
--- a/takeWhile.js
+++ b/takeWhile.js
@@ -11,8 +11,7 @@ import baseWhile from './_baseWhile.js';
* @since 3.0.0
* @category Array
* @param {Array} array The array to query.
- * @param {Function} [predicate=_.identity]
- * The function invoked per iteration.
+ * @param {Function} [predicate=_.identity] The function invoked per iteration.
* @returns {Array} Returns the slice of `array`.
* @example
*
diff --git a/times.js b/times.js
index 4466e7004..910c9264a 100644
--- a/times.js
+++ b/times.js
@@ -1,5 +1,5 @@
-import baseIteratee from './_baseIteratee.js';
import baseTimes from './_baseTimes.js';
+import castFunction from './_castFunction.js';
import toInteger from './toInteger.js';
/** Used as references for various `Number` constants. */
@@ -38,7 +38,7 @@ function times(n, iteratee) {
var index = MAX_ARRAY_LENGTH,
length = nativeMin(n, MAX_ARRAY_LENGTH);
- iteratee = baseIteratee(iteratee);
+ iteratee = castFunction(iteratee);
n -= MAX_ARRAY_LENGTH;
var result = baseTimes(length, iteratee);
diff --git a/toArray.js b/toArray.js
index 9fcc1273b..5afa02854 100644
--- a/toArray.js
+++ b/toArray.js
@@ -14,7 +14,7 @@ var mapTag = '[object Map]',
setTag = '[object Set]';
/** Built-in value references. */
-var iteratorSymbol = Symbol ? Symbol.iterator : undefined;
+var symIterator = Symbol ? Symbol.iterator : undefined;
/**
* Converts `value` to an array.
@@ -46,8 +46,8 @@ function toArray(value) {
if (isArrayLike(value)) {
return isString(value) ? stringToArray(value) : copyArray(value);
}
- if (iteratorSymbol && value[iteratorSymbol]) {
- return iteratorToArray(value[iteratorSymbol]());
+ if (symIterator && value[symIterator]) {
+ return iteratorToArray(value[symIterator]());
}
var tag = getTag(value),
func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
diff --git a/unionBy.js b/unionBy.js
index 5a2451ee6..53651b1eb 100644
--- a/unionBy.js
+++ b/unionBy.js
@@ -17,8 +17,7 @@ import last from './last.js';
* @since 4.0.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
- * @param {Function} [iteratee=_.identity]
- * The iteratee invoked per element.
+ * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
* @returns {Array} Returns the new array of combined values.
* @example
*
diff --git a/unionWith.js b/unionWith.js
index ff690d113..54cafe1cd 100644
--- a/unionWith.js
+++ b/unionWith.js
@@ -27,9 +27,7 @@ import last from './last.js';
*/
var unionWith = baseRest(function(arrays) {
var comparator = last(arrays);
- if (isArrayLikeObject(comparator)) {
- comparator = undefined;
- }
+ comparator = typeof comparator == 'function' ? comparator : undefined;
return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
});
diff --git a/uniq.js b/uniq.js
index ec7a90afd..28f56e688 100644
--- a/uniq.js
+++ b/uniq.js
@@ -19,9 +19,7 @@ import baseUniq from './_baseUniq.js';
* // => [2, 1]
*/
function uniq(array) {
- return (array && array.length)
- ? baseUniq(array)
- : [];
+ return (array && array.length) ? baseUniq(array) : [];
}
export default uniq;
diff --git a/uniqBy.js b/uniqBy.js
index e4c124f7f..e08603d24 100644
--- a/uniqBy.js
+++ b/uniqBy.js
@@ -13,8 +13,7 @@ import baseUniq from './_baseUniq.js';
* @since 4.0.0
* @category Array
* @param {Array} array The array to inspect.
- * @param {Function} [iteratee=_.identity]
- * The iteratee invoked per element.
+ * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
* @returns {Array} Returns the new duplicate free array.
* @example
*
@@ -26,9 +25,7 @@ import baseUniq from './_baseUniq.js';
* // => [{ 'x': 1 }, { 'x': 2 }]
*/
function uniqBy(array, iteratee) {
- return (array && array.length)
- ? baseUniq(array, baseIteratee(iteratee, 2))
- : [];
+ return (array && array.length) ? baseUniq(array, baseIteratee(iteratee, 2)) : [];
}
export default uniqBy;
diff --git a/uniqWith.js b/uniqWith.js
index 437f3860f..4b508a387 100644
--- a/uniqWith.js
+++ b/uniqWith.js
@@ -21,9 +21,8 @@ import baseUniq from './_baseUniq.js';
* // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
*/
function uniqWith(array, comparator) {
- return (array && array.length)
- ? baseUniq(array, undefined, comparator)
- : [];
+ comparator = typeof comparator == 'function' ? comparator : undefined;
+ return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
}
export default uniqWith;
diff --git a/values.js b/values.js
index d693d7d42..b247b3680 100644
--- a/values.js
+++ b/values.js
@@ -28,7 +28,7 @@ import keys from './keys.js';
* // => ['h', 'i']
*/
function values(object) {
- return object ? baseValues(object, keys(object)) : [];
+ return object == null ? [] : baseValues(object, keys(object));
}
export default values;
diff --git a/wrap.js b/wrap.js
index 2612efebc..5faa210dc 100644
--- a/wrap.js
+++ b/wrap.js
@@ -1,4 +1,4 @@
-import identity from './identity.js';
+import castFunction from './_castFunction.js';
import partial from './partial.js';
/**
@@ -24,8 +24,7 @@ import partial from './partial.js';
* // => 'fred, barney, & pebbles
'
*/
function wrap(value, wrapper) {
- wrapper = wrapper == null ? identity : wrapper;
- return partial(wrapper, value);
+ return partial(castFunction(wrapper), value);
}
export default wrap;
diff --git a/xorBy.js b/xorBy.js
index b2053e79b..f21d8ad91 100644
--- a/xorBy.js
+++ b/xorBy.js
@@ -17,8 +17,7 @@ import last from './last.js';
* @since 4.0.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
- * @param {Function} [iteratee=_.identity]
- * The iteratee invoked per element.
+ * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
* @returns {Array} Returns the new array of filtered values.
* @example
*
diff --git a/xorWith.js b/xorWith.js
index 6815283dd..b24e98b26 100644
--- a/xorWith.js
+++ b/xorWith.js
@@ -27,9 +27,7 @@ import last from './last.js';
*/
var xorWith = baseRest(function(arrays) {
var comparator = last(arrays);
- if (isArrayLikeObject(comparator)) {
- comparator = undefined;
- }
+ comparator = typeof comparator == 'function' ? comparator : undefined;
return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
});
diff --git a/zipWith.js b/zipWith.js
index 03312e1b1..fe9d7a2e6 100644
--- a/zipWith.js
+++ b/zipWith.js
@@ -11,7 +11,8 @@ import unzipWith from './unzipWith.js';
* @since 3.8.0
* @category Array
* @param {...Array} [arrays] The arrays to process.
- * @param {Function} [iteratee=_.identity] The function to combine grouped values.
+ * @param {Function} [iteratee=_.identity] The function to combine
+ * grouped values.
* @returns {Array} Returns the new array of grouped elements.
* @example
*