diff --git a/src/.internal/ListCache.ts b/src/.internal/ListCache.ts index f3015ddb1..5473945b6 100644 --- a/src/.internal/ListCache.ts +++ b/src/.internal/ListCache.ts @@ -45,7 +45,7 @@ class ListCache { return false } const lastIndex = data.length - 1 - if (index == lastIndex) { + if (index === lastIndex) { data.pop() } else { data.splice(index, 1) diff --git a/src/.internal/MapCache.ts b/src/.internal/MapCache.ts index 706e17e13..d031ff14e 100644 --- a/src/.internal/MapCache.ts +++ b/src/.internal/MapCache.ts @@ -112,7 +112,7 @@ class MapCache { const size = data.size data.set(key, value) - this.size += data.size == size ? 0 : 1 + this.size += data.size === size ? 0 : 1 return this } } diff --git a/src/.internal/baseAssignValue.ts b/src/.internal/baseAssignValue.ts index 7b630c321..43eeed4fd 100644 --- a/src/.internal/baseAssignValue.ts +++ b/src/.internal/baseAssignValue.ts @@ -8,7 +8,7 @@ * @param {*} value The value to assign. */ function baseAssignValue(object, key, value) { - if (key == '__proto__') { + if (key === '__proto__') { Object.defineProperty(object, key, { 'configurable': true, 'enumerable': true, diff --git a/src/.internal/baseClone.ts b/src/.internal/baseClone.ts index a7157e114..9b8f773f7 100644 --- a/src/.internal/baseClone.ts +++ b/src/.internal/baseClone.ts @@ -182,7 +182,7 @@ function baseClone(value, bitmask, customizer, key, object, stack) { if (isBuffer(value)) { return cloneBuffer(value, isDeep) } - if (tag == objectTag || tag == argsTag || (isFunc && !object)) { + if (tag === objectTag || tag === argsTag || (isFunc && !object)) { result = (isFlat || isFunc) ? {} : initCloneObject(value) if (!isDeep) { return isFlat @@ -204,14 +204,14 @@ function baseClone(value, bitmask, customizer, key, object, stack) { } stack.set(value, result) - if (tag == mapTag) { + if (tag === mapTag) { value.forEach((subValue, key) => { result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack)) }) return result } - if (tag == setTag) { + if (tag === setTag) { value.forEach((subValue) => { result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)) }) diff --git a/src/.internal/baseGet.ts b/src/.internal/baseGet.ts index d0bc3d43c..ebbeff64a 100644 --- a/src/.internal/baseGet.ts +++ b/src/.internal/baseGet.ts @@ -18,7 +18,7 @@ function baseGet(object, path) { while (object != null && index < length) { object = object[toKey(path[index++])] } - return (index && index == length) ? object : undefined + return (index && index === length) ? object : undefined } export default baseGet diff --git a/src/.internal/baseIsEqualDeep.ts b/src/.internal/baseIsEqualDeep.ts index 27749cd01..4c1fe2a9d 100644 --- a/src/.internal/baseIsEqualDeep.ts +++ b/src/.internal/baseIsEqualDeep.ts @@ -37,12 +37,12 @@ function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { let objTag = objIsArr ? arrayTag : getTag(object) let othTag = othIsArr ? arrayTag : getTag(other) - objTag = objTag == argsTag ? objectTag : objTag - othTag = othTag == argsTag ? objectTag : othTag + objTag = objTag === argsTag ? objectTag : objTag + othTag = othTag === argsTag ? objectTag : othTag - let objIsObj = objTag == objectTag - const othIsObj = othTag == objectTag - const isSameTag = objTag == othTag + let objIsObj = objTag === objectTag + const othIsObj = othTag === objectTag + const isSameTag = objTag === othTag if (isSameTag && isBuffer(object)) { if (!isBuffer(other)) { diff --git a/src/.internal/baseSet.ts b/src/.internal/baseSet.ts index 92bad879f..a1de66f34 100644 --- a/src/.internal/baseSet.ts +++ b/src/.internal/baseSet.ts @@ -30,7 +30,7 @@ function baseSet(object, path, value, customizer) { const key = toKey(path[index]) let newValue = value - if (index != lastIndex) { + if (index !== lastIndex) { const objValue = nested[key] newValue = customizer ? customizer(objValue, key, nested) : undefined if (newValue === undefined) { diff --git a/src/.internal/baseSortedIndexBy.ts b/src/.internal/baseSortedIndexBy.ts index 4f3f84913..98be104a1 100644 --- a/src/.internal/baseSortedIndexBy.ts +++ b/src/.internal/baseSortedIndexBy.ts @@ -20,7 +20,7 @@ const MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1 function baseSortedIndexBy(array, value, iteratee, retHighest) { let low = 0 let high = array == null ? 0 : array.length - if (high == 0) { + if (high === 0) { return 0 } diff --git a/src/.internal/baseXor.ts b/src/.internal/baseXor.ts index 41493ac6f..6d5f1b3a7 100644 --- a/src/.internal/baseXor.ts +++ b/src/.internal/baseXor.ts @@ -25,7 +25,7 @@ function baseXor(arrays, iteratee, comparator) { let othIndex = -1 while (++othIndex < length) { - if (othIndex != index) { + if (othIndex !== index) { result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator) } } diff --git a/src/.internal/compareMultiple.ts b/src/.internal/compareMultiple.ts index 0d9fc2d87..18e8444d9 100644 --- a/src/.internal/compareMultiple.ts +++ b/src/.internal/compareMultiple.ts @@ -27,7 +27,7 @@ function compareMultiple(object, other, orders) { const result = cmpFn(objCriteria[index], othCriteria[index]) if (result) { if (order && typeof order !== 'function') { - return result * (order == 'desc' ? -1 : 1) + return result * (order === 'desc' ? -1 : 1) } return result } diff --git a/src/.internal/createSet.ts b/src/.internal/createSet.ts index 0e86dc5c7..e351c348d 100644 --- a/src/.internal/createSet.ts +++ b/src/.internal/createSet.ts @@ -10,7 +10,7 @@ const INFINITY = 1 / 0 * @param {Array} values The values to add to the set. * @returns {Object} Returns the new set. */ -const createSet = (Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) +const createSet = (Set && (1 / setToArray(new Set([,-0]))[1]) === INFINITY) ? (values) => new Set(values) : () => {} diff --git a/src/.internal/equalArrays.ts b/src/.internal/equalArrays.ts index fac53cbfd..29bd0f494 100644 --- a/src/.internal/equalArrays.ts +++ b/src/.internal/equalArrays.ts @@ -24,13 +24,13 @@ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { const arrLength = array.length const othLength = other.length - if (arrLength != othLength && !(isPartial && othLength > arrLength)) { + if (arrLength !== othLength && !(isPartial && othLength > arrLength)) { return false } // Assume cyclic values are equal. const stacked = stack.get(array) if (stacked && stack.get(other)) { - return stacked == other + return stacked === other } let index = -1 let result = true diff --git a/src/.internal/equalByTag.ts b/src/.internal/equalByTag.ts index fd8f80c9d..e909f4774 100644 --- a/src/.internal/equalByTag.ts +++ b/src/.internal/equalByTag.ts @@ -44,15 +44,15 @@ const symbolValueOf = Symbol.prototype.valueOf function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { switch (tag) { case dataViewTag: - if ((object.byteLength != other.byteLength) || - (object.byteOffset != other.byteOffset)) { + if ((object.byteLength !== other.byteLength) || + (object.byteOffset !== other.byteOffset)) { return false } object = object.buffer other = other.buffer case arrayBufferTag: - if ((object.byteLength != other.byteLength) || + if ((object.byteLength !== other.byteLength) || !equalFunc(new Uint8Array(object), new Uint8Array(other))) { return false } @@ -66,14 +66,14 @@ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { return eq(+object, +other) case errorTag: - return object.name == other.name && object.message == other.message + return object.name === other.name && object.message === other.message case regexpTag: case stringTag: // Coerce regexes to strings and treat strings, primitives and objects, // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring // for more details. - return object == `${other}` + return object === `${other}` case mapTag: let convert = mapToArray @@ -82,13 +82,13 @@ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { const isPartial = bitmask & COMPARE_PARTIAL_FLAG convert || (convert = setToArray) - if (object.size != other.size && !isPartial) { + if (object.size !== other.size && !isPartial) { return false } // Assume cyclic values are equal. const stacked = stack.get(object) if (stacked) { - return stacked == other + return stacked === other } bitmask |= COMPARE_UNORDERED_FLAG @@ -100,7 +100,7 @@ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { case symbolTag: if (symbolValueOf) { - return symbolValueOf.call(object) == symbolValueOf.call(other) + return symbolValueOf.call(object) === symbolValueOf.call(other) } } return false diff --git a/src/.internal/equalObjects.ts b/src/.internal/equalObjects.ts index 8b884cd94..54e2f0328 100644 --- a/src/.internal/equalObjects.ts +++ b/src/.internal/equalObjects.ts @@ -26,7 +26,7 @@ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { const othProps = getAllKeys(other) const othLength = othProps.length - if (objLength != othLength && !isPartial) { + if (objLength !== othLength && !isPartial) { return false } let key @@ -40,7 +40,7 @@ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { // Assume cyclic values are equal. const stacked = stack.get(object) if (stacked && stack.get(other)) { - return stacked == other + return stacked === other } let result = true stack.set(object, other) @@ -66,14 +66,14 @@ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { result = false break } - skipCtor || (skipCtor = key == 'constructor') + skipCtor || (skipCtor = key === 'constructor') } if (result && !skipCtor) { const objCtor = object.constructor const othCtor = other.constructor // Non `Object` object instances with different constructors are not equal. - if (objCtor != othCtor && + if (objCtor !== othCtor && ('constructor' in object && 'constructor' in other) && !(typeof objCtor === 'function' && objCtor instanceof objCtor && typeof othCtor === 'function' && othCtor instanceof othCtor)) { diff --git a/src/.internal/isIndex.ts b/src/.internal/isIndex.ts index 641a0f84a..bc3e3dc91 100644 --- a/src/.internal/isIndex.ts +++ b/src/.internal/isIndex.ts @@ -19,7 +19,7 @@ function isIndex(value, length) { return !!length && (type === 'number' || (type !== 'symbol' && reIsUint.test(value))) && - (value > -1 && value % 1 == 0 && value < length) + (value > -1 && value % 1 === 0 && value < length) } export default isIndex diff --git a/src/.internal/root.ts b/src/.internal/root.ts index 58abec6ea..8c57513af 100644 --- a/src/.internal/root.ts +++ b/src/.internal/root.ts @@ -2,7 +2,7 @@ import freeGlobal from './freeGlobal.js' /** Detect free variable `globalThis` */ -const freeGlobalThis = typeof globalThis === 'object' && globalThis !== null && globalThis.Object == Object && globalThis +const freeGlobalThis = typeof globalThis === 'object' && globalThis !== null && globalThis.Object === Object && globalThis /** Detect free variable `self`. */ const freeSelf = typeof self === 'object' && self !== null && self.Object === Object && self diff --git a/src/.internal/toKey.ts b/src/.internal/toKey.ts index cc450c80d..db002e3a0 100644 --- a/src/.internal/toKey.ts +++ b/src/.internal/toKey.ts @@ -15,7 +15,7 @@ function toKey(value) { return value } const result = `${value}` - return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result + return (result === '0' && (1 / value) === -INFINITY) ? '-0' : result } export default toKey diff --git a/src/endsWith.ts b/src/endsWith.ts index c19cba674..e900d8887 100644 --- a/src/endsWith.ts +++ b/src/endsWith.ts @@ -23,14 +23,14 @@ function endsWith(string, target, position) { const { length } = string; position = position === undefined ? length : +position; - if (position < 0 || position != position) { + if (position < 0 || position !== position) { position = 0; } else if (position > length) { position = length; } const end = position; position -= target.length; - return position >= 0 && string.slice(position, end) == target; + return position >= 0 && string.slice(position, end) === target; } export default endsWith; diff --git a/src/findLast.ts b/src/findLast.ts index 29feecb8f..c57d1875d 100644 --- a/src/findLast.ts +++ b/src/findLast.ts @@ -14,7 +14,7 @@ import isArrayLike from './isArrayLike.js'; * @see find, findIndex, findKey, findLastIndex, findLastKey * @example * - * findLast([1, 2, 3, 4], n => n % 2 == 1) + * findLast([1, 2, 3, 4], n => n % 2 === 1) * // => 3 */ function findLast(collection, predicate, fromIndex) { diff --git a/src/findLastIndex.ts b/src/findLastIndex.ts index a1d09bd0e..9b0b844d1 100644 --- a/src/findLastIndex.ts +++ b/src/findLastIndex.ts @@ -20,7 +20,7 @@ import toInteger from './toInteger.js'; * { 'user': 'pebbles', 'active': false } * ] * - * findLastIndex(users, ({ user }) => user == 'pebbles') + * findLastIndex(users, ({ user }) => user === 'pebbles') * // => 2 */ function findLastIndex(array, predicate, fromIndex) { diff --git a/src/hasPath.ts b/src/hasPath.ts index ec2337bf9..49f048f43 100644 --- a/src/hasPath.ts +++ b/src/hasPath.ts @@ -42,7 +42,7 @@ function hasPath(object, path) { } object = object[key]; } - if (result || ++index != length) { + if (result || ++index !== length) { return result; } length = object == null ? 0 : object.length; diff --git a/src/hasPathIn.ts b/src/hasPathIn.ts index 98166aadb..4533df57d 100644 --- a/src/hasPathIn.ts +++ b/src/hasPathIn.ts @@ -39,7 +39,7 @@ function hasPathIn(object, path) { } object = object[key]; } - if (result || ++index != length) { + if (result || ++index !== length) { return result; } length = object == null ? 0 : object.length; diff --git a/src/isArguments.ts b/src/isArguments.ts index 3746c4c61..d5bbd074d 100644 --- a/src/isArguments.ts +++ b/src/isArguments.ts @@ -17,7 +17,7 @@ import isObjectLike from './isObjectLike.js'; * // => false */ function isArguments(value) { - return isObjectLike(value) && getTag(value) == '[object Arguments]'; + return isObjectLike(value) && getTag(value) === '[object Arguments]'; } export default isArguments; diff --git a/src/isArrayBuffer.ts b/src/isArrayBuffer.ts index 20fdf9ca2..5b81958d7 100644 --- a/src/isArrayBuffer.ts +++ b/src/isArrayBuffer.ts @@ -22,6 +22,6 @@ const nodeIsArrayBuffer = nodeTypes && nodeTypes.isArrayBuffer; */ const isArrayBuffer = nodeIsArrayBuffer ? (value) => nodeIsArrayBuffer(value) - : (value) => isObjectLike(value) && getTag(value) == '[object ArrayBuffer]'; + : (value) => isObjectLike(value) && getTag(value) === '[object ArrayBuffer]'; export default isArrayBuffer; diff --git a/src/isBoolean.ts b/src/isBoolean.ts index e1004de41..328b09f18 100644 --- a/src/isBoolean.ts +++ b/src/isBoolean.ts @@ -20,7 +20,7 @@ function isBoolean(value) { return ( value === true || value === false || - (isObjectLike(value) && getTag(value) == '[object Boolean]') + (isObjectLike(value) && getTag(value) === '[object Boolean]') ); } diff --git a/src/isDate.ts b/src/isDate.ts index 8c81d4653..a68c82afa 100644 --- a/src/isDate.ts +++ b/src/isDate.ts @@ -22,6 +22,6 @@ const nodeIsDate = nodeTypes && nodeTypes.isDate; */ const isDate = nodeIsDate ? (value) => nodeIsDate(value) - : (value) => isObjectLike(value) && getTag(value) == '[object Date]'; + : (value) => isObjectLike(value) && getTag(value) === '[object Date]'; export default isDate; diff --git a/src/isEmpty.ts b/src/isEmpty.ts index c5f40f26b..ca9afa356 100644 --- a/src/isEmpty.ts +++ b/src/isEmpty.ts @@ -58,7 +58,7 @@ function isEmpty(value) { return !value.length; } const tag = getTag(value); - if (tag == '[object Map]' || tag == '[object Set]') { + if (tag === '[object Map]' || tag === '[object Set]') { return !value.size; } if (isPrototype(value)) { diff --git a/src/isError.ts b/src/isError.ts index c8297c879..34a0b2770 100644 --- a/src/isError.ts +++ b/src/isError.ts @@ -24,8 +24,8 @@ function isError(value) { } const tag = getTag(value); return ( - tag == '[object Error]' || - tag == '[object DOMException]' || + tag === '[object Error]' || + tag === '[object DOMException]' || (typeof value.message === 'string' && typeof value.name === 'string' && !isPlainObject(value)) diff --git a/src/isLength.ts b/src/isLength.ts index 224964857..2f0b0fde4 100644 --- a/src/isLength.ts +++ b/src/isLength.ts @@ -26,7 +26,7 @@ const MAX_SAFE_INTEGER = 9007199254740991; * // => false */ function isLength(value) { - return typeof value === 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + return typeof value === 'number' && value > -1 && value % 1 === 0 && value <= MAX_SAFE_INTEGER; } export default isLength; diff --git a/src/isMap.ts b/src/isMap.ts index 63bcd1d0e..39fa07095 100644 --- a/src/isMap.ts +++ b/src/isMap.ts @@ -22,6 +22,6 @@ const nodeIsMap = nodeTypes && nodeTypes.isMap; */ const isMap = nodeIsMap ? (value) => nodeIsMap(value) - : (value) => isObjectLike(value) && getTag(value) == '[object Map]'; + : (value) => isObjectLike(value) && getTag(value) === '[object Map]'; export default isMap; diff --git a/src/isNumber.ts b/src/isNumber.ts index 366a1786f..5276c7602 100644 --- a/src/isNumber.ts +++ b/src/isNumber.ts @@ -27,7 +27,9 @@ import isObjectLike from './isObjectLike.js'; * // => false */ function isNumber(value) { - return typeof value === 'number' || (isObjectLike(value) && getTag(value) == '[object Number]'); + return ( + typeof value === 'number' || (isObjectLike(value) && getTag(value) === '[object Number]') + ); } export default isNumber; diff --git a/src/isPlainObject.ts b/src/isPlainObject.ts index 975a295d0..dfcf0365c 100644 --- a/src/isPlainObject.ts +++ b/src/isPlainObject.ts @@ -28,7 +28,7 @@ import isObjectLike from './isObjectLike.js'; * // => true */ function isPlainObject(value) { - if (!isObjectLike(value) || getTag(value) != '[object Object]') { + if (!isObjectLike(value) || getTag(value) !== '[object Object]') { return false; } if (Object.getPrototypeOf(value) === null) { diff --git a/src/isRegExp.ts b/src/isRegExp.ts index c1f3364cf..773506621 100644 --- a/src/isRegExp.ts +++ b/src/isRegExp.ts @@ -22,6 +22,6 @@ const nodeIsRegExp = nodeTypes && nodeTypes.isRegExp; */ const isRegExp = nodeIsRegExp ? (value) => nodeIsRegExp(value) - : (value) => isObjectLike(value) && getTag(value) == '[object RegExp]'; + : (value) => isObjectLike(value) && getTag(value) === '[object RegExp]'; export default isRegExp; diff --git a/src/isSet.ts b/src/isSet.ts index 51be99008..67c286287 100644 --- a/src/isSet.ts +++ b/src/isSet.ts @@ -22,6 +22,6 @@ const nodeIsSet = nodeTypes && nodeTypes.isSet; */ const isSet = nodeIsSet ? (value) => nodeIsSet(value) - : (value) => isObjectLike(value) && getTag(value) == '[object Set]'; + : (value) => isObjectLike(value) && getTag(value) === '[object Set]'; export default isSet; diff --git a/src/isString.ts b/src/isString.ts index 9a33d8c73..9b7c6b566 100644 --- a/src/isString.ts +++ b/src/isString.ts @@ -22,7 +22,7 @@ function isString(value) { (type === 'object' && value != null && !Array.isArray(value) && - getTag(value) == '[object String]') + getTag(value) === '[object String]') ); } diff --git a/src/isSymbol.ts b/src/isSymbol.ts index ed247c835..859e47a4d 100644 --- a/src/isSymbol.ts +++ b/src/isSymbol.ts @@ -18,8 +18,8 @@ import getTag from './.internal/getTag.js'; function isSymbol(value) { const type = typeof value; return ( - type == 'symbol' || - (type === 'object' && value != null && getTag(value) == '[object Symbol]') + type === 'symbol' || + (type === 'object' && value != null && getTag(value) === '[object Symbol]') ); } diff --git a/src/isWeakMap.ts b/src/isWeakMap.ts index 5a7c9637c..c5a4a231d 100644 --- a/src/isWeakMap.ts +++ b/src/isWeakMap.ts @@ -17,7 +17,7 @@ import isObjectLike from './isObjectLike.js'; * // => false */ function isWeakMap(value) { - return isObjectLike(value) && getTag(value) == '[object WeakMap]'; + return isObjectLike(value) && getTag(value) === '[object WeakMap]'; } export default isWeakMap; diff --git a/src/isWeakSet.ts b/src/isWeakSet.ts index 90e83b34a..5995369b7 100644 --- a/src/isWeakSet.ts +++ b/src/isWeakSet.ts @@ -17,7 +17,7 @@ import isObjectLike from './isObjectLike.js'; * // => false */ function isWeakSet(value) { - return isObjectLike(value) && getTag(value) == '[object WeakSet]'; + return isObjectLike(value) && getTag(value) === '[object WeakSet]'; } export default isWeakSet; diff --git a/src/negate.ts b/src/negate.ts index 83c30c03a..fbb10791a 100644 --- a/src/negate.ts +++ b/src/negate.ts @@ -10,7 +10,7 @@ * @example * * function isEven(n) { - * return n % 2 == 0 + * return n % 2 === 0 * } * * filter([1, 2, 3, 4, 5, 6], negate(isEven)) diff --git a/src/remove.ts b/src/remove.ts index 5dcffb94f..fd41acf20 100644 --- a/src/remove.ts +++ b/src/remove.ts @@ -17,7 +17,7 @@ import basePullAt from './.internal/basePullAt.js'; * @example * * const array = [1, 2, 3, 4] - * const evens = remove(array, n => n % 2 == 0) + * const evens = remove(array, n => n % 2 === 0) * * console.log(array) * // => [1, 3] diff --git a/src/size.ts b/src/size.ts index 13464dc1a..d9cb0f0f2 100644 --- a/src/size.ts +++ b/src/size.ts @@ -34,7 +34,7 @@ function size(collection) { return isString(collection) ? stringSize(collection) : collection.length; } const tag = getTag(collection); - if (tag == mapTag || tag == setTag) { + if (tag === mapTag || tag === setTag) { return collection.size; } return Object.keys(collection).length; diff --git a/src/startsWith.ts b/src/startsWith.ts index 4bf245729..4ac4f36ed 100644 --- a/src/startsWith.ts +++ b/src/startsWith.ts @@ -29,7 +29,7 @@ function startsWith(string, target, position) { position = length; } target = `${target}`; - return string.slice(position, position + target.length) == target; + return string.slice(position, position + target.length) === target; } export default startsWith; diff --git a/src/toArray.ts b/src/toArray.ts index af4f1c227..cb121a794 100644 --- a/src/toArray.ts +++ b/src/toArray.ts @@ -47,7 +47,7 @@ function toArray(value) { return iteratorToArray(value[symIterator]()); } const tag = getTag(value); - const func = tag == mapTag ? mapToArray : tag == setTag ? setToArray : values; + const func = tag === mapTag ? mapToArray : tag === setTag ? setToArray : values; return func(value); } diff --git a/src/toString.ts b/src/toString.ts index a729977de..7212a3853 100644 --- a/src/toString.ts +++ b/src/toString.ts @@ -38,7 +38,7 @@ function toString(value) { return value.toString(); } const result = `${value}`; - return result == '0' && 1 / value == -INFINITY ? '-0' : result; + return result === '0' && 1 / value === -INFINITY ? '-0' : result; } export default toString; diff --git a/src/transform.ts b/src/transform.ts index 83399e2d7..c7418dcf3 100644 --- a/src/transform.ts +++ b/src/transform.ts @@ -24,7 +24,7 @@ import isTypedArray from './isTypedArray.js'; * * transform([2, 3, 4], (result, n) => { * result.push(n *= n) - * return n % 2 == 0 + * return n % 2 === 0 * }, []) * // => [4, 9] * diff --git a/src/truncate.ts b/src/truncate.ts index c722ffc96..d1b122b3b 100644 --- a/src/truncate.ts +++ b/src/truncate.ts @@ -99,7 +99,7 @@ function truncate(string, options) { } result = result.slice(0, newEnd === undefined ? end : newEnd); } - } else if (string.indexOf(baseToString(separator), end) != end) { + } else if (string.indexOf(baseToString(separator), end) !== end) { const index = result.lastIndexOf(separator); if (index > -1) { result = result.slice(0, index); diff --git a/test/at.spec.ts b/test/at.spec.ts index 9ad130e2f..16e56d97e 100644 --- a/test/at.spec.ts +++ b/test/at.spec.ts @@ -113,7 +113,7 @@ describe('at', () => { assert.strictEqual(count, expected); - expected = index == 3 ? [] : [index == 2 ? undefined : square(lastIndex)]; + expected = index === 3 ? [] : [index === 2 ? undefined : square(lastIndex)]; assert.deepEqual(actual, expected); }); }); diff --git a/test/case-methods.spec.ts b/test/case-methods.spec.ts index e10313def..a1239b771 100644 --- a/test/case-methods.spec.ts +++ b/test/case-methods.spec.ts @@ -52,7 +52,7 @@ describe('case methods', () => { it(`\`_.${methodName}\` should convert \`string\` to ${caseName} case`, () => { const actual = lodashStable.map(strings, (string) => { - const expected = caseName == 'start' && string == 'FOO BAR' ? string : converted; + const expected = caseName === 'start' && string === 'FOO BAR' ? string : converted; return func(string) === expected; }); @@ -61,7 +61,7 @@ describe('case methods', () => { it(`\`_.${methodName}\` should handle double-converting strings`, () => { const actual = lodashStable.map(strings, (string) => { - const expected = caseName == 'start' && string == 'FOO BAR' ? string : converted; + const expected = caseName === 'start' && string === 'FOO BAR' ? string : converted; return func(func(string)) === expected; }); diff --git a/test/chain.spec.ts b/test/chain.spec.ts index b9a6a35f6..fefd0168d 100644 --- a/test/chain.spec.ts +++ b/test/chain.spec.ts @@ -69,7 +69,7 @@ describe('chain', () => { actual = wrapped .chain() .filter((n) => n % 2 != 0) - .reject((n) => n % 3 == 0) + .reject((n) => n % 3 === 0) .sortBy((n) => -n) .value(); diff --git a/test/clone-methods.spec.ts b/test/clone-methods.spec.ts index 719c78de7..ab6d1c283 100644 --- a/test/clone-methods.spec.ts +++ b/test/clone-methods.spec.ts @@ -125,12 +125,12 @@ xdescribe('clone methods', function () { actual = last(arguments); }); - assert.ok(isNpm ? actual.constructor.name == 'Stack' : actual instanceof mapCaches.Stack); + assert.ok(isNpm ? actual.constructor.name === 'Stack' : actual instanceof mapCaches.Stack); }); lodashStable.each(['clone', 'cloneDeep'], (methodName) => { const func = _[methodName], - isDeep = methodName == 'cloneDeep'; + isDeep = methodName === 'cloneDeep'; lodashStable.forOwn(objects, (object, kind) => { it(`\`_.${methodName}\` should clone ${kind}`, () => { @@ -405,7 +405,7 @@ xdescribe('clone methods', function () { lodashStable.each(['cloneWith', 'cloneDeepWith'], (methodName) => { const func = _[methodName], - isDeep = methodName == 'cloneDeepWith'; + isDeep = methodName === 'cloneDeepWith'; it(`\`_.${methodName}\` should provide correct \`customizer\` arguments`, () => { const argsList = [], diff --git a/test/conforms-methods.spec.ts b/test/conforms-methods.spec.ts index e6af51890..d693fa95e 100644 --- a/test/conforms-methods.spec.ts +++ b/test/conforms-methods.spec.ts @@ -5,7 +5,7 @@ import conformsTo from '../src/conformsTo'; describe('conforms methods', () => { lodashStable.each(['conforms', 'conformsTo'], (methodName) => { - const isConforms = methodName == 'conforms'; + const isConforms = methodName === 'conforms'; function conforms(source) { return isConforms diff --git a/test/curry-methods.spec.ts b/test/curry-methods.spec.ts index 255f07b61..2b54b0d53 100644 --- a/test/curry-methods.spec.ts +++ b/test/curry-methods.spec.ts @@ -9,7 +9,7 @@ describe('curry methods', () => { fn = function (a, b) { return slice.call(arguments); }, - isCurry = methodName == 'curry'; + isCurry = methodName === 'curry'; it(`\`_.${methodName}\` should not error on functions with the same name as lodash methods`, () => { function run(a, b) { diff --git a/test/debounce-and-throttle.spec.ts b/test/debounce-and-throttle.spec.ts index 8b8a90221..258dcf4ea 100644 --- a/test/debounce-and-throttle.spec.ts +++ b/test/debounce-and-throttle.spec.ts @@ -6,7 +6,7 @@ import runInContext from '../src/runInContext'; describe('debounce and throttle', () => { lodashStable.each(['debounce', 'throttle'], (methodName) => { const func = _[methodName], - isDebounce = methodName == 'debounce'; + isDebounce = methodName === 'debounce'; it(`\`_.${methodName}\` should not error for non-object \`options\` values`, () => { func(noop, 32, 1); @@ -82,7 +82,7 @@ describe('debounce and throttle', () => { const lodash = runInContext({ Date: { now: function () { - return ++dateCount == 4 + return ++dateCount === 4 ? +new Date(2012, 3, 23, 23, 27, 18) : +new Date(); }, diff --git a/test/dropWhile.spec.ts b/test/dropWhile.spec.ts index 698f33a55..7e0e7a0ae 100644 --- a/test/dropWhile.spec.ts +++ b/test/dropWhile.spec.ts @@ -57,9 +57,9 @@ describe('dropWhile', () => { const array = lodashStable.range(1, LARGE_ARRAY_SIZE + 3); const actual = _(array) - .dropWhile((n) => n == 1) + .dropWhile((n) => n === 1) .drop() - .dropWhile((n) => n == 3) + .dropWhile((n) => n === 3) .value(); assert.deepEqual(actual, array.slice(3)); diff --git a/test/extremum-methods.spec.ts b/test/extremum-methods.spec.ts index 85f44b218..70f5cbdee 100644 --- a/test/extremum-methods.spec.ts +++ b/test/extremum-methods.spec.ts @@ -28,7 +28,7 @@ describe('extremum methods', () => { lodashStable.each(['maxBy', 'minBy'], (methodName) => { const array = [1, 2, 3], func = _[methodName], - isMax = methodName == 'maxBy'; + isMax = methodName === 'maxBy'; it(`\`_.${methodName}\` should work with an \`iteratee\``, () => { const actual = func(array, (n) => -n); diff --git a/test/filter-methods.spec.ts b/test/filter-methods.spec.ts index da00503de..1c168b562 100644 --- a/test/filter-methods.spec.ts +++ b/test/filter-methods.spec.ts @@ -6,7 +6,7 @@ describe('filter methods', () => { lodashStable.each(['filter', 'reject'], (methodName) => { const array = [1, 2, 3, 4], func = _[methodName], - isFilter = methodName == 'filter', + isFilter = methodName === 'filter', objects = [{ a: 0 }, { a: 1 }]; it(`\`_.${methodName}\` should not modify the resulting value from within \`predicate\``, () => { diff --git a/test/find-and-findLast.spec.ts b/test/find-and-findLast.spec.ts index a5d374a50..c462b3314 100644 --- a/test/find-and-findLast.spec.ts +++ b/test/find-and-findLast.spec.ts @@ -4,7 +4,7 @@ import { LARGE_ARRAY_SIZE, square, isEven } from './utils'; describe('find and findLast', () => { lodashStable.each(['find', 'findLast'], (methodName) => { - const isFind = methodName == 'find'; + const isFind = methodName === 'find'; it(`\`_.${methodName}\` should support shortcut fusion`, () => { let findCount = 0, diff --git a/test/find-and-includes.spec.ts b/test/find-and-includes.spec.ts index 7a457a5f1..7e4216c62 100644 --- a/test/find-and-includes.spec.ts +++ b/test/find-and-includes.spec.ts @@ -5,8 +5,8 @@ import { _, identity, args, falsey } from './utils'; describe('find and includes', () => { lodashStable.each(['includes', 'find'], (methodName) => { const func = _[methodName], - isIncludes = methodName == 'includes', - resolve = methodName == 'find' ? lodashStable.curry(lodashStable.eq) : identity; + isIncludes = methodName === 'includes', + resolve = methodName === 'find' ? lodashStable.curry(lodashStable.eq) : identity; lodashStable.each( { diff --git a/test/findLastIndex-and-lastIndexOf.spec.ts b/test/findLastIndex-and-lastIndexOf.spec.ts index 6f8485b28..c3469f65f 100644 --- a/test/findLastIndex-and-lastIndexOf.spec.ts +++ b/test/findLastIndex-and-lastIndexOf.spec.ts @@ -14,7 +14,7 @@ describe('findLastIndex and lastIndexOf', () => { const array = [1, 2, 3, 1, 2, 3], func = methods[methodName], resolve = - methodName == 'findLastIndex' ? lodashStable.curry(lodashStable.eq) : identity; + methodName === 'findLastIndex' ? lodashStable.curry(lodashStable.eq) : identity; it(`\`_.${methodName}\` should return the index of the last matched value`, () => { assert.strictEqual(func(array, resolve(3)), 5); diff --git a/test/flatten-methods.spec.ts b/test/flatten-methods.spec.ts index ca58d9baf..ce0be6521 100644 --- a/test/flatten-methods.spec.ts +++ b/test/flatten-methods.spec.ts @@ -49,9 +49,9 @@ describe('flatten methods', () => { const expected = Array(5e5); try { let func = flatten; - if (index == 1) { + if (index === 1) { func = flattenDeep; - } else if (index == 2) { + } else if (index === 2) { func = flattenDepth; } assert.deepStrictEqual(func([expected]), expected); diff --git a/test/flow-methods.spec.ts b/test/flow-methods.spec.ts index 6693a4049..c08e5abfc 100644 --- a/test/flow-methods.spec.ts +++ b/test/flow-methods.spec.ts @@ -15,7 +15,7 @@ const methods = { describe('flow methods', () => { lodashStable.each(['flow', 'flowRight'], (methodName) => { const func = methods[methodName], - isFlow = methodName == 'flow'; + isFlow = methodName === 'flow'; it(`\`_.${methodName}\` should supply each function with the return value of the previous`, () => { const fixed = function (n) { diff --git a/test/has-methods.spec.ts b/test/has-methods.spec.ts index 19e2f03e1..99b3fae22 100644 --- a/test/has-methods.spec.ts +++ b/test/has-methods.spec.ts @@ -5,7 +5,7 @@ import { _, toArgs, stubTrue, args, symbol, defineProperty, stubFalse } from './ describe('has methods', () => { lodashStable.each(['has', 'hasIn'], (methodName) => { const func = _[methodName], - isHas = methodName == 'has', + isHas = methodName === 'has', sparseArgs = toArgs([1]), sparseArray = Array(1), sparseString = Object('a'); diff --git a/test/includes.spec.ts b/test/includes.spec.ts index eb94a193a..820388fd9 100644 --- a/test/includes.spec.ts +++ b/test/includes.spec.ts @@ -65,7 +65,7 @@ describe('includes', () => { length = string.length, indexes = [4, 6, 2 ** 32, Infinity]; - const expected = lodashStable.map(indexes, (index) => [false, false, index == length]); + const expected = lodashStable.map(indexes, (index) => [false, false, index === length]); const actual = lodashStable.map(indexes, (fromIndex) => [ includes(string, 1, fromIndex), diff --git a/test/isFunction.spec.ts b/test/isFunction.spec.ts index 99d7fb49d..2d9a4b2a8 100644 --- a/test/isFunction.spec.ts +++ b/test/isFunction.spec.ts @@ -40,7 +40,7 @@ describe('isFunction', () => { it('should return `true` for array view constructors', () => { const expected = lodashStable.map( arrayViews, - (type) => objToString.call(root[type]) == funcTag, + (type) => objToString.call(root[type]) === funcTag, ); const actual = lodashStable.map(arrayViews, (type) => isFunction(root[type])); diff --git a/test/isInteger-methods.spec.ts b/test/isInteger-methods.spec.ts index 74bd5b705..fb879d42f 100644 --- a/test/isInteger-methods.spec.ts +++ b/test/isInteger-methods.spec.ts @@ -5,7 +5,7 @@ import { _, stubTrue, MAX_INTEGER, stubFalse, falsey, args, symbol } from './uti describe('isInteger methods', () => { lodashStable.each(['isInteger', 'isSafeInteger'], (methodName) => { const func = _[methodName], - isSafe = methodName == 'isSafeInteger'; + isSafe = methodName === 'isSafeInteger'; it(`\`_.${methodName}\` should return \`true\` for integer values`, () => { const values = [-1, 0, 1], diff --git a/test/isMatchWith.spec.ts b/test/isMatchWith.spec.ts index f3ab705f7..09756a489 100644 --- a/test/isMatchWith.spec.ts +++ b/test/isMatchWith.spec.ts @@ -78,7 +78,7 @@ describe('isMatchWith', () => { actual = last(arguments); }); - assert.ok(isNpm ? actual.constructor.name == 'Stack' : actual instanceof mapCaches.Stack); + assert.ok(isNpm ? actual.constructor.name === 'Stack' : actual instanceof mapCaches.Stack); }); it('should ensure `customizer` is a function', () => { diff --git a/test/isNil.spec.ts b/test/isNil.spec.ts index f6d39cdab..4bfd9a7a4 100644 --- a/test/isNil.spec.ts +++ b/test/isNil.spec.ts @@ -11,7 +11,7 @@ describe('isNil', () => { }); it('should return `false` for non-nullish values', () => { - const expected = lodashStable.map(falsey, (value) => value == null); + const expected = lodashStable.map(falsey, (value) => value === null); const actual = lodashStable.map(falsey, (value, index) => (index ? isNil(value) : isNil())); diff --git a/test/isType-checks.spec.ts b/test/isType-checks.spec.ts index 2e985d80d..a7e3263d7 100644 --- a/test/isType-checks.spec.ts +++ b/test/isType-checks.spec.ts @@ -19,7 +19,7 @@ describe('isType checks', () => { Foo.prototype = root[methodName.slice(2)].prototype; const object = new Foo(); - if (objToString.call(object) == objectTag) { + if (objToString.call(object) === objectTag) { assert.strictEqual( _[methodName](object), false, diff --git a/test/iteration-methods.spec.ts b/test/iteration-methods.spec.ts index 15fdf3a58..00c409723 100644 --- a/test/iteration-methods.spec.ts +++ b/test/iteration-methods.spec.ts @@ -118,7 +118,7 @@ describe('iteration methods', () => { isBy = /(^partition|By)$/.test(methodName), isFind = /^find/.test(methodName), isOmitPick = /^(?:omit|pick)By$/.test(methodName), - isSome = methodName == 'some'; + isSome = methodName === 'some'; it(`\`_.${methodName}\` should provide correct iteratee arguments`, () => { if (func) { @@ -187,7 +187,7 @@ describe('iteration methods', () => { lodashStable.each(lodashStable.difference(methods, objectMethods), (methodName) => { const array = [1, 2, 3], func = _[methodName], - isEvery = methodName == 'every'; + isEvery = methodName === 'every'; array.a = 1; @@ -206,7 +206,7 @@ describe('iteration methods', () => { lodashStable.each(lodashStable.difference(methods, unwrappedMethods), (methodName) => { const array = [1, 2, 3], - isBaseEach = methodName == '_baseEach'; + isBaseEach = methodName === '_baseEach'; it(`\`_.${methodName}\` should return a wrapped value when implicitly chaining`, () => { if (!(isBaseEach || isNpm)) { @@ -303,7 +303,7 @@ describe('iteration methods', () => { lodashStable.each(methods, (methodName) => { const func = _[methodName], isFind = /^find/.test(methodName), - isSome = methodName == 'some', + isSome = methodName === 'some', isReduce = /^reduce/.test(methodName); it(`\`_.${methodName}\` should ignore changes to \`length\``, () => { @@ -314,7 +314,7 @@ describe('iteration methods', () => { func( array, () => { - if (++count == 1) { + if (++count === 1) { array.push(2); } return !(isFind || isSome); @@ -332,7 +332,7 @@ describe('iteration methods', () => { (methodName) => { const func = _[methodName], isFind = /^find/.test(methodName), - isSome = methodName == 'some', + isSome = methodName === 'some', isReduce = /^reduce/.test(methodName); it(`\`_.${methodName}\` should ignore added \`object\` properties`, () => { @@ -343,7 +343,7 @@ describe('iteration methods', () => { func( object, () => { - if (++count == 1) { + if (++count === 1) { object.b = 2; } return !(isFind || isSome); diff --git a/test/keys-methods.spec.ts b/test/keys-methods.spec.ts index d025882c6..338461249 100644 --- a/test/keys-methods.spec.ts +++ b/test/keys-methods.spec.ts @@ -16,7 +16,7 @@ import { describe('keys methods', () => { lodashStable.each(['keys', 'keysIn'], (methodName) => { const func = _[methodName], - isKeys = methodName == 'keys'; + isKeys = methodName === 'keys'; it(`\`_.${methodName}\` should return the string keyed property names of \`object\``, () => { const actual = func({ a: 1, b: 1 }).sort(); diff --git a/test/lodash(...)-methods-that-return-new-wrapped-values.spec.ts b/test/lodash(...)-methods-that-return-new-wrapped-values.spec.ts index af782e6ba..c08c8f6de 100644 --- a/test/lodash(...)-methods-that-return-new-wrapped-values.spec.ts +++ b/test/lodash(...)-methods-that-return-new-wrapped-values.spec.ts @@ -34,7 +34,7 @@ describe('lodash(...) methods that return new wrapped values', () => { lodashStable.each(funcs, (methodName) => { it(`\`_(...).${methodName}\` should return a new wrapped value`, () => { - const value = methodName == 'split' ? 'abc' : [1, 2, 3], + const value = methodName === 'split' ? 'abc' : [1, 2, 3], wrapped = _(value), actual = wrapped[methodName](); diff --git a/test/lodash-methods.spec.ts b/test/lodash-methods.spec.ts index 6ab7f638d..b4cbfef7c 100644 --- a/test/lodash-methods.spec.ts +++ b/test/lodash-methods.spec.ts @@ -100,9 +100,9 @@ describe('lodash methods', () => { index ? func(value) : func(), ); - if (methodName == 'noConflict') { + if (methodName === 'noConflict') { root._ = oldDash; - } else if (methodName == 'pull' || methodName == 'pullAll') { + } else if (methodName === 'pull' || methodName === 'pullAll') { expected = falsey; } if (lodashStable.includes(returnArrays, methodName) && methodName != 'sample') { @@ -137,7 +137,7 @@ describe('lodash methods', () => { } assert.ok(lodashStable.isArray(actual), `_.${methodName} returns an array`); - const isPull = methodName == 'pull' || methodName == 'pullAll'; + const isPull = methodName === 'pull' || methodName === 'pullAll'; assert.strictEqual( actual === array, isPull, @@ -163,7 +163,7 @@ describe('lodash methods', () => { !pass && e instanceof TypeError && (!lodashStable.includes(checkFuncs, methodName) || - e.message == FUNC_ERROR_TEXT); + e.message === FUNC_ERROR_TEXT); } return pass; }); @@ -182,7 +182,7 @@ describe('lodash methods', () => { return this.a; }, func = _[methodName], - isNegate = methodName == 'negate', + isNegate = methodName === 'negate', object = { a: 1 }, expected = isNegate ? false : 1; diff --git a/test/matches-methods.spec.ts b/test/matches-methods.spec.ts index 368ae4689..dccb818db 100644 --- a/test/matches-methods.spec.ts +++ b/test/matches-methods.spec.ts @@ -5,7 +5,7 @@ import isMatch from '../src/isMatch'; describe('matches methods', () => { lodashStable.each(['matches', 'isMatch'], (methodName) => { - const isMatches = methodName == 'matches'; + const isMatches = methodName === 'matches'; function matches(source) { return isMatches diff --git a/test/math-operator-methods.spec.ts b/test/math-operator-methods.spec.ts index a1c99ff42..b156c14fc 100644 --- a/test/math-operator-methods.spec.ts +++ b/test/math-operator-methods.spec.ts @@ -5,7 +5,7 @@ import { _, symbol } from './utils'; describe('math operator methods', () => { lodashStable.each(['add', 'divide', 'multiply', 'subtract'], (methodName) => { const func = _[methodName], - isAddSub = methodName == 'add' || methodName == 'subtract'; + isAddSub = methodName === 'add' || methodName === 'subtract'; it(`\`_.${methodName}\` should return \`${ isAddSub ? 0 : 1 diff --git a/test/mergeWith.spec.ts b/test/mergeWith.spec.ts index 56c3d127e..3ca3b55b9 100644 --- a/test/mergeWith.spec.ts +++ b/test/mergeWith.spec.ts @@ -36,7 +36,7 @@ describe('mergeWith', () => { actual = last(arguments); }); - assert.ok(isNpm ? actual.constructor.name == 'Stack' : actual instanceof mapCaches.Stack); + assert.ok(isNpm ? actual.constructor.name === 'Stack' : actual instanceof mapCaches.Stack); }); it('should overwrite primitives with source object clones', () => { diff --git a/test/negate.spec.ts b/test/negate.spec.ts index 057f49fa7..b642296f3 100644 --- a/test/negate.spec.ts +++ b/test/negate.spec.ts @@ -42,7 +42,7 @@ describe('negate', () => { case 4: negate(1, 2, 3, 4); } - return argCount == index; + return argCount === index; }); assert.deepStrictEqual(actual, expected); diff --git a/test/number-coercion-methods.spec.ts b/test/number-coercion-methods.spec.ts index 18a3bb6d3..e454def2b 100644 --- a/test/number-coercion-methods.spec.ts +++ b/test/number-coercion-methods.spec.ts @@ -42,10 +42,10 @@ describe('number coercion methods', () => { ['toFinite', 'toInteger', 'toLength', 'toNumber', 'toSafeInteger'], (methodName) => { const func = _[methodName], - isToFinite = methodName == 'toFinite', - isToLength = methodName == 'toLength', - isToNumber = methodName == 'toNumber', - isToSafeInteger = methodName == 'toSafeInteger'; + isToFinite = methodName === 'toFinite', + isToLength = methodName === 'toLength', + isToNumber = methodName === 'toNumber', + isToSafeInteger = methodName === 'toSafeInteger'; function negative(string) { return `-${string}`; @@ -76,9 +76,9 @@ describe('number coercion methods', () => { const expected = lodashStable.map(values, (value) => { if (!isToNumber) { - if (!isToFinite && value == 1.2) { + if (!isToFinite && value === 1.2) { value = 1; - } else if (value == Infinity) { + } else if (value === Infinity) { value = MAX_INTEGER; } else if (value !== value) { value = 0; @@ -124,11 +124,11 @@ describe('number coercion methods', () => { const expected = lodashStable.map(values, (value) => { let n = +value; if (!isToNumber) { - if (!isToFinite && n == 1.23456789) { + if (!isToFinite && n === 1.23456789) { n = 1; - } else if (n == Infinity) { + } else if (n === Infinity) { n = MAX_INTEGER; - } else if ((!isToFinite && n == Number.MIN_VALUE) || n !== n) { + } else if ((!isToFinite && n === Number.MIN_VALUE) || n !== n) { n = 0; } if (isToLength || isToSafeInteger) { diff --git a/test/object-assignments.spec.ts b/test/object-assignments.spec.ts index b7b58bbe2..3821f2163 100644 --- a/test/object-assignments.spec.ts +++ b/test/object-assignments.spec.ts @@ -6,7 +6,7 @@ import has from '../src/has'; describe('object assignments', () => { lodashStable.each(['assign', 'assignIn', 'defaults', 'defaultsDeep', 'merge'], (methodName) => { const func = _[methodName], - isAssign = methodName == 'assign', + isAssign = methodName === 'assign', isDefaults = /^defaults/.test(methodName); it(`\`_.${methodName}\` should coerce primitives to objects`, () => { @@ -135,7 +135,7 @@ describe('object assignments', () => { lodashStable.each(['assignWith', 'assignInWith', 'mergeWith'], (methodName) => { const func = _[methodName], - isMergeWith = methodName == 'mergeWith'; + isMergeWith = methodName === 'mergeWith'; it(`\`_.${methodName}\` should provide correct \`customizer\` arguments`, () => { let args, diff --git a/test/omit-methods.spec.ts b/test/omit-methods.spec.ts index 8101c562d..8f1a8a63d 100644 --- a/test/omit-methods.spec.ts +++ b/test/omit-methods.spec.ts @@ -9,7 +9,7 @@ describe('omit methods', () => { object = { a: 1, b: 2, c: 3, d: 4 }, resolve = lodashStable.nthArg(1); - if (methodName == 'omitBy') { + if (methodName === 'omitBy') { resolve = function (object, props) { props = lodashStable.castArray(props); return function (value) { diff --git a/test/pad-methods.spec.ts b/test/pad-methods.spec.ts index 1704cf84b..a9f0749cb 100644 --- a/test/pad-methods.spec.ts +++ b/test/pad-methods.spec.ts @@ -6,8 +6,8 @@ import pad from '../src/pad'; describe('pad methods', () => { lodashStable.each(['pad', 'padStart', 'padEnd'], (methodName) => { const func = _[methodName], - isPad = methodName == 'pad', - isStart = methodName == 'padStart', + isPad = methodName === 'pad', + isStart = methodName === 'padStart', string = 'abc'; it(`\`_.${methodName}\` should not pad if string is >= \`length\``, () => { diff --git a/test/partial-methods.spec.ts b/test/partial-methods.spec.ts index 355c1d6eb..99fe09c9f 100644 --- a/test/partial-methods.spec.ts +++ b/test/partial-methods.spec.ts @@ -7,7 +7,7 @@ import curry from '../src/curry'; describe('partial methods', () => { lodashStable.each(['partial', 'partialRight'], (methodName) => { const func = _[methodName], - isPartial = methodName == 'partial', + isPartial = methodName === 'partial', ph = func.placeholder; it(`\`_.${methodName}\` partially applies arguments`, () => { diff --git a/test/pick-methods.spec.ts b/test/pick-methods.spec.ts index feb61d50d..4570f9d12 100644 --- a/test/pick-methods.spec.ts +++ b/test/pick-methods.spec.ts @@ -6,11 +6,11 @@ describe('pick methods', () => { lodashStable.each(['pick', 'pickBy'], (methodName) => { let expected = { a: 1, c: 3 }, func = _[methodName], - isPick = methodName == 'pick', + isPick = methodName === 'pick', object = { a: 1, b: 2, c: 3, d: 4 }, resolve = lodashStable.nthArg(1); - if (methodName == 'pickBy') { + if (methodName === 'pickBy') { resolve = function (object, props) { props = lodashStable.castArray(props); return function (value) { diff --git a/test/pickBy.spec.ts b/test/pickBy.spec.ts index 1d2321411..7c5f9da5a 100644 --- a/test/pickBy.spec.ts +++ b/test/pickBy.spec.ts @@ -6,7 +6,7 @@ describe('pickBy', () => { it('should work with a predicate argument', () => { const object = { a: 1, b: 2, c: 3, d: 4 }; - const actual = pickBy(object, (n) => n == 1 || n == 3); + const actual = pickBy(object, (n) => n === 1 || n === 3); assert.deepStrictEqual(actual, { a: 1, c: 3 }); }); diff --git a/test/pull-methods.spec.ts b/test/pull-methods.spec.ts index c1192d31b..cc13e8434 100644 --- a/test/pull-methods.spec.ts +++ b/test/pull-methods.spec.ts @@ -5,7 +5,7 @@ import { _ } from './utils'; describe('pull methods', () => { lodashStable.each(['pull', 'pullAll', 'pullAllWith'], (methodName) => { const func = _[methodName], - isPull = methodName == 'pull'; + isPull = methodName === 'pull'; function pull(array, values) { return isPull ? func.apply(undefined, [array].concat(values)) : func(array, values); diff --git a/test/random.spec.ts b/test/random.spec.ts index 460314b45..47ffde46b 100644 --- a/test/random.spec.ts +++ b/test/random.spec.ts @@ -93,7 +93,7 @@ describe('random', () => { const actual = lodashStable.map( randoms, - (result, index) => result >= 0 && result <= array[index] && result % 1 == 0, + (result, index) => result >= 0 && result <= array[index] && result % 1 === 0, ); assert.deepStrictEqual(actual, expected); diff --git a/test/range-methods.spec.ts b/test/range-methods.spec.ts index 3d85a5c9a..d0618bc91 100644 --- a/test/range-methods.spec.ts +++ b/test/range-methods.spec.ts @@ -5,7 +5,7 @@ import { _, falsey } from './utils'; describe('range methods', () => { lodashStable.each(['range', 'rangeRight'], (methodName) => { const func = _[methodName], - isRange = methodName == 'range'; + isRange = methodName === 'range'; function resolve(range) { return isRange ? range : range.reverse(); diff --git a/test/reduce-methods.spec.ts b/test/reduce-methods.spec.ts index 721eb2ba2..219f62bfd 100644 --- a/test/reduce-methods.spec.ts +++ b/test/reduce-methods.spec.ts @@ -6,7 +6,7 @@ describe('reduce methods', () => { lodashStable.each(['reduce', 'reduceRight'], (methodName) => { const func = _[methodName], array = [1, 2, 3], - isReduce = methodName == 'reduce'; + isReduce = methodName === 'reduce'; it(`\`_.${methodName}\` should reduce a collection to a single value`, () => { const actual = func(['a', 'b', 'c'], (accumulator, value) => accumulator + value, ''); diff --git a/test/reduce.spec.ts b/test/reduce.spec.ts index 332ebbb7f..5dd6dc254 100644 --- a/test/reduce.spec.ts +++ b/test/reduce.spec.ts @@ -37,7 +37,7 @@ describe('reduce', () => { object = { a: 1, b: 2 }, firstKey = head(keys(object)); - let expected = firstKey == 'a' ? [0, 1, 'a', object] : [0, 2, 'b', object]; + let expected = firstKey === 'a' ? [0, 1, 'a', object] : [0, 2, 'b', object]; reduce( object, @@ -50,7 +50,7 @@ describe('reduce', () => { assert.deepStrictEqual(args, expected); args = undefined; - expected = firstKey == 'a' ? [1, 2, 'b', object] : [2, 1, 'a', object]; + expected = firstKey === 'a' ? [1, 2, 'b', object] : [2, 1, 'a', object]; reduce(object, function () { args || (args = slice.call(arguments)); diff --git a/test/reduceRight.spec.ts b/test/reduceRight.spec.ts index 38f83e3cd..5757338f3 100644 --- a/test/reduceRight.spec.ts +++ b/test/reduceRight.spec.ts @@ -34,7 +34,7 @@ describe('reduceRight', () => { it('should provide correct `iteratee` arguments when iterating an object', () => { let args, object = { a: 1, b: 2 }, - isFIFO = lodashStable.keys(object)[0] == 'a'; + isFIFO = lodashStable.keys(object)[0] === 'a'; let expected = isFIFO ? [0, 2, 'b', object] : [0, 1, 'a', object]; diff --git a/test/remove.spec.ts b/test/remove.spec.ts index 0c93a32db..f1dca040d 100644 --- a/test/remove.spec.ts +++ b/test/remove.spec.ts @@ -69,7 +69,7 @@ describe('remove', () => { const array = [1, 2, 3]; delete array[1]; - remove(array, (n) => n == null); + remove(array, (n) => n === null); assert.deepStrictEqual(array, [1, 3]); }); diff --git a/test/round-methods.spec.ts b/test/round-methods.spec.ts index d76d1d928..a468b017c 100644 --- a/test/round-methods.spec.ts +++ b/test/round-methods.spec.ts @@ -6,8 +6,8 @@ import round from '../src/round'; describe('round methods', () => { lodashStable.each(['ceil', 'floor', 'round'], (methodName) => { const func = _[methodName], - isCeil = methodName == 'ceil', - isFloor = methodName == 'floor'; + isCeil = methodName === 'ceil', + isFloor = methodName === 'floor'; it(`\`_.${methodName}\` should return a rounded number without a precision`, () => { const actual = func(4.006); diff --git a/test/sortedIndex-methods.spec.ts b/test/sortedIndex-methods.spec.ts index b5c00884d..7d618405f 100644 --- a/test/sortedIndex-methods.spec.ts +++ b/test/sortedIndex-methods.spec.ts @@ -6,7 +6,7 @@ import sortBy from '../src/sortBy'; describe('sortedIndex methods', () => { lodashStable.each(['sortedIndex', 'sortedLastIndex'], (methodName) => { const func = _[methodName], - isSortedIndex = methodName == 'sortedIndex'; + isSortedIndex = methodName === 'sortedIndex'; it(`\`_.${methodName}\` should return the insert index`, () => { const array = [30, 50], diff --git a/test/sortedIndexBy-methods.spec.ts b/test/sortedIndexBy-methods.spec.ts index a7e346cea..89f270dc6 100644 --- a/test/sortedIndexBy-methods.spec.ts +++ b/test/sortedIndexBy-methods.spec.ts @@ -5,7 +5,7 @@ import { _, slice, MAX_ARRAY_LENGTH, MAX_ARRAY_INDEX } from './utils'; describe('sortedIndexBy methods', () => { lodashStable.each(['sortedIndexBy', 'sortedLastIndexBy'], (methodName) => { const func = _[methodName], - isSortedIndexBy = methodName == 'sortedIndexBy'; + isSortedIndexBy = methodName === 'sortedIndexBy'; it(`\`_.${methodName}\` should provide correct \`iteratee\` arguments`, () => { let args; @@ -52,7 +52,7 @@ describe('sortedIndexBy methods', () => { ? 0 : Math.min(length, MAX_ARRAY_INDEX); - assert.ok(steps == 32 || steps == 33); + assert.ok(steps === 32 || steps === 33); assert.strictEqual(actual, expected); }); }); diff --git a/test/sortedIndexOf-methods.spec.ts b/test/sortedIndexOf-methods.spec.ts index 91a061903..3b5d8b6ba 100644 --- a/test/sortedIndexOf-methods.spec.ts +++ b/test/sortedIndexOf-methods.spec.ts @@ -5,7 +5,7 @@ import { _ } from './utils'; describe('sortedIndexOf methods', () => { lodashStable.each(['sortedIndexOf', 'sortedLastIndexOf'], (methodName) => { const func = _[methodName], - isSortedIndexOf = methodName == 'sortedIndexOf'; + isSortedIndexOf = methodName === 'sortedIndexOf'; it(`\`_.${methodName}\` should perform a binary search`, () => { const sorted = [4, 4, 5, 5, 6, 6]; diff --git a/test/startsWith-and-endsWith.spec.ts b/test/startsWith-and-endsWith.spec.ts index 18f779fcf..cdd067d75 100644 --- a/test/startsWith-and-endsWith.spec.ts +++ b/test/startsWith-and-endsWith.spec.ts @@ -5,7 +5,7 @@ import { _, MAX_SAFE_INTEGER } from './utils'; describe('startsWith and endsWith', () => { lodashStable.each(['startsWith', 'endsWith'], (methodName) => { const func = _[methodName], - isStartsWith = methodName == 'startsWith'; + isStartsWith = methodName === 'startsWith'; const string = 'abc', chr = isStartsWith ? 'a' : 'c'; diff --git a/test/strict-mode-checks.spec.ts b/test/strict-mode-checks.spec.ts index 3779e6538..3556a7950 100644 --- a/test/strict-mode-checks.spec.ts +++ b/test/strict-mode-checks.spec.ts @@ -7,7 +7,7 @@ describe('strict mode checks', () => { ['assign', 'assignIn', 'bindAll', 'defaults', 'defaultsDeep', 'merge'], (methodName) => { const func = _[methodName], - isBindAll = methodName == 'bindAll'; + isBindAll = methodName === 'bindAll'; it(`\`_.${methodName}\` should ${ isStrict ? '' : 'not ' diff --git a/test/takeWhile.spec.ts b/test/takeWhile.spec.ts index 1b8c999f2..793196d43 100644 --- a/test/takeWhile.spec.ts +++ b/test/takeWhile.spec.ts @@ -58,7 +58,7 @@ describe('takeWhile', () => { const actual = _(array) .takeWhile((n) => n < 4) .take(2) - .takeWhile((n) => n == 0) + .takeWhile((n) => n === 0) .value(); assert.deepEqual(actual, [0]); diff --git a/test/template.spec.ts b/test/template.spec.ts index f405a3e6e..ad5c88f5e 100644 --- a/test/template.spec.ts +++ b/test/template.spec.ts @@ -297,7 +297,7 @@ describe('template', () => { it('should work with statements containing quotes', () => { const compiled = template( '<%\ - if (a == \'A\' || a == "a") {\ + if (a === \'A\' || a === "a") {\ %>\'a\',"A"<%\ } %>', ); diff --git a/test/throttle.spec.ts b/test/throttle.spec.ts index 9d8b7943c..dcb1abf35 100644 --- a/test/throttle.spec.ts +++ b/test/throttle.spec.ts @@ -49,7 +49,7 @@ describe('throttle', () => { const lodash = runInContext({ Date: { now: function () { - return ++dateCount == 5 ? Infinity : +new Date(); + return ++dateCount === 5 ? Infinity : +new Date(); }, }, }); diff --git a/test/toInteger-methods.spec.ts b/test/toInteger-methods.spec.ts index cf02d8d94..c6f194cd0 100644 --- a/test/toInteger-methods.spec.ts +++ b/test/toInteger-methods.spec.ts @@ -5,7 +5,7 @@ import { _, MAX_SAFE_INTEGER, MAX_INTEGER } from './utils'; describe('toInteger methods', () => { lodashStable.each(['toInteger', 'toSafeInteger'], (methodName) => { const func = _[methodName], - isSafe = methodName == 'toSafeInteger'; + isSafe = methodName === 'toSafeInteger'; it(`\`_.${methodName}\` should convert values to integers`, () => { assert.strictEqual(func(-5.6), -5); diff --git a/test/toPairs-methods.spec.ts b/test/toPairs-methods.spec.ts index 28a8d242a..f2fb1ea5c 100644 --- a/test/toPairs-methods.spec.ts +++ b/test/toPairs-methods.spec.ts @@ -5,7 +5,7 @@ import { _ } from './utils'; describe('toPairs methods', () => { lodashStable.each(['toPairs', 'toPairsIn'], (methodName) => { const func = _[methodName], - isToPairs = methodName == 'toPairs'; + isToPairs = methodName === 'toPairs'; it(`\`_.${methodName}\` should create an array of string keyed-value pairs`, () => { const object = { a: 1, b: 2 }, diff --git a/test/transform.spec.ts b/test/transform.spec.ts index feabc1915..74b4ac315 100644 --- a/test/transform.spec.ts +++ b/test/transform.spec.ts @@ -169,7 +169,7 @@ describe('transform', () => { }); const first = args[0]; - if (key == 'array') { + if (key === 'array') { assert.ok(first !== object && lodashStable.isArray(first)); assert.deepStrictEqual(args, [first, 1, 0, object]); } else { diff --git a/test/trim-methods.spec.ts b/test/trim-methods.spec.ts index 037d10c95..c53cf651c 100644 --- a/test/trim-methods.spec.ts +++ b/test/trim-methods.spec.ts @@ -17,21 +17,21 @@ describe('trim methods', () => { it(`\`_.${methodName}\` should remove ${parts} whitespace`, () => { const string = `${whitespace}a b c${whitespace}`, - expected = `${index == 2 ? whitespace : ''}a b c${index == 1 ? whitespace : ''}`; + expected = `${index === 2 ? whitespace : ''}a b c${index === 1 ? whitespace : ''}`; assert.strictEqual(func(string), expected); }); it(`\`_.${methodName}\` should coerce \`string\` to a string`, () => { const object = { toString: lodashStable.constant(`${whitespace}a b c${whitespace}`) }, - expected = `${index == 2 ? whitespace : ''}a b c${index == 1 ? whitespace : ''}`; + expected = `${index === 2 ? whitespace : ''}a b c${index === 1 ? whitespace : ''}`; assert.strictEqual(func(object), expected); }); it(`\`_.${methodName}\` should remove ${parts} \`chars\``, () => { const string = '-_-a-b-c-_-', - expected = `${index == 2 ? '-_-' : ''}a-b-c${index == 1 ? '-_-' : ''}`; + expected = `${index === 2 ? '-_-' : ''}a-b-c${index === 1 ? '-_-' : ''}`; assert.strictEqual(func(string, '_-'), expected); }); @@ -39,7 +39,7 @@ describe('trim methods', () => { it(`\`_.${methodName}\` should coerce \`chars\` to a string`, () => { const object = { toString: lodashStable.constant('_-') }, string = '-_-a-b-c-_-', - expected = `${index == 2 ? '-_-' : ''}a-b-c${index == 1 ? '-_-' : ''}`; + expected = `${index === 2 ? '-_-' : ''}a-b-c${index === 1 ? '-_-' : ''}`; assert.strictEqual(func(string, object), expected); }); @@ -54,7 +54,7 @@ describe('trim methods', () => { it(`\`_.${methodName}\` should work with \`undefined\` or empty string values for \`chars\``, () => { const string = `${whitespace}a b c${whitespace}`, - expected = `${index == 2 ? whitespace : ''}a b c${index == 1 ? whitespace : ''}`; + expected = `${index === 2 ? whitespace : ''}a b c${index === 1 ? whitespace : ''}`; assert.strictEqual(func(string, undefined), expected); assert.strictEqual(func(string, ''), string); @@ -62,7 +62,7 @@ describe('trim methods', () => { it(`\`_.${methodName}\` should work as an iteratee for methods like \`_.map\``, () => { const string = Object(`${whitespace}a b c${whitespace}`), - trimmed = `${index == 2 ? whitespace : ''}a b c${index == 1 ? whitespace : ''}`, + trimmed = `${index === 2 ? whitespace : ''}a b c${index === 1 ? whitespace : ''}`, actual = lodashStable.map([string, string, string], func); assert.deepStrictEqual(actual, [trimmed, trimmed, trimmed]); @@ -70,7 +70,7 @@ describe('trim methods', () => { it(`\`_.${methodName}\` should return an unwrapped value when implicitly chaining`, () => { const string = `${whitespace}a b c${whitespace}`, - expected = `${index == 2 ? whitespace : ''}a b c${index == 1 ? whitespace : ''}`; + expected = `${index === 2 ? whitespace : ''}a b c${index === 1 ? whitespace : ''}`; assert.strictEqual(_(string)[methodName](), expected); }); diff --git a/test/unionWith.spec.ts b/test/unionWith.spec.ts index dc9711cac..b75684ed1 100644 --- a/test/unionWith.spec.ts +++ b/test/unionWith.spec.ts @@ -21,7 +21,7 @@ describe('unionWith', () => { const objects = [{ x: 1, y: 1 }], others = [{ x: 1, y: 2 }]; - const actual = unionWith(objects, others, (a, b) => a.x == b.x); + const actual = unionWith(objects, others, (a, b) => a.x === b.x); assert.deepStrictEqual(actual, [{ x: 1, y: 1 }]); }); diff --git a/test/uniqBy-methods.spec.ts b/test/uniqBy-methods.spec.ts index e8c227df9..a66128dfc 100644 --- a/test/uniqBy-methods.spec.ts +++ b/test/uniqBy-methods.spec.ts @@ -6,7 +6,7 @@ import sortBy from '../src/sortBy'; describe('uniqBy methods', () => { lodashStable.each(['uniqBy', 'sortedUniqBy'], (methodName) => { let func = _[methodName], - isSorted = methodName == 'sortedUniqBy', + isSorted = methodName === 'sortedUniqBy', objects = [{ a: 2 }, { a: 3 }, { a: 1 }, { a: 2 }, { a: 3 }, { a: 1 }]; if (isSorted) { diff --git a/test/values-methods.spec.ts b/test/values-methods.spec.ts index 58faa1c8d..3f37e8b99 100644 --- a/test/values-methods.spec.ts +++ b/test/values-methods.spec.ts @@ -5,7 +5,7 @@ import { _, args, strictArgs } from './utils'; describe('values methods', () => { lodashStable.each(['values', 'valuesIn'], (methodName) => { const func = _[methodName], - isValues = methodName == 'values'; + isValues = methodName === 'values'; it(`\`_.${methodName}\` should get string keyed values of \`object\``, () => { const object = { a: 1, b: 2 }, diff --git a/test/zipObject-methods.spec.ts b/test/zipObject-methods.spec.ts index 32a682fc4..d2b292257 100644 --- a/test/zipObject-methods.spec.ts +++ b/test/zipObject-methods.spec.ts @@ -6,7 +6,7 @@ describe('zipObject methods', () => { lodashStable.each(['zipObject', 'zipObjectDeep'], (methodName) => { const func = _[methodName], object = { barney: 36, fred: 40 }, - isDeep = methodName == 'zipObjectDeep'; + isDeep = methodName === 'zipObjectDeep'; it(`\`_.${methodName}\` should zip together key/value arrays into an object`, () => { const actual = func(['barney', 'fred'], [36, 40]);