diff --git a/.internal/MapCache.js b/.internal/MapCache.js index 0bc511c8b3..706e17e132 100644 --- a/.internal/MapCache.js +++ b/.internal/MapCache.js @@ -12,7 +12,7 @@ import Hash from './Hash.js' function getMapData({ __data__ }, key) { const data = __data__ return isKeyable(key) - ? data[typeof key == 'string' ? 'string' : 'hash'] + ? data[typeof key === 'string' ? 'string' : 'hash'] : data.map } @@ -25,7 +25,7 @@ function getMapData({ __data__ }, key) { */ function isKeyable(value) { const type = typeof value - return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') + return (type === 'string' || type === 'number' || type === 'symbol' || type === 'boolean') ? (value !== '__proto__') : (value === null) } diff --git a/.internal/arrayLikeKeys.js b/.internal/arrayLikeKeys.js index 97e002c447..fea4bcd7fe 100644 --- a/.internal/arrayLikeKeys.js +++ b/.internal/arrayLikeKeys.js @@ -30,7 +30,7 @@ function arrayLikeKeys(value, inherited) { if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && ( // Safari 9 has enumerable `arguments.length` in strict mode. - (key == 'length' || + (key === 'length' || // Skip index properties. isIndex(key, length)) ))) { diff --git a/.internal/assignValue.js b/.internal/assignValue.js index 42884f6047..f9a113df44 100644 --- a/.internal/assignValue.js +++ b/.internal/assignValue.js @@ -16,7 +16,7 @@ function assignValue(object, key, value) { const objValue = object[key] if (!(hasOwnProperty.call(object, key) && eq(objValue, value))) { - if (value !== 0 || (1 / value) == (1 / objValue)) { + if (value !== 0 || (1 / value) === (1 / objValue)) { baseAssignValue(object, key, value) } } else if (value === undefined && !(key in object)) { diff --git a/.internal/baseClone.js b/.internal/baseClone.js index 9caa7975e7..a7157e114d 100644 --- a/.internal/baseClone.js +++ b/.internal/baseClone.js @@ -131,7 +131,7 @@ function initCloneArray(array) { const result = new array.constructor(length) // Add properties assigned by `RegExp#exec`. - if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { + if (length && typeof array[0] === 'string' && hasOwnProperty.call(array, 'index')) { result.index = array.index result.input = array.input } @@ -177,7 +177,7 @@ function baseClone(value, bitmask, customizer, key, object, stack) { return copyArray(value, result) } } else { - const isFunc = typeof value == 'function' + const isFunc = typeof value === 'function' if (isBuffer(value)) { return cloneBuffer(value, isDeep) diff --git a/.internal/baseMatches.js b/.internal/baseMatches.js index f6145fd2dc..cf294ac80b 100644 --- a/.internal/baseMatches.js +++ b/.internal/baseMatches.js @@ -11,7 +11,7 @@ import matchesStrictComparable from './matchesStrictComparable.js' */ function baseMatches(source) { const matchData = getMatchData(source) - if (matchData.length == 1 && matchData[0][2]) { + if (matchData.length === 1 && matchData[0][2]) { return matchesStrictComparable(matchData[0][0], matchData[0][1]) } return (object) => object === source || baseIsMatch(object, source, matchData) diff --git a/.internal/baseMergeDeep.js b/.internal/baseMergeDeep.js index c8e5b197db..445bddc941 100644 --- a/.internal/baseMergeDeep.js +++ b/.internal/baseMergeDeep.js @@ -71,7 +71,7 @@ function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, sta if (isArguments(objValue)) { newValue = toPlainObject(objValue) } - else if (typeof objValue == 'function' || !isObject(objValue)) { + else if (typeof objValue === 'function' || !isObject(objValue)) { newValue = initCloneObject(srcValue) } } diff --git a/.internal/basePullAt.js b/.internal/basePullAt.js index ae7bcda23d..c93b5d4071 100644 --- a/.internal/basePullAt.js +++ b/.internal/basePullAt.js @@ -17,7 +17,7 @@ function basePullAt(array, indexes) { while (length--) { let previous const index = indexes[length] - if (length == lastIndex || index !== previous) { + if (length === lastIndex || index !== previous) { previous = index if (isIndex(index)) { array.splice(index, 1) diff --git a/.internal/baseSortedIndex.js b/.internal/baseSortedIndex.js index 87e5db4851..865e3be5ef 100644 --- a/.internal/baseSortedIndex.js +++ b/.internal/baseSortedIndex.js @@ -21,7 +21,7 @@ function baseSortedIndex(array, value, retHighest) { let low = 0 let high = array == null ? low : array.length - if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) { + if (typeof value === 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) { while (low < high) { const mid = (low + high) >>> 1 const computed = array[mid] diff --git a/.internal/baseToNumber.js b/.internal/baseToNumber.js index a191ab8755..a3b589069e 100644 --- a/.internal/baseToNumber.js +++ b/.internal/baseToNumber.js @@ -12,7 +12,7 @@ const NAN = 0 / 0 * @returns {number} Returns the number. */ function baseToNumber(value) { - if (typeof value == 'number') { + if (typeof value === 'number') { return value } if (isSymbol(value)) { diff --git a/.internal/baseToString.js b/.internal/baseToString.js index a18b49fdab..56822d9ba8 100644 --- a/.internal/baseToString.js +++ b/.internal/baseToString.js @@ -16,7 +16,7 @@ const symbolToString = Symbol.prototype.toString */ function baseToString(value) { // Exit early for strings to avoid a performance hit in some environments. - if (typeof value == 'string') { + if (typeof value === 'string') { return value } if (Array.isArray(value)) { diff --git a/.internal/cloneBuffer.js b/.internal/cloneBuffer.js index 8aeecd545d..f1be8b58fc 100644 --- a/.internal/cloneBuffer.js +++ b/.internal/cloneBuffer.js @@ -1,10 +1,10 @@ import root from './root.js' /** Detect free variable `exports`. */ -const freeExports = typeof exports == 'object' && exports !== null && !exports.nodeType && exports +const freeExports = typeof exports === 'object' && exports !== null && !exports.nodeType && exports /** Detect free variable `module`. */ -const freeModule = freeExports && typeof module == 'object' && module !== null && !module.nodeType && module +const freeModule = freeExports && typeof module === 'object' && module !== null && !module.nodeType && module /** Detect the popular CommonJS extension `module.exports`. */ const moduleExports = freeModule && freeModule.exports === freeExports diff --git a/.internal/compareAscending.js b/.internal/compareAscending.js index 47037e0bbe..d18397677e 100644 --- a/.internal/compareAscending.js +++ b/.internal/compareAscending.js @@ -20,7 +20,7 @@ function compareAscending(value, other) { const othIsReflexive = other === other const othIsSymbol = isSymbol(other) - const val = typeof value == 'string' + const val = typeof value === 'string' ? value.localeCompare(other) : -other diff --git a/.internal/createAssigner.js b/.internal/createAssigner.js index 875240cbb0..b0bfe35c65 100644 --- a/.internal/createAssigner.js +++ b/.internal/createAssigner.js @@ -14,7 +14,7 @@ function createAssigner(assigner) { let customizer = length > 1 ? sources[length - 1] : undefined const guard = length > 2 ? sources[2] : undefined - customizer = (assigner.length > 3 && typeof customizer == 'function') + customizer = (assigner.length > 3 && typeof customizer === 'function') ? (length--, customizer) : undefined diff --git a/.internal/equalObjects.js b/.internal/equalObjects.js index 690452f711..8b884cd943 100644 --- a/.internal/equalObjects.js +++ b/.internal/equalObjects.js @@ -75,8 +75,8 @@ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { // Non `Object` object instances with different constructors are not equal. if (objCtor != othCtor && ('constructor' in object && 'constructor' in other) && - !(typeof objCtor == 'function' && objCtor instanceof objCtor && - typeof othCtor == 'function' && othCtor instanceof othCtor)) { + !(typeof objCtor === 'function' && objCtor instanceof objCtor && + typeof othCtor === 'function' && othCtor instanceof othCtor)) { result = false } } diff --git a/.internal/freeGlobal.js b/.internal/freeGlobal.js index 7b0963c243..59519fe3f1 100644 --- a/.internal/freeGlobal.js +++ b/.internal/freeGlobal.js @@ -1,4 +1,4 @@ /** Detect free variable `global` from Node.js. */ -const freeGlobal = typeof global == 'object' && global !== null && global.Object === Object && global +const freeGlobal = typeof global === 'object' && global !== null && global.Object === Object && global export default freeGlobal diff --git a/.internal/initCloneObject.js b/.internal/initCloneObject.js index 08a5839508..d63a8d40e0 100644 --- a/.internal/initCloneObject.js +++ b/.internal/initCloneObject.js @@ -8,7 +8,7 @@ import isPrototype from './isPrototype.js' * @returns {Object} Returns the initialized clone. */ function initCloneObject(object) { - return (typeof object.constructor == 'function' && !isPrototype(object)) + return (typeof object.constructor === 'function' && !isPrototype(object)) ? Object.create(Object.getPrototypeOf(object)) : {} } diff --git a/.internal/isIndex.js b/.internal/isIndex.js index f53a11f53a..641a0f84a8 100644 --- a/.internal/isIndex.js +++ b/.internal/isIndex.js @@ -17,8 +17,8 @@ function isIndex(value, length) { length = length == null ? MAX_SAFE_INTEGER : length return !!length && - (type == 'number' || - (type != 'symbol' && reIsUint.test(value))) && + (type === 'number' || + (type !== 'symbol' && reIsUint.test(value))) && (value > -1 && value % 1 == 0 && value < length) } diff --git a/.internal/isIterateeCall.js b/.internal/isIterateeCall.js index 0a9430cf6d..0699092929 100644 --- a/.internal/isIterateeCall.js +++ b/.internal/isIterateeCall.js @@ -19,9 +19,9 @@ function isIterateeCall(value, index, object) { return false } const type = typeof index - if (type == 'number' + if (type === 'number' ? (isArrayLike(object) && isIndex(index, object.length)) - : (type == 'string' && index in object) + : (type === 'string' && index in object) ) { return eq(object[index], value) } diff --git a/.internal/isKey.js b/.internal/isKey.js index 45ba8649cc..0b5baddc52 100644 --- a/.internal/isKey.js +++ b/.internal/isKey.js @@ -17,7 +17,7 @@ function isKey(value, object) { return false } const type = typeof value - if (type == 'number' || type == 'boolean' || value == null || isSymbol(value)) { + if (type === 'number' || type === 'boolean' || value == null || isSymbol(value)) { return true } return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || diff --git a/.internal/isPrototype.js b/.internal/isPrototype.js index 0e56cfd291..05e33c83d8 100644 --- a/.internal/isPrototype.js +++ b/.internal/isPrototype.js @@ -10,7 +10,7 @@ const objectProto = Object.prototype */ function isPrototype(value) { const Ctor = value && value.constructor - const proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto + const proto = (typeof Ctor === 'function' && Ctor.prototype) || objectProto return value === proto } diff --git a/.internal/nodeTypes.js b/.internal/nodeTypes.js index 48b59ed476..608c0f9ffe 100644 --- a/.internal/nodeTypes.js +++ b/.internal/nodeTypes.js @@ -1,10 +1,10 @@ import freeGlobal from './freeGlobal.js' /** Detect free variable `exports`. */ -const freeExports = typeof exports == 'object' && exports !== null && !exports.nodeType && exports +const freeExports = typeof exports === 'object' && exports !== null && !exports.nodeType && exports /** Detect free variable `module`. */ -const freeModule = freeExports && typeof module == 'object' && module !== null && !module.nodeType && module +const freeModule = freeExports && typeof module === 'object' && module !== null && !module.nodeType && module /** Detect the popular CommonJS extension `module.exports`. */ const moduleExports = freeModule && freeModule.exports === freeExports diff --git a/.internal/root.js b/.internal/root.js index e59c049530..58abec6ea8 100644 --- a/.internal/root.js +++ b/.internal/root.js @@ -2,10 +2,10 @@ 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 +const freeSelf = typeof self === 'object' && self !== null && self.Object === Object && self /** Used as a reference to the global object. */ const root = freeGlobalThis || freeGlobal || freeSelf || Function('return this')() diff --git a/.internal/toKey.js b/.internal/toKey.js index e4ce9958de..cc450c80df 100644 --- a/.internal/toKey.js +++ b/.internal/toKey.js @@ -11,7 +11,7 @@ const INFINITY = 1 / 0 * @returns {string|symbol} Returns the key. */ function toKey(value) { - if (typeof value == 'string' || isSymbol(value)) { + if (typeof value === 'string' || isSymbol(value)) { return value } const result = `${value}` diff --git a/after.js b/after.js index b323f5a5f2..dade4fd0c0 100644 --- a/after.js +++ b/after.js @@ -16,7 +16,7 @@ * // => Logs 'done saving!' after the two async saves have completed. */ function after(n, func) { - if (typeof func != 'function') { + if (typeof func !== 'function') { throw new TypeError('Expected a function') } n = n || 0 diff --git a/before.js b/before.js index b6cd3e149b..88ba32f409 100644 --- a/before.js +++ b/before.js @@ -15,7 +15,7 @@ */ function before(n, func) { let result - if (typeof func != 'function') { + if (typeof func !== 'function') { throw new TypeError('Expected a function') } return function(...args) { diff --git a/cloneDeepWith.js b/cloneDeepWith.js index 25afd3e56a..4c29b9eaff 100644 --- a/cloneDeepWith.js +++ b/cloneDeepWith.js @@ -33,7 +33,7 @@ const CLONE_SYMBOLS_FLAG = 4 * // => 20 */ function cloneDeepWith(value, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined + customizer = typeof customizer === 'function' ? customizer : undefined return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer) } diff --git a/cloneWith.js b/cloneWith.js index a801faa54d..58da039ce7 100644 --- a/cloneWith.js +++ b/cloneWith.js @@ -33,7 +33,7 @@ const CLONE_SYMBOLS_FLAG = 4 * // => 0 */ function cloneWith(value, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined + customizer = typeof customizer === 'function' ? customizer : undefined return baseClone(value, CLONE_SYMBOLS_FLAG, customizer) } diff --git a/cond.js b/cond.js index 2b09fb5e5d..2927110385 100644 --- a/cond.js +++ b/cond.js @@ -31,7 +31,7 @@ function cond(pairs) { const length = pairs == null ? 0 : pairs.length pairs = !length ? [] : map(pairs, (pair) => { - if (typeof pair[1] != 'function') { + if (typeof pair[1] !== 'function') { throw new TypeError('Expected a function') } return [pair[0], pair[1]] diff --git a/defer.js b/defer.js index c5b5ed9f1b..77c3da601f 100644 --- a/defer.js +++ b/defer.js @@ -13,7 +13,7 @@ * // => Logs 'deferred' after one millisecond. */ function defer(func, ...args) { - if (typeof func != 'function') { + if (typeof func !== 'function') { throw new TypeError('Expected a function') } return setTimeout(func, 1, ...args) diff --git a/delay.js b/delay.js index 377517c79c..52258b280a 100644 --- a/delay.js +++ b/delay.js @@ -14,7 +14,7 @@ * // => Logs 'later' after one second. */ function delay(func, wait, ...args) { - if (typeof func != 'function') { + if (typeof func !== 'function') { throw new TypeError('Expected a function') } return setTimeout(func, +wait || 0, ...args) diff --git a/flip.js b/flip.js index 3c1cb38652..99297aa648 100644 --- a/flip.js +++ b/flip.js @@ -14,7 +14,7 @@ * // => ['d', 'c', 'b', 'a'] */ function flip(func) { - if (typeof func != 'function') { + if (typeof func !== 'function') { throw new TypeError('Expected a function') } return function(...args) { diff --git a/flow.js b/flow.js index a8ca694cd6..7e7ae8961e 100644 --- a/flow.js +++ b/flow.js @@ -11,7 +11,7 @@ * @example * * import add from 'lodash/add' - * + * * function square(n) { * return n * n * } @@ -24,7 +24,7 @@ function flow(...funcs) { const length = funcs ? funcs.length : 0 let index = length while (index--) { - if (typeof funcs[index] != 'function') { + if (typeof funcs[index] !== 'function') { throw new TypeError('Expected a function') } } diff --git a/flowRight.js b/flowRight.js index 7e4e082a19..c1fafff785 100644 --- a/flowRight.js +++ b/flowRight.js @@ -12,7 +12,7 @@ import flow from './flow.js' * @example * * import add from 'lodash/add' - * + * * function square(n) { * return n * n * } diff --git a/functions.js b/functions.js index 9fb75a4d4f..f59d8a737f 100644 --- a/functions.js +++ b/functions.js @@ -23,7 +23,7 @@ function functions(object) { if (object == null) { return [] } - return Object.keys(object).filter((key) => typeof object[key] == 'function') + return Object.keys(object).filter((key) => typeof object[key] === 'function') } export default functions diff --git a/gt.js b/gt.js index 242d96461b..5359e1665a 100644 --- a/gt.js +++ b/gt.js @@ -20,7 +20,7 @@ * // => false */ function gt(value, other) { - if (!(typeof value == 'string' && typeof other == 'string')) { + if (!(typeof value === 'string' && typeof other === 'string')) { value = +value other = +other } diff --git a/gte.js b/gte.js index 1e8980efdc..b6fa0e572c 100644 --- a/gte.js +++ b/gte.js @@ -20,7 +20,7 @@ * // => false */ function gte(value, other) { - if (!(typeof value == 'string' && typeof other == 'string')) { + if (!(typeof value === 'string' && typeof other === 'string')) { value = +value other = +other } diff --git a/intersectionWith.js b/intersectionWith.js index 7033b18a59..7621de8c3f 100644 --- a/intersectionWith.js +++ b/intersectionWith.js @@ -26,7 +26,7 @@ function intersectionWith(...arrays) { let comparator = last(arrays) const mapped = map(arrays, castArrayLikeObject) - comparator = typeof comparator == 'function' ? comparator : undefined + comparator = typeof comparator === 'function' ? comparator : undefined if (comparator) { mapped.pop() } diff --git a/invert.js b/invert.js index 570955838c..f6e67398c8 100644 --- a/invert.js +++ b/invert.js @@ -20,7 +20,7 @@ function invert(object) { const result = {} Object.keys(object).forEach((key) => { let value = object[key] - if (value != null && typeof value.toString != 'function') { + if (value != null && typeof value.toString !== 'function') { value = toString.call(value) } result[value] = key diff --git a/invokeMap.js b/invokeMap.js index ace13da241..f52890b494 100644 --- a/invokeMap.js +++ b/invokeMap.js @@ -25,7 +25,7 @@ import isArrayLike from './isArrayLike.js' */ function invokeMap(collection, path, args) { let index = -1 - const isFunc = typeof path == 'function' + const isFunc = typeof path === 'function' const result = isArrayLike(collection) ? new Array(collection.length) : [] baseEach(collection, (value) => { diff --git a/isArrayLike.js b/isArrayLike.js index 73f8b633c0..ab72a63538 100644 --- a/isArrayLike.js +++ b/isArrayLike.js @@ -24,7 +24,7 @@ import isLength from './isLength.js' * // => false */ function isArrayLike(value) { - return value != null && typeof value != 'function' && isLength(value.length) + return value != null && typeof value !== 'function' && isLength(value.length) } export default isArrayLike diff --git a/isBuffer.js b/isBuffer.js index 418a30c584..1831fe3a22 100644 --- a/isBuffer.js +++ b/isBuffer.js @@ -1,10 +1,10 @@ import root from './.internal/root.js' /** Detect free variable `exports`. */ -const freeExports = typeof exports == 'object' && exports !== null && !exports.nodeType && exports +const freeExports = typeof exports === 'object' && exports !== null && !exports.nodeType && exports /** Detect free variable `module`. */ -const freeModule = freeExports && typeof module == 'object' && module !== null && !module.nodeType && module +const freeModule = freeExports && typeof module === 'object' && module !== null && !module.nodeType && module /** Detect the popular CommonJS extension `module.exports`. */ const moduleExports = freeModule && freeModule.exports === freeExports diff --git a/isEmpty.js b/isEmpty.js index c443f44104..346b051405 100644 --- a/isEmpty.js +++ b/isEmpty.js @@ -47,7 +47,7 @@ function isEmpty(value) { return true } if (isArrayLike(value) && - (Array.isArray(value) || typeof value == 'string' || typeof value.splice == 'function' || + (Array.isArray(value) || typeof value === 'string' || typeof value.splice === 'function' || isBuffer(value) || isTypedArray(value) || isArguments(value))) { return !value.length } diff --git a/isEqualWith.js b/isEqualWith.js index 4db2a33d97..98ab4f7b01 100644 --- a/isEqualWith.js +++ b/isEqualWith.js @@ -31,7 +31,7 @@ import baseIsEqual from './.internal/baseIsEqual.js' * // => true */ function isEqualWith(value, other, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined + customizer = typeof customizer === 'function' ? customizer : undefined const result = customizer ? customizer(value, other) : undefined return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result } diff --git a/isError.js b/isError.js index a0c65d3e45..1e85ff5a80 100644 --- a/isError.js +++ b/isError.js @@ -24,7 +24,7 @@ function isError(value) { } const tag = getTag(value) return tag == '[object Error]' || tag == '[object DOMException]' || - (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value)) + (typeof value.message === 'string' && typeof value.name === 'string' && !isPlainObject(value)) } export default isError diff --git a/isLength.js b/isLength.js index cd34a53eda..193f254e87 100644 --- a/isLength.js +++ b/isLength.js @@ -26,7 +26,7 @@ const MAX_SAFE_INTEGER = 9007199254740991 * // => false */ function isLength(value) { - return typeof value == 'number' && + return typeof value === 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER } diff --git a/isMatchWith.js b/isMatchWith.js index 7c62e184c1..79ef07a57a 100644 --- a/isMatchWith.js +++ b/isMatchWith.js @@ -32,7 +32,7 @@ import getMatchData from './.internal/getMatchData.js' * // => true */ function isMatchWith(object, source, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined + customizer = typeof customizer === 'function' ? customizer : undefined return baseIsMatch(object, source, getMatchData(source), customizer) } diff --git a/isNumber.js b/isNumber.js index db9e5efb1e..bb808a2c48 100644 --- a/isNumber.js +++ b/isNumber.js @@ -27,7 +27,7 @@ import isObjectLike from './isObjectLike.js' * // => false */ function isNumber(value) { - return typeof value == 'number' || + return typeof value === 'number' || (isObjectLike(value) && getTag(value) == '[object Number]') } diff --git a/isObject.js b/isObject.js index 5ad8eaff83..e9e81bff51 100644 --- a/isObject.js +++ b/isObject.js @@ -23,7 +23,7 @@ */ function isObject(value) { const type = typeof value - return value != null && (type == 'object' || type == 'function') + return value != null && (type === 'object' || type === 'function') } export default isObject diff --git a/isObjectLike.js b/isObjectLike.js index 2e575ded5f..7175076a85 100644 --- a/isObjectLike.js +++ b/isObjectLike.js @@ -21,7 +21,7 @@ * // => false */ function isObjectLike(value) { - return typeof value == 'object' && value !== null + return typeof value === 'object' && value !== null } export default isObjectLike diff --git a/isString.js b/isString.js index b9ec3ae596..b5470a9cc8 100644 --- a/isString.js +++ b/isString.js @@ -17,7 +17,7 @@ import getTag from './.internal/getTag.js' */ function isString(value) { const type = typeof value - return type == 'string' || (type == 'object' && value != null && !Array.isArray(value) && getTag(value) == '[object String]') + return type === 'string' || (type === 'object' && value != null && !Array.isArray(value) && getTag(value) == '[object String]') } export default isString diff --git a/isSymbol.js b/isSymbol.js index 8ea537f4ef..0cf4c70e59 100644 --- a/isSymbol.js +++ b/isSymbol.js @@ -17,7 +17,7 @@ import getTag from './.internal/getTag.js' */ function isSymbol(value) { const type = typeof value - return type == 'symbol' || (type == 'object' && value != null && getTag(value) == '[object Symbol]') + return type == 'symbol' || (type === 'object' && value != null && getTag(value) == '[object Symbol]') } export default isSymbol diff --git a/lt.js b/lt.js index 303bc56a0a..f2acbcdaad 100644 --- a/lt.js +++ b/lt.js @@ -20,7 +20,7 @@ * // => false */ function lt(value, other) { - if (!(typeof value == 'string' && typeof other == 'string')) { + if (!(typeof value === 'string' && typeof other === 'string')) { value = +value other = +other } diff --git a/lte.js b/lte.js index 1e5abfadb7..ef7ef451f4 100644 --- a/lte.js +++ b/lte.js @@ -20,7 +20,7 @@ * // => false */ function lte(value, other) { - if (!(typeof value == 'string' && typeof other == 'string')) { + if (!(typeof value === 'string' && typeof other === 'string')) { value = +value other = +other } diff --git a/memoize.js b/memoize.js index 6b84366e7e..8e41558ecd 100644 --- a/memoize.js +++ b/memoize.js @@ -41,7 +41,7 @@ * memoize.Cache = WeakMap */ function memoize(func, resolver) { - if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) { + if (typeof func !== 'function' || (resolver != null && typeof resolver !== 'function')) { throw new TypeError('Expected a function') } const memoized = function(...args) { diff --git a/negate.js b/negate.js index d1175e969c..2e2f863f17 100644 --- a/negate.js +++ b/negate.js @@ -17,7 +17,7 @@ * // => [1, 3, 5] */ function negate(predicate) { - if (typeof predicate != 'function') { + if (typeof predicate !== 'function') { throw new TypeError('Expected a function') } return function(...args) { diff --git a/random.js b/random.js index c906109da4..0af867a8a2 100644 --- a/random.js +++ b/random.js @@ -35,11 +35,11 @@ const freeParseFloat = parseFloat */ function random(lower, upper, floating) { if (floating === undefined) { - if (typeof upper == 'boolean') { + if (typeof upper === 'boolean') { floating = upper upper = undefined } - else if (typeof lower == 'boolean') { + else if (typeof lower === 'boolean') { floating = lower lower = undefined } diff --git a/result.js b/result.js index 7d3e45dbbd..e121780091 100644 --- a/result.js +++ b/result.js @@ -45,7 +45,7 @@ function result(object, path, defaultValue) { index = length value = defaultValue } - object = typeof value == 'function' ? value.call(object) : value + object = typeof value === 'function' ? value.call(object) : value } return object } diff --git a/setWith.js b/setWith.js index 80ae1a3aab..b070940ca1 100644 --- a/setWith.js +++ b/setWith.js @@ -23,7 +23,7 @@ import baseSet from './.internal/baseSet.js' * // => { '0': { '1': 'a' } } */ function setWith(object, path, value, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined + customizer = typeof customizer === 'function' ? customizer : undefined return object == null ? object : baseSet(object, path, value, customizer) } diff --git a/split.js b/split.js index 5d9dcc62f7..e997c4a7fc 100644 --- a/split.js +++ b/split.js @@ -29,7 +29,7 @@ function split(string, separator, limit) { return [] } if (string && ( - typeof separator == 'string' || + typeof separator === 'string' || (separator != null && !isRegExp(separator)) )) { if (!separator && hasUnicode(string)) { diff --git a/test/basename.js b/test/basename.js index 19f6a32808..e60f937960 100644 --- a/test/basename.js +++ b/test/basename.js @@ -42,7 +42,7 @@ describe(basename, function() { var attempt = function() { var actual = _VERSION; - if ((new Date - start) < limit && typeof actual != 'string') { + if ((new Date - start) < limit && typeof actual !== 'string') { setTimeout(attempt, 16); return; } diff --git a/test/bind.js b/test/bind.js index efc16bf91d..384ddd9b37 100644 --- a/test/bind.js +++ b/test/bind.js @@ -195,7 +195,7 @@ describe('bind', function() { it('should not error when calling bound class constructors with the `new` operator', function() { var createCtor = lodashStable.attempt(Function, '"use strict";return class A{}'); - if (typeof createCtor == 'function') { + if (typeof createCtor === 'function') { var bound = bind(createCtor()), count = 8, expected = lodashStable.times(count, stubTrue); diff --git a/test/isFunction.js b/test/isFunction.js index 6c4b5c01f3..be051d63c4 100644 --- a/test/isFunction.js +++ b/test/isFunction.js @@ -25,11 +25,11 @@ describe('isFunction', function() { }); it('should return `true` for async functions', function() { - assert.strictEqual(isFunction(asyncFunc), typeof asyncFunc == 'function'); + assert.strictEqual(isFunction(asyncFunc), typeof asyncFunc === 'function'); }); it('should return `true` for generator functions', function() { - assert.strictEqual(isFunction(genFunc), typeof genFunc == 'function'); + assert.strictEqual(isFunction(genFunc), typeof genFunc === 'function'); }); it('should return `true` for the `Proxy` constructor', function() { diff --git a/test/isNumber.test.js b/test/isNumber.test.js index 9764538bf8..fd9ff6bb39 100644 --- a/test/isNumber.test.js +++ b/test/isNumber.test.js @@ -12,7 +12,7 @@ describe('isNumber', function() { it('should return `false` for non-numbers', function() { var expected = lodashStable.map(falsey, function(value) { - return typeof value == 'number'; + return typeof value === 'number'; }); var actual = lodashStable.map(falsey, function(value, index) { diff --git a/test/keys-methods.js b/test/keys-methods.js index 8e422bd933..e45e9b320d 100644 --- a/test/keys-methods.js +++ b/test/keys-methods.js @@ -139,7 +139,7 @@ describe('keys methods', function() { it('`_.' + methodName + '` should coerce primitives to objects (test in IE 9)', function() { var expected = lodashStable.map(primitives, function(value) { - return typeof value == 'string' ? ['0'] : []; + return typeof value === 'string' ? ['0'] : []; }); var actual = lodashStable.map(primitives, func); diff --git a/test/utils.js b/test/utils.js index 890212c458..19d327a03c 100644 --- a/test/utils.js +++ b/test/utils.js @@ -24,7 +24,7 @@ var funcTag = '[object Function]', objectTag = '[object Object]'; /** Used as a reference to the global object. */ -var root = (typeof global == 'object' && global) || this; +var root = (typeof global === 'object' && global) || this; /** Used to store lodash to test for bad extensions/shims. */ var lodashBizarro = root.lodashBizarro; @@ -246,7 +246,7 @@ var isModularize = ui.isModularize; var isNpm = isModularize && /\bnpm\b/.test([ui.buildPath, ui.urlParams.build]); /** Detect if running in PhantomJS. */ -var isPhantom = phantom || (typeof callPhantom == 'function'); +var isPhantom = phantom || (typeof callPhantom === 'function'); /** Detect if lodash is in strict mode. */ var isStrict = ui.isStrict; @@ -459,7 +459,7 @@ function toArgs(array) { // Add bizarro values. (function() { return; // fixme - if (document || (typeof require != 'function')) { + if (document || (typeof require !== 'function')) { return; } var nativeString = fnToString.call(toString), diff --git a/toNumber.js b/toNumber.js index f909a9f005..d4bbca4d14 100644 --- a/toNumber.js +++ b/toNumber.js @@ -42,17 +42,17 @@ const freeParseInt = parseInt * // => 3.2 */ function toNumber(value) { - if (typeof value == 'number') { + if (typeof value === 'number') { return value } if (isSymbol(value)) { return NAN } if (isObject(value)) { - const other = typeof value.valueOf == 'function' ? value.valueOf() : value + const other = typeof value.valueOf === 'function' ? value.valueOf() : value value = isObject(other) ? `${other}` : other } - if (typeof value != 'string') { + if (typeof value !== 'string') { return value === 0 ? value : +value } value = value.replace(reTrim, '') diff --git a/toString.js b/toString.js index 6b4fc2e11b..6ba676506d 100644 --- a/toString.js +++ b/toString.js @@ -27,7 +27,7 @@ function toString(value) { return '' } // Exit early for strings to avoid a performance hit in some environments. - if (typeof value == 'string') { + if (typeof value === 'string') { return value } if (Array.isArray(value)) { diff --git a/transform.js b/transform.js index db279dbc66..b421cb9bea 100644 --- a/transform.js +++ b/transform.js @@ -43,7 +43,7 @@ function transform(object, iteratee, accumulator) { accumulator = isArr ? new Ctor : [] } else if (isObject(object)) { - accumulator = typeof Ctor == 'function' + accumulator = typeof Ctor === 'function' ? Object.create(Object.getPrototypeOf(object)) : {} } diff --git a/unionWith.js b/unionWith.js index 6612831ef9..c5c3be9328 100644 --- a/unionWith.js +++ b/unionWith.js @@ -25,7 +25,7 @@ import last from './last.js' */ function unionWith(...arrays) { let comparator = last(arrays) - comparator = typeof comparator == 'function' ? comparator : undefined + comparator = typeof comparator === 'function' ? comparator : undefined return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator) } diff --git a/uniqWith.js b/uniqWith.js index ee3005d811..77feac13f2 100644 --- a/uniqWith.js +++ b/uniqWith.js @@ -20,7 +20,7 @@ import baseUniq from './.internal/baseUniq.js' * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }] */ function uniqWith(array, comparator) { - comparator = typeof comparator == 'function' ? comparator : undefined + comparator = typeof comparator === 'function' ? comparator : undefined return (array != null && array.length) ? baseUniq(array, undefined, comparator) : [] diff --git a/updateWith.js b/updateWith.js index 77c53d4c15..60a37e1479 100644 --- a/updateWith.js +++ b/updateWith.js @@ -23,7 +23,7 @@ import baseUpdate from './.internal/baseUpdate.js' * // => { '0': { '1': 'a' } } */ function updateWith(object, path, updater, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined + customizer = typeof customizer === 'function' ? customizer : undefined return object == null ? object : baseUpdate(object, path, updater, customizer) } diff --git a/xorWith.js b/xorWith.js index e53b670528..97775d7061 100644 --- a/xorWith.js +++ b/xorWith.js @@ -24,7 +24,7 @@ import last from './last.js' */ function xorWith(...arrays) { let comparator = last(arrays) - comparator = typeof comparator == 'function' ? comparator : undefined + comparator = typeof comparator === 'function' ? comparator : undefined return baseXor(arrays.filter(isArrayLikeObject), undefined, comparator) } diff --git a/zipWith.js b/zipWith.js index 3bed598181..30989ac591 100644 --- a/zipWith.js +++ b/zipWith.js @@ -20,7 +20,7 @@ import unzipWith from './unzipWith.js' function zipWith(...arrays) { const length = arrays.length let iteratee = length > 1 ? arrays[length - 1] : undefined - iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined + iteratee = typeof iteratee === 'function' ? (arrays.pop(), iteratee) : undefined return unzipWith(arrays, iteratee) }