Skip to content

Commit

Permalink
wip: code formatting nits
Browse files Browse the repository at this point in the history
  • Loading branch information
jdalton committed Sep 16, 2023
1 parent 97d4a2f commit 0b28b7f
Show file tree
Hide file tree
Showing 107 changed files with 166 additions and 164 deletions.
2 changes: 1 addition & 1 deletion src/.internal/ListCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/.internal/MapCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/.internal/baseAssignValue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions src/.internal/baseClone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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))
})
Expand Down
2 changes: 1 addition & 1 deletion src/.internal/baseGet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 5 additions & 5 deletions src/.internal/baseIsEqualDeep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
2 changes: 1 addition & 1 deletion src/.internal/baseSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/.internal/baseSortedIndexBy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion src/.internal/baseXor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/.internal/compareMultiple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion src/.internal/createSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
: () => {}

Expand Down
4 changes: 2 additions & 2 deletions src/.internal/equalArrays.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions src/.internal/equalByTag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
Expand All @@ -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

Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/.internal/equalObjects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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)) {
Expand Down
2 changes: 1 addition & 1 deletion src/.internal/isIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion src/.internal/root.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/.internal/toKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions src/endsWith.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
2 changes: 1 addition & 1 deletion src/findLast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/findLastIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/hasPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/hasPathIn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/isArguments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
2 changes: 1 addition & 1 deletion src/isArrayBuffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
2 changes: 1 addition & 1 deletion src/isBoolean.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function isBoolean(value) {
return (
value === true ||
value === false ||
(isObjectLike(value) && getTag(value) == '[object Boolean]')
(isObjectLike(value) && getTag(value) === '[object Boolean]')
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/isDate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
2 changes: 1 addition & 1 deletion src/isEmpty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
4 changes: 2 additions & 2 deletions src/isError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion src/isLength.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
2 changes: 1 addition & 1 deletion src/isMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
4 changes: 3 additions & 1 deletion src/isNumber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit 0b28b7f

Please sign in to comment.