wip: code formatting nits

This commit is contained in:
jdalton
2023-09-16 16:18:43 -07:00
parent 97d4a2fe19
commit 0b28b7f7b6
107 changed files with 166 additions and 164 deletions

View File

@@ -45,7 +45,7 @@ class ListCache {
return false return false
} }
const lastIndex = data.length - 1 const lastIndex = data.length - 1
if (index == lastIndex) { if (index === lastIndex) {
data.pop() data.pop()
} else { } else {
data.splice(index, 1) data.splice(index, 1)

View File

@@ -112,7 +112,7 @@ class MapCache {
const size = data.size const size = data.size
data.set(key, value) data.set(key, value)
this.size += data.size == size ? 0 : 1 this.size += data.size === size ? 0 : 1
return this return this
} }
} }

View File

@@ -8,7 +8,7 @@
* @param {*} value The value to assign. * @param {*} value The value to assign.
*/ */
function baseAssignValue(object, key, value) { function baseAssignValue(object, key, value) {
if (key == '__proto__') { if (key === '__proto__') {
Object.defineProperty(object, key, { Object.defineProperty(object, key, {
'configurable': true, 'configurable': true,
'enumerable': true, 'enumerable': true,

View File

@@ -182,7 +182,7 @@ function baseClone(value, bitmask, customizer, key, object, stack) {
if (isBuffer(value)) { if (isBuffer(value)) {
return cloneBuffer(value, isDeep) return cloneBuffer(value, isDeep)
} }
if (tag == objectTag || tag == argsTag || (isFunc && !object)) { if (tag === objectTag || tag === argsTag || (isFunc && !object)) {
result = (isFlat || isFunc) ? {} : initCloneObject(value) result = (isFlat || isFunc) ? {} : initCloneObject(value)
if (!isDeep) { if (!isDeep) {
return isFlat return isFlat
@@ -204,14 +204,14 @@ function baseClone(value, bitmask, customizer, key, object, stack) {
} }
stack.set(value, result) stack.set(value, result)
if (tag == mapTag) { if (tag === mapTag) {
value.forEach((subValue, key) => { value.forEach((subValue, key) => {
result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack)) result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack))
}) })
return result return result
} }
if (tag == setTag) { if (tag === setTag) {
value.forEach((subValue) => { value.forEach((subValue) => {
result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)) result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack))
}) })

View File

@@ -18,7 +18,7 @@ function baseGet(object, path) {
while (object != null && index < length) { while (object != null && index < length) {
object = object[toKey(path[index++])] object = object[toKey(path[index++])]
} }
return (index && index == length) ? object : undefined return (index && index === length) ? object : undefined
} }
export default baseGet export default baseGet

View File

@@ -37,12 +37,12 @@ function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
let objTag = objIsArr ? arrayTag : getTag(object) let objTag = objIsArr ? arrayTag : getTag(object)
let othTag = othIsArr ? arrayTag : getTag(other) let othTag = othIsArr ? arrayTag : getTag(other)
objTag = objTag == argsTag ? objectTag : objTag objTag = objTag === argsTag ? objectTag : objTag
othTag = othTag == argsTag ? objectTag : othTag othTag = othTag === argsTag ? objectTag : othTag
let objIsObj = objTag == objectTag let objIsObj = objTag === objectTag
const othIsObj = othTag == objectTag const othIsObj = othTag === objectTag
const isSameTag = objTag == othTag const isSameTag = objTag === othTag
if (isSameTag && isBuffer(object)) { if (isSameTag && isBuffer(object)) {
if (!isBuffer(other)) { if (!isBuffer(other)) {

View File

@@ -30,7 +30,7 @@ function baseSet(object, path, value, customizer) {
const key = toKey(path[index]) const key = toKey(path[index])
let newValue = value let newValue = value
if (index != lastIndex) { if (index !== lastIndex) {
const objValue = nested[key] const objValue = nested[key]
newValue = customizer ? customizer(objValue, key, nested) : undefined newValue = customizer ? customizer(objValue, key, nested) : undefined
if (newValue === undefined) { if (newValue === undefined) {

View File

@@ -20,7 +20,7 @@ const MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1
function baseSortedIndexBy(array, value, iteratee, retHighest) { function baseSortedIndexBy(array, value, iteratee, retHighest) {
let low = 0 let low = 0
let high = array == null ? 0 : array.length let high = array == null ? 0 : array.length
if (high == 0) { if (high === 0) {
return 0 return 0
} }

View File

@@ -25,7 +25,7 @@ function baseXor(arrays, iteratee, comparator) {
let othIndex = -1 let othIndex = -1
while (++othIndex < length) { while (++othIndex < length) {
if (othIndex != index) { if (othIndex !== index) {
result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator) result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator)
} }
} }

View File

@@ -27,7 +27,7 @@ function compareMultiple(object, other, orders) {
const result = cmpFn(objCriteria[index], othCriteria[index]) const result = cmpFn(objCriteria[index], othCriteria[index])
if (result) { if (result) {
if (order && typeof order !== 'function') { if (order && typeof order !== 'function') {
return result * (order == 'desc' ? -1 : 1) return result * (order === 'desc' ? -1 : 1)
} }
return result return result
} }

View File

@@ -10,7 +10,7 @@ const INFINITY = 1 / 0
* @param {Array} values The values to add to the set. * @param {Array} values The values to add to the set.
* @returns {Object} Returns the new 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) ? (values) => new Set(values)
: () => {} : () => {}

View File

@@ -24,13 +24,13 @@ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
const arrLength = array.length const arrLength = array.length
const othLength = other.length const othLength = other.length
if (arrLength != othLength && !(isPartial && othLength > arrLength)) { if (arrLength !== othLength && !(isPartial && othLength > arrLength)) {
return false return false
} }
// Assume cyclic values are equal. // Assume cyclic values are equal.
const stacked = stack.get(array) const stacked = stack.get(array)
if (stacked && stack.get(other)) { if (stacked && stack.get(other)) {
return stacked == other return stacked === other
} }
let index = -1 let index = -1
let result = true let result = true

View File

@@ -44,15 +44,15 @@ const symbolValueOf = Symbol.prototype.valueOf
function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
switch (tag) { switch (tag) {
case dataViewTag: case dataViewTag:
if ((object.byteLength != other.byteLength) || if ((object.byteLength !== other.byteLength) ||
(object.byteOffset != other.byteOffset)) { (object.byteOffset !== other.byteOffset)) {
return false return false
} }
object = object.buffer object = object.buffer
other = other.buffer other = other.buffer
case arrayBufferTag: case arrayBufferTag:
if ((object.byteLength != other.byteLength) || if ((object.byteLength !== other.byteLength) ||
!equalFunc(new Uint8Array(object), new Uint8Array(other))) { !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
return false return false
} }
@@ -66,14 +66,14 @@ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
return eq(+object, +other) return eq(+object, +other)
case errorTag: case errorTag:
return object.name == other.name && object.message == other.message return object.name === other.name && object.message === other.message
case regexpTag: case regexpTag:
case stringTag: case stringTag:
// Coerce regexes to strings and treat strings, primitives and objects, // 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 // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
// for more details. // for more details.
return object == `${other}` return object === `${other}`
case mapTag: case mapTag:
let convert = mapToArray let convert = mapToArray
@@ -82,13 +82,13 @@ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
const isPartial = bitmask & COMPARE_PARTIAL_FLAG const isPartial = bitmask & COMPARE_PARTIAL_FLAG
convert || (convert = setToArray) convert || (convert = setToArray)
if (object.size != other.size && !isPartial) { if (object.size !== other.size && !isPartial) {
return false return false
} }
// Assume cyclic values are equal. // Assume cyclic values are equal.
const stacked = stack.get(object) const stacked = stack.get(object)
if (stacked) { if (stacked) {
return stacked == other return stacked === other
} }
bitmask |= COMPARE_UNORDERED_FLAG bitmask |= COMPARE_UNORDERED_FLAG
@@ -100,7 +100,7 @@ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
case symbolTag: case symbolTag:
if (symbolValueOf) { if (symbolValueOf) {
return symbolValueOf.call(object) == symbolValueOf.call(other) return symbolValueOf.call(object) === symbolValueOf.call(other)
} }
} }
return false return false

View File

@@ -26,7 +26,7 @@ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
const othProps = getAllKeys(other) const othProps = getAllKeys(other)
const othLength = othProps.length const othLength = othProps.length
if (objLength != othLength && !isPartial) { if (objLength !== othLength && !isPartial) {
return false return false
} }
let key let key
@@ -40,7 +40,7 @@ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
// Assume cyclic values are equal. // Assume cyclic values are equal.
const stacked = stack.get(object) const stacked = stack.get(object)
if (stacked && stack.get(other)) { if (stacked && stack.get(other)) {
return stacked == other return stacked === other
} }
let result = true let result = true
stack.set(object, other) stack.set(object, other)
@@ -66,14 +66,14 @@ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
result = false result = false
break break
} }
skipCtor || (skipCtor = key == 'constructor') skipCtor || (skipCtor = key === 'constructor')
} }
if (result && !skipCtor) { if (result && !skipCtor) {
const objCtor = object.constructor const objCtor = object.constructor
const othCtor = other.constructor const othCtor = other.constructor
// Non `Object` object instances with different constructors are not equal. // Non `Object` object instances with different constructors are not equal.
if (objCtor != othCtor && if (objCtor !== othCtor &&
('constructor' in object && 'constructor' in other) && ('constructor' in object && 'constructor' in other) &&
!(typeof objCtor === 'function' && objCtor instanceof objCtor && !(typeof objCtor === 'function' && objCtor instanceof objCtor &&
typeof othCtor === 'function' && othCtor instanceof othCtor)) { typeof othCtor === 'function' && othCtor instanceof othCtor)) {

View File

@@ -19,7 +19,7 @@ function isIndex(value, length) {
return !!length && return !!length &&
(type === 'number' || (type === 'number' ||
(type !== 'symbol' && reIsUint.test(value))) && (type !== 'symbol' && reIsUint.test(value))) &&
(value > -1 && value % 1 == 0 && value < length) (value > -1 && value % 1 === 0 && value < length)
} }
export default isIndex export default isIndex

View File

@@ -2,7 +2,7 @@
import freeGlobal from './freeGlobal.js' import freeGlobal from './freeGlobal.js'
/** Detect free variable `globalThis` */ /** 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`. */ /** 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

View File

@@ -15,7 +15,7 @@ function toKey(value) {
return value return value
} }
const result = `${value}` const result = `${value}`
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result return (result === '0' && (1 / value) === -INFINITY) ? '-0' : result
} }
export default toKey export default toKey

View File

@@ -23,14 +23,14 @@
function endsWith(string, target, position) { function endsWith(string, target, position) {
const { length } = string; const { length } = string;
position = position === undefined ? length : +position; position = position === undefined ? length : +position;
if (position < 0 || position != position) { if (position < 0 || position !== position) {
position = 0; position = 0;
} else if (position > length) { } else if (position > length) {
position = length; position = length;
} }
const end = position; const end = position;
position -= target.length; position -= target.length;
return position >= 0 && string.slice(position, end) == target; return position >= 0 && string.slice(position, end) === target;
} }
export default endsWith; export default endsWith;

View File

@@ -14,7 +14,7 @@ import isArrayLike from './isArrayLike.js';
* @see find, findIndex, findKey, findLastIndex, findLastKey * @see find, findIndex, findKey, findLastIndex, findLastKey
* @example * @example
* *
* findLast([1, 2, 3, 4], n => n % 2 == 1) * findLast([1, 2, 3, 4], n => n % 2 === 1)
* // => 3 * // => 3
*/ */
function findLast(collection, predicate, fromIndex) { function findLast(collection, predicate, fromIndex) {

View File

@@ -20,7 +20,7 @@ import toInteger from './toInteger.js';
* { 'user': 'pebbles', 'active': false } * { 'user': 'pebbles', 'active': false }
* ] * ]
* *
* findLastIndex(users, ({ user }) => user == 'pebbles') * findLastIndex(users, ({ user }) => user === 'pebbles')
* // => 2 * // => 2
*/ */
function findLastIndex(array, predicate, fromIndex) { function findLastIndex(array, predicate, fromIndex) {

View File

@@ -42,7 +42,7 @@ function hasPath(object, path) {
} }
object = object[key]; object = object[key];
} }
if (result || ++index != length) { if (result || ++index !== length) {
return result; return result;
} }
length = object == null ? 0 : object.length; length = object == null ? 0 : object.length;

View File

@@ -39,7 +39,7 @@ function hasPathIn(object, path) {
} }
object = object[key]; object = object[key];
} }
if (result || ++index != length) { if (result || ++index !== length) {
return result; return result;
} }
length = object == null ? 0 : object.length; length = object == null ? 0 : object.length;

View File

@@ -17,7 +17,7 @@ import isObjectLike from './isObjectLike.js';
* // => false * // => false
*/ */
function isArguments(value) { function isArguments(value) {
return isObjectLike(value) && getTag(value) == '[object Arguments]'; return isObjectLike(value) && getTag(value) === '[object Arguments]';
} }
export default isArguments; export default isArguments;

View File

@@ -22,6 +22,6 @@ const nodeIsArrayBuffer = nodeTypes && nodeTypes.isArrayBuffer;
*/ */
const isArrayBuffer = nodeIsArrayBuffer const isArrayBuffer = nodeIsArrayBuffer
? (value) => nodeIsArrayBuffer(value) ? (value) => nodeIsArrayBuffer(value)
: (value) => isObjectLike(value) && getTag(value) == '[object ArrayBuffer]'; : (value) => isObjectLike(value) && getTag(value) === '[object ArrayBuffer]';
export default isArrayBuffer; export default isArrayBuffer;

View File

@@ -20,7 +20,7 @@ function isBoolean(value) {
return ( return (
value === true || value === true ||
value === false || value === false ||
(isObjectLike(value) && getTag(value) == '[object Boolean]') (isObjectLike(value) && getTag(value) === '[object Boolean]')
); );
} }

View File

@@ -22,6 +22,6 @@ const nodeIsDate = nodeTypes && nodeTypes.isDate;
*/ */
const isDate = nodeIsDate const isDate = nodeIsDate
? (value) => nodeIsDate(value) ? (value) => nodeIsDate(value)
: (value) => isObjectLike(value) && getTag(value) == '[object Date]'; : (value) => isObjectLike(value) && getTag(value) === '[object Date]';
export default isDate; export default isDate;

View File

@@ -58,7 +58,7 @@ function isEmpty(value) {
return !value.length; return !value.length;
} }
const tag = getTag(value); const tag = getTag(value);
if (tag == '[object Map]' || tag == '[object Set]') { if (tag === '[object Map]' || tag === '[object Set]') {
return !value.size; return !value.size;
} }
if (isPrototype(value)) { if (isPrototype(value)) {

View File

@@ -24,8 +24,8 @@ function isError(value) {
} }
const tag = getTag(value); const tag = getTag(value);
return ( return (
tag == '[object Error]' || tag === '[object Error]' ||
tag == '[object DOMException]' || tag === '[object DOMException]' ||
(typeof value.message === 'string' && (typeof value.message === 'string' &&
typeof value.name === 'string' && typeof value.name === 'string' &&
!isPlainObject(value)) !isPlainObject(value))

View File

@@ -26,7 +26,7 @@ const MAX_SAFE_INTEGER = 9007199254740991;
* // => false * // => false
*/ */
function isLength(value) { 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; export default isLength;

View File

@@ -22,6 +22,6 @@ const nodeIsMap = nodeTypes && nodeTypes.isMap;
*/ */
const isMap = nodeIsMap const isMap = nodeIsMap
? (value) => nodeIsMap(value) ? (value) => nodeIsMap(value)
: (value) => isObjectLike(value) && getTag(value) == '[object Map]'; : (value) => isObjectLike(value) && getTag(value) === '[object Map]';
export default isMap; export default isMap;

View File

@@ -27,7 +27,9 @@ import isObjectLike from './isObjectLike.js';
* // => false * // => false
*/ */
function isNumber(value) { 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; export default isNumber;

View File

@@ -28,7 +28,7 @@ import isObjectLike from './isObjectLike.js';
* // => true * // => true
*/ */
function isPlainObject(value) { function isPlainObject(value) {
if (!isObjectLike(value) || getTag(value) != '[object Object]') { if (!isObjectLike(value) || getTag(value) !== '[object Object]') {
return false; return false;
} }
if (Object.getPrototypeOf(value) === null) { if (Object.getPrototypeOf(value) === null) {

View File

@@ -22,6 +22,6 @@ const nodeIsRegExp = nodeTypes && nodeTypes.isRegExp;
*/ */
const isRegExp = nodeIsRegExp const isRegExp = nodeIsRegExp
? (value) => nodeIsRegExp(value) ? (value) => nodeIsRegExp(value)
: (value) => isObjectLike(value) && getTag(value) == '[object RegExp]'; : (value) => isObjectLike(value) && getTag(value) === '[object RegExp]';
export default isRegExp; export default isRegExp;

View File

@@ -22,6 +22,6 @@ const nodeIsSet = nodeTypes && nodeTypes.isSet;
*/ */
const isSet = nodeIsSet const isSet = nodeIsSet
? (value) => nodeIsSet(value) ? (value) => nodeIsSet(value)
: (value) => isObjectLike(value) && getTag(value) == '[object Set]'; : (value) => isObjectLike(value) && getTag(value) === '[object Set]';
export default isSet; export default isSet;

View File

@@ -22,7 +22,7 @@ function isString(value) {
(type === 'object' && (type === 'object' &&
value != null && value != null &&
!Array.isArray(value) && !Array.isArray(value) &&
getTag(value) == '[object String]') getTag(value) === '[object String]')
); );
} }

View File

@@ -18,8 +18,8 @@ import getTag from './.internal/getTag.js';
function isSymbol(value) { function isSymbol(value) {
const type = typeof value; const type = typeof value;
return ( return (
type == 'symbol' || type === 'symbol' ||
(type === 'object' && value != null && getTag(value) == '[object Symbol]') (type === 'object' && value != null && getTag(value) === '[object Symbol]')
); );
} }

View File

@@ -17,7 +17,7 @@ import isObjectLike from './isObjectLike.js';
* // => false * // => false
*/ */
function isWeakMap(value) { function isWeakMap(value) {
return isObjectLike(value) && getTag(value) == '[object WeakMap]'; return isObjectLike(value) && getTag(value) === '[object WeakMap]';
} }
export default isWeakMap; export default isWeakMap;

View File

@@ -17,7 +17,7 @@ import isObjectLike from './isObjectLike.js';
* // => false * // => false
*/ */
function isWeakSet(value) { function isWeakSet(value) {
return isObjectLike(value) && getTag(value) == '[object WeakSet]'; return isObjectLike(value) && getTag(value) === '[object WeakSet]';
} }
export default isWeakSet; export default isWeakSet;

View File

@@ -10,7 +10,7 @@
* @example * @example
* *
* function isEven(n) { * function isEven(n) {
* return n % 2 == 0 * return n % 2 === 0
* } * }
* *
* filter([1, 2, 3, 4, 5, 6], negate(isEven)) * filter([1, 2, 3, 4, 5, 6], negate(isEven))

View File

@@ -17,7 +17,7 @@ import basePullAt from './.internal/basePullAt.js';
* @example * @example
* *
* const array = [1, 2, 3, 4] * 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) * console.log(array)
* // => [1, 3] * // => [1, 3]

View File

@@ -34,7 +34,7 @@ function size(collection) {
return isString(collection) ? stringSize(collection) : collection.length; return isString(collection) ? stringSize(collection) : collection.length;
} }
const tag = getTag(collection); const tag = getTag(collection);
if (tag == mapTag || tag == setTag) { if (tag === mapTag || tag === setTag) {
return collection.size; return collection.size;
} }
return Object.keys(collection).length; return Object.keys(collection).length;

View File

@@ -29,7 +29,7 @@ function startsWith(string, target, position) {
position = length; position = length;
} }
target = `${target}`; target = `${target}`;
return string.slice(position, position + target.length) == target; return string.slice(position, position + target.length) === target;
} }
export default startsWith; export default startsWith;

View File

@@ -47,7 +47,7 @@ function toArray(value) {
return iteratorToArray(value[symIterator]()); return iteratorToArray(value[symIterator]());
} }
const tag = getTag(value); 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); return func(value);
} }

View File

@@ -38,7 +38,7 @@ function toString(value) {
return value.toString(); return value.toString();
} }
const result = `${value}`; const result = `${value}`;
return result == '0' && 1 / value == -INFINITY ? '-0' : result; return result === '0' && 1 / value === -INFINITY ? '-0' : result;
} }
export default toString; export default toString;

View File

@@ -24,7 +24,7 @@ import isTypedArray from './isTypedArray.js';
* *
* transform([2, 3, 4], (result, n) => { * transform([2, 3, 4], (result, n) => {
* result.push(n *= n) * result.push(n *= n)
* return n % 2 == 0 * return n % 2 === 0
* }, []) * }, [])
* // => [4, 9] * // => [4, 9]
* *

View File

@@ -99,7 +99,7 @@ function truncate(string, options) {
} }
result = result.slice(0, newEnd === undefined ? end : newEnd); 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); const index = result.lastIndexOf(separator);
if (index > -1) { if (index > -1) {
result = result.slice(0, index); result = result.slice(0, index);

View File

@@ -113,7 +113,7 @@ describe('at', () => {
assert.strictEqual(count, expected); assert.strictEqual(count, expected);
expected = index == 3 ? [] : [index == 2 ? undefined : square(lastIndex)]; expected = index === 3 ? [] : [index === 2 ? undefined : square(lastIndex)];
assert.deepEqual(actual, expected); assert.deepEqual(actual, expected);
}); });
}); });

View File

@@ -52,7 +52,7 @@ describe('case methods', () => {
it(`\`_.${methodName}\` should convert \`string\` to ${caseName} case`, () => { it(`\`_.${methodName}\` should convert \`string\` to ${caseName} case`, () => {
const actual = lodashStable.map(strings, (string) => { 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; return func(string) === expected;
}); });
@@ -61,7 +61,7 @@ describe('case methods', () => {
it(`\`_.${methodName}\` should handle double-converting strings`, () => { it(`\`_.${methodName}\` should handle double-converting strings`, () => {
const actual = lodashStable.map(strings, (string) => { 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; return func(func(string)) === expected;
}); });

View File

@@ -69,7 +69,7 @@ describe('chain', () => {
actual = wrapped actual = wrapped
.chain() .chain()
.filter((n) => n % 2 != 0) .filter((n) => n % 2 != 0)
.reject((n) => n % 3 == 0) .reject((n) => n % 3 === 0)
.sortBy((n) => -n) .sortBy((n) => -n)
.value(); .value();

View File

@@ -125,12 +125,12 @@ xdescribe('clone methods', function () {
actual = last(arguments); 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) => { lodashStable.each(['clone', 'cloneDeep'], (methodName) => {
const func = _[methodName], const func = _[methodName],
isDeep = methodName == 'cloneDeep'; isDeep = methodName === 'cloneDeep';
lodashStable.forOwn(objects, (object, kind) => { lodashStable.forOwn(objects, (object, kind) => {
it(`\`_.${methodName}\` should clone ${kind}`, () => { it(`\`_.${methodName}\` should clone ${kind}`, () => {
@@ -405,7 +405,7 @@ xdescribe('clone methods', function () {
lodashStable.each(['cloneWith', 'cloneDeepWith'], (methodName) => { lodashStable.each(['cloneWith', 'cloneDeepWith'], (methodName) => {
const func = _[methodName], const func = _[methodName],
isDeep = methodName == 'cloneDeepWith'; isDeep = methodName === 'cloneDeepWith';
it(`\`_.${methodName}\` should provide correct \`customizer\` arguments`, () => { it(`\`_.${methodName}\` should provide correct \`customizer\` arguments`, () => {
const argsList = [], const argsList = [],

View File

@@ -5,7 +5,7 @@ import conformsTo from '../src/conformsTo';
describe('conforms methods', () => { describe('conforms methods', () => {
lodashStable.each(['conforms', 'conformsTo'], (methodName) => { lodashStable.each(['conforms', 'conformsTo'], (methodName) => {
const isConforms = methodName == 'conforms'; const isConforms = methodName === 'conforms';
function conforms(source) { function conforms(source) {
return isConforms return isConforms

View File

@@ -9,7 +9,7 @@ describe('curry methods', () => {
fn = function (a, b) { fn = function (a, b) {
return slice.call(arguments); return slice.call(arguments);
}, },
isCurry = methodName == 'curry'; isCurry = methodName === 'curry';
it(`\`_.${methodName}\` should not error on functions with the same name as lodash methods`, () => { it(`\`_.${methodName}\` should not error on functions with the same name as lodash methods`, () => {
function run(a, b) { function run(a, b) {

View File

@@ -6,7 +6,7 @@ import runInContext from '../src/runInContext';
describe('debounce and throttle', () => { describe('debounce and throttle', () => {
lodashStable.each(['debounce', 'throttle'], (methodName) => { lodashStable.each(['debounce', 'throttle'], (methodName) => {
const func = _[methodName], const func = _[methodName],
isDebounce = methodName == 'debounce'; isDebounce = methodName === 'debounce';
it(`\`_.${methodName}\` should not error for non-object \`options\` values`, () => { it(`\`_.${methodName}\` should not error for non-object \`options\` values`, () => {
func(noop, 32, 1); func(noop, 32, 1);
@@ -82,7 +82,7 @@ describe('debounce and throttle', () => {
const lodash = runInContext({ const lodash = runInContext({
Date: { Date: {
now: function () { now: function () {
return ++dateCount == 4 return ++dateCount === 4
? +new Date(2012, 3, 23, 23, 27, 18) ? +new Date(2012, 3, 23, 23, 27, 18)
: +new Date(); : +new Date();
}, },

View File

@@ -57,9 +57,9 @@ describe('dropWhile', () => {
const array = lodashStable.range(1, LARGE_ARRAY_SIZE + 3); const array = lodashStable.range(1, LARGE_ARRAY_SIZE + 3);
const actual = _(array) const actual = _(array)
.dropWhile((n) => n == 1) .dropWhile((n) => n === 1)
.drop() .drop()
.dropWhile((n) => n == 3) .dropWhile((n) => n === 3)
.value(); .value();
assert.deepEqual(actual, array.slice(3)); assert.deepEqual(actual, array.slice(3));

View File

@@ -28,7 +28,7 @@ describe('extremum methods', () => {
lodashStable.each(['maxBy', 'minBy'], (methodName) => { lodashStable.each(['maxBy', 'minBy'], (methodName) => {
const array = [1, 2, 3], const array = [1, 2, 3],
func = _[methodName], func = _[methodName],
isMax = methodName == 'maxBy'; isMax = methodName === 'maxBy';
it(`\`_.${methodName}\` should work with an \`iteratee\``, () => { it(`\`_.${methodName}\` should work with an \`iteratee\``, () => {
const actual = func(array, (n) => -n); const actual = func(array, (n) => -n);

View File

@@ -6,7 +6,7 @@ describe('filter methods', () => {
lodashStable.each(['filter', 'reject'], (methodName) => { lodashStable.each(['filter', 'reject'], (methodName) => {
const array = [1, 2, 3, 4], const array = [1, 2, 3, 4],
func = _[methodName], func = _[methodName],
isFilter = methodName == 'filter', isFilter = methodName === 'filter',
objects = [{ a: 0 }, { a: 1 }]; objects = [{ a: 0 }, { a: 1 }];
it(`\`_.${methodName}\` should not modify the resulting value from within \`predicate\``, () => { it(`\`_.${methodName}\` should not modify the resulting value from within \`predicate\``, () => {

View File

@@ -4,7 +4,7 @@ import { LARGE_ARRAY_SIZE, square, isEven } from './utils';
describe('find and findLast', () => { describe('find and findLast', () => {
lodashStable.each(['find', 'findLast'], (methodName) => { lodashStable.each(['find', 'findLast'], (methodName) => {
const isFind = methodName == 'find'; const isFind = methodName === 'find';
it(`\`_.${methodName}\` should support shortcut fusion`, () => { it(`\`_.${methodName}\` should support shortcut fusion`, () => {
let findCount = 0, let findCount = 0,

View File

@@ -5,8 +5,8 @@ import { _, identity, args, falsey } from './utils';
describe('find and includes', () => { describe('find and includes', () => {
lodashStable.each(['includes', 'find'], (methodName) => { lodashStable.each(['includes', 'find'], (methodName) => {
const func = _[methodName], const func = _[methodName],
isIncludes = methodName == 'includes', isIncludes = methodName === 'includes',
resolve = methodName == 'find' ? lodashStable.curry(lodashStable.eq) : identity; resolve = methodName === 'find' ? lodashStable.curry(lodashStable.eq) : identity;
lodashStable.each( lodashStable.each(
{ {

View File

@@ -14,7 +14,7 @@ describe('findLastIndex and lastIndexOf', () => {
const array = [1, 2, 3, 1, 2, 3], const array = [1, 2, 3, 1, 2, 3],
func = methods[methodName], func = methods[methodName],
resolve = 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`, () => { it(`\`_.${methodName}\` should return the index of the last matched value`, () => {
assert.strictEqual(func(array, resolve(3)), 5); assert.strictEqual(func(array, resolve(3)), 5);

View File

@@ -49,9 +49,9 @@ describe('flatten methods', () => {
const expected = Array(5e5); const expected = Array(5e5);
try { try {
let func = flatten; let func = flatten;
if (index == 1) { if (index === 1) {
func = flattenDeep; func = flattenDeep;
} else if (index == 2) { } else if (index === 2) {
func = flattenDepth; func = flattenDepth;
} }
assert.deepStrictEqual(func([expected]), expected); assert.deepStrictEqual(func([expected]), expected);

View File

@@ -15,7 +15,7 @@ const methods = {
describe('flow methods', () => { describe('flow methods', () => {
lodashStable.each(['flow', 'flowRight'], (methodName) => { lodashStable.each(['flow', 'flowRight'], (methodName) => {
const func = methods[methodName], const func = methods[methodName],
isFlow = methodName == 'flow'; isFlow = methodName === 'flow';
it(`\`_.${methodName}\` should supply each function with the return value of the previous`, () => { it(`\`_.${methodName}\` should supply each function with the return value of the previous`, () => {
const fixed = function (n) { const fixed = function (n) {

View File

@@ -5,7 +5,7 @@ import { _, toArgs, stubTrue, args, symbol, defineProperty, stubFalse } from './
describe('has methods', () => { describe('has methods', () => {
lodashStable.each(['has', 'hasIn'], (methodName) => { lodashStable.each(['has', 'hasIn'], (methodName) => {
const func = _[methodName], const func = _[methodName],
isHas = methodName == 'has', isHas = methodName === 'has',
sparseArgs = toArgs([1]), sparseArgs = toArgs([1]),
sparseArray = Array(1), sparseArray = Array(1),
sparseString = Object('a'); sparseString = Object('a');

View File

@@ -65,7 +65,7 @@ describe('includes', () => {
length = string.length, length = string.length,
indexes = [4, 6, 2 ** 32, Infinity]; 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) => [ const actual = lodashStable.map(indexes, (fromIndex) => [
includes(string, 1, fromIndex), includes(string, 1, fromIndex),

View File

@@ -40,7 +40,7 @@ describe('isFunction', () => {
it('should return `true` for array view constructors', () => { it('should return `true` for array view constructors', () => {
const expected = lodashStable.map( const expected = lodashStable.map(
arrayViews, arrayViews,
(type) => objToString.call(root[type]) == funcTag, (type) => objToString.call(root[type]) === funcTag,
); );
const actual = lodashStable.map(arrayViews, (type) => isFunction(root[type])); const actual = lodashStable.map(arrayViews, (type) => isFunction(root[type]));

View File

@@ -5,7 +5,7 @@ import { _, stubTrue, MAX_INTEGER, stubFalse, falsey, args, symbol } from './uti
describe('isInteger methods', () => { describe('isInteger methods', () => {
lodashStable.each(['isInteger', 'isSafeInteger'], (methodName) => { lodashStable.each(['isInteger', 'isSafeInteger'], (methodName) => {
const func = _[methodName], const func = _[methodName],
isSafe = methodName == 'isSafeInteger'; isSafe = methodName === 'isSafeInteger';
it(`\`_.${methodName}\` should return \`true\` for integer values`, () => { it(`\`_.${methodName}\` should return \`true\` for integer values`, () => {
const values = [-1, 0, 1], const values = [-1, 0, 1],

View File

@@ -78,7 +78,7 @@ describe('isMatchWith', () => {
actual = last(arguments); 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', () => { it('should ensure `customizer` is a function', () => {

View File

@@ -11,7 +11,7 @@ describe('isNil', () => {
}); });
it('should return `false` for non-nullish values', () => { 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())); const actual = lodashStable.map(falsey, (value, index) => (index ? isNil(value) : isNil()));

View File

@@ -19,7 +19,7 @@ describe('isType checks', () => {
Foo.prototype = root[methodName.slice(2)].prototype; Foo.prototype = root[methodName.slice(2)].prototype;
const object = new Foo(); const object = new Foo();
if (objToString.call(object) == objectTag) { if (objToString.call(object) === objectTag) {
assert.strictEqual( assert.strictEqual(
_[methodName](object), _[methodName](object),
false, false,

View File

@@ -118,7 +118,7 @@ describe('iteration methods', () => {
isBy = /(^partition|By)$/.test(methodName), isBy = /(^partition|By)$/.test(methodName),
isFind = /^find/.test(methodName), isFind = /^find/.test(methodName),
isOmitPick = /^(?:omit|pick)By$/.test(methodName), isOmitPick = /^(?:omit|pick)By$/.test(methodName),
isSome = methodName == 'some'; isSome = methodName === 'some';
it(`\`_.${methodName}\` should provide correct iteratee arguments`, () => { it(`\`_.${methodName}\` should provide correct iteratee arguments`, () => {
if (func) { if (func) {
@@ -187,7 +187,7 @@ describe('iteration methods', () => {
lodashStable.each(lodashStable.difference(methods, objectMethods), (methodName) => { lodashStable.each(lodashStable.difference(methods, objectMethods), (methodName) => {
const array = [1, 2, 3], const array = [1, 2, 3],
func = _[methodName], func = _[methodName],
isEvery = methodName == 'every'; isEvery = methodName === 'every';
array.a = 1; array.a = 1;
@@ -206,7 +206,7 @@ describe('iteration methods', () => {
lodashStable.each(lodashStable.difference(methods, unwrappedMethods), (methodName) => { lodashStable.each(lodashStable.difference(methods, unwrappedMethods), (methodName) => {
const array = [1, 2, 3], const array = [1, 2, 3],
isBaseEach = methodName == '_baseEach'; isBaseEach = methodName === '_baseEach';
it(`\`_.${methodName}\` should return a wrapped value when implicitly chaining`, () => { it(`\`_.${methodName}\` should return a wrapped value when implicitly chaining`, () => {
if (!(isBaseEach || isNpm)) { if (!(isBaseEach || isNpm)) {
@@ -303,7 +303,7 @@ describe('iteration methods', () => {
lodashStable.each(methods, (methodName) => { lodashStable.each(methods, (methodName) => {
const func = _[methodName], const func = _[methodName],
isFind = /^find/.test(methodName), isFind = /^find/.test(methodName),
isSome = methodName == 'some', isSome = methodName === 'some',
isReduce = /^reduce/.test(methodName); isReduce = /^reduce/.test(methodName);
it(`\`_.${methodName}\` should ignore changes to \`length\``, () => { it(`\`_.${methodName}\` should ignore changes to \`length\``, () => {
@@ -314,7 +314,7 @@ describe('iteration methods', () => {
func( func(
array, array,
() => { () => {
if (++count == 1) { if (++count === 1) {
array.push(2); array.push(2);
} }
return !(isFind || isSome); return !(isFind || isSome);
@@ -332,7 +332,7 @@ describe('iteration methods', () => {
(methodName) => { (methodName) => {
const func = _[methodName], const func = _[methodName],
isFind = /^find/.test(methodName), isFind = /^find/.test(methodName),
isSome = methodName == 'some', isSome = methodName === 'some',
isReduce = /^reduce/.test(methodName); isReduce = /^reduce/.test(methodName);
it(`\`_.${methodName}\` should ignore added \`object\` properties`, () => { it(`\`_.${methodName}\` should ignore added \`object\` properties`, () => {
@@ -343,7 +343,7 @@ describe('iteration methods', () => {
func( func(
object, object,
() => { () => {
if (++count == 1) { if (++count === 1) {
object.b = 2; object.b = 2;
} }
return !(isFind || isSome); return !(isFind || isSome);

View File

@@ -16,7 +16,7 @@ import {
describe('keys methods', () => { describe('keys methods', () => {
lodashStable.each(['keys', 'keysIn'], (methodName) => { lodashStable.each(['keys', 'keysIn'], (methodName) => {
const func = _[methodName], const func = _[methodName],
isKeys = methodName == 'keys'; isKeys = methodName === 'keys';
it(`\`_.${methodName}\` should return the string keyed property names of \`object\``, () => { it(`\`_.${methodName}\` should return the string keyed property names of \`object\``, () => {
const actual = func({ a: 1, b: 1 }).sort(); const actual = func({ a: 1, b: 1 }).sort();

View File

@@ -34,7 +34,7 @@ describe('lodash(...) methods that return new wrapped values', () => {
lodashStable.each(funcs, (methodName) => { lodashStable.each(funcs, (methodName) => {
it(`\`_(...).${methodName}\` should return a new wrapped value`, () => { 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), wrapped = _(value),
actual = wrapped[methodName](); actual = wrapped[methodName]();

View File

@@ -100,9 +100,9 @@ describe('lodash methods', () => {
index ? func(value) : func(), index ? func(value) : func(),
); );
if (methodName == 'noConflict') { if (methodName === 'noConflict') {
root._ = oldDash; root._ = oldDash;
} else if (methodName == 'pull' || methodName == 'pullAll') { } else if (methodName === 'pull' || methodName === 'pullAll') {
expected = falsey; expected = falsey;
} }
if (lodashStable.includes(returnArrays, methodName) && methodName != 'sample') { if (lodashStable.includes(returnArrays, methodName) && methodName != 'sample') {
@@ -137,7 +137,7 @@ describe('lodash methods', () => {
} }
assert.ok(lodashStable.isArray(actual), `_.${methodName} returns an array`); assert.ok(lodashStable.isArray(actual), `_.${methodName} returns an array`);
const isPull = methodName == 'pull' || methodName == 'pullAll'; const isPull = methodName === 'pull' || methodName === 'pullAll';
assert.strictEqual( assert.strictEqual(
actual === array, actual === array,
isPull, isPull,
@@ -163,7 +163,7 @@ describe('lodash methods', () => {
!pass && !pass &&
e instanceof TypeError && e instanceof TypeError &&
(!lodashStable.includes(checkFuncs, methodName) || (!lodashStable.includes(checkFuncs, methodName) ||
e.message == FUNC_ERROR_TEXT); e.message === FUNC_ERROR_TEXT);
} }
return pass; return pass;
}); });
@@ -182,7 +182,7 @@ describe('lodash methods', () => {
return this.a; return this.a;
}, },
func = _[methodName], func = _[methodName],
isNegate = methodName == 'negate', isNegate = methodName === 'negate',
object = { a: 1 }, object = { a: 1 },
expected = isNegate ? false : 1; expected = isNegate ? false : 1;

View File

@@ -5,7 +5,7 @@ import isMatch from '../src/isMatch';
describe('matches methods', () => { describe('matches methods', () => {
lodashStable.each(['matches', 'isMatch'], (methodName) => { lodashStable.each(['matches', 'isMatch'], (methodName) => {
const isMatches = methodName == 'matches'; const isMatches = methodName === 'matches';
function matches(source) { function matches(source) {
return isMatches return isMatches

View File

@@ -5,7 +5,7 @@ import { _, symbol } from './utils';
describe('math operator methods', () => { describe('math operator methods', () => {
lodashStable.each(['add', 'divide', 'multiply', 'subtract'], (methodName) => { lodashStable.each(['add', 'divide', 'multiply', 'subtract'], (methodName) => {
const func = _[methodName], const func = _[methodName],
isAddSub = methodName == 'add' || methodName == 'subtract'; isAddSub = methodName === 'add' || methodName === 'subtract';
it(`\`_.${methodName}\` should return \`${ it(`\`_.${methodName}\` should return \`${
isAddSub ? 0 : 1 isAddSub ? 0 : 1

View File

@@ -36,7 +36,7 @@ describe('mergeWith', () => {
actual = last(arguments); 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', () => { it('should overwrite primitives with source object clones', () => {

View File

@@ -42,7 +42,7 @@ describe('negate', () => {
case 4: case 4:
negate(1, 2, 3, 4); negate(1, 2, 3, 4);
} }
return argCount == index; return argCount === index;
}); });
assert.deepStrictEqual(actual, expected); assert.deepStrictEqual(actual, expected);

View File

@@ -42,10 +42,10 @@ describe('number coercion methods', () => {
['toFinite', 'toInteger', 'toLength', 'toNumber', 'toSafeInteger'], ['toFinite', 'toInteger', 'toLength', 'toNumber', 'toSafeInteger'],
(methodName) => { (methodName) => {
const func = _[methodName], const func = _[methodName],
isToFinite = methodName == 'toFinite', isToFinite = methodName === 'toFinite',
isToLength = methodName == 'toLength', isToLength = methodName === 'toLength',
isToNumber = methodName == 'toNumber', isToNumber = methodName === 'toNumber',
isToSafeInteger = methodName == 'toSafeInteger'; isToSafeInteger = methodName === 'toSafeInteger';
function negative(string) { function negative(string) {
return `-${string}`; return `-${string}`;
@@ -76,9 +76,9 @@ describe('number coercion methods', () => {
const expected = lodashStable.map(values, (value) => { const expected = lodashStable.map(values, (value) => {
if (!isToNumber) { if (!isToNumber) {
if (!isToFinite && value == 1.2) { if (!isToFinite && value === 1.2) {
value = 1; value = 1;
} else if (value == Infinity) { } else if (value === Infinity) {
value = MAX_INTEGER; value = MAX_INTEGER;
} else if (value !== value) { } else if (value !== value) {
value = 0; value = 0;
@@ -124,11 +124,11 @@ describe('number coercion methods', () => {
const expected = lodashStable.map(values, (value) => { const expected = lodashStable.map(values, (value) => {
let n = +value; let n = +value;
if (!isToNumber) { if (!isToNumber) {
if (!isToFinite && n == 1.23456789) { if (!isToFinite && n === 1.23456789) {
n = 1; n = 1;
} else if (n == Infinity) { } else if (n === Infinity) {
n = MAX_INTEGER; n = MAX_INTEGER;
} else if ((!isToFinite && n == Number.MIN_VALUE) || n !== n) { } else if ((!isToFinite && n === Number.MIN_VALUE) || n !== n) {
n = 0; n = 0;
} }
if (isToLength || isToSafeInteger) { if (isToLength || isToSafeInteger) {

View File

@@ -6,7 +6,7 @@ import has from '../src/has';
describe('object assignments', () => { describe('object assignments', () => {
lodashStable.each(['assign', 'assignIn', 'defaults', 'defaultsDeep', 'merge'], (methodName) => { lodashStable.each(['assign', 'assignIn', 'defaults', 'defaultsDeep', 'merge'], (methodName) => {
const func = _[methodName], const func = _[methodName],
isAssign = methodName == 'assign', isAssign = methodName === 'assign',
isDefaults = /^defaults/.test(methodName); isDefaults = /^defaults/.test(methodName);
it(`\`_.${methodName}\` should coerce primitives to objects`, () => { it(`\`_.${methodName}\` should coerce primitives to objects`, () => {
@@ -135,7 +135,7 @@ describe('object assignments', () => {
lodashStable.each(['assignWith', 'assignInWith', 'mergeWith'], (methodName) => { lodashStable.each(['assignWith', 'assignInWith', 'mergeWith'], (methodName) => {
const func = _[methodName], const func = _[methodName],
isMergeWith = methodName == 'mergeWith'; isMergeWith = methodName === 'mergeWith';
it(`\`_.${methodName}\` should provide correct \`customizer\` arguments`, () => { it(`\`_.${methodName}\` should provide correct \`customizer\` arguments`, () => {
let args, let args,

View File

@@ -9,7 +9,7 @@ describe('omit methods', () => {
object = { a: 1, b: 2, c: 3, d: 4 }, object = { a: 1, b: 2, c: 3, d: 4 },
resolve = lodashStable.nthArg(1); resolve = lodashStable.nthArg(1);
if (methodName == 'omitBy') { if (methodName === 'omitBy') {
resolve = function (object, props) { resolve = function (object, props) {
props = lodashStable.castArray(props); props = lodashStable.castArray(props);
return function (value) { return function (value) {

View File

@@ -6,8 +6,8 @@ import pad from '../src/pad';
describe('pad methods', () => { describe('pad methods', () => {
lodashStable.each(['pad', 'padStart', 'padEnd'], (methodName) => { lodashStable.each(['pad', 'padStart', 'padEnd'], (methodName) => {
const func = _[methodName], const func = _[methodName],
isPad = methodName == 'pad', isPad = methodName === 'pad',
isStart = methodName == 'padStart', isStart = methodName === 'padStart',
string = 'abc'; string = 'abc';
it(`\`_.${methodName}\` should not pad if string is >= \`length\``, () => { it(`\`_.${methodName}\` should not pad if string is >= \`length\``, () => {

View File

@@ -7,7 +7,7 @@ import curry from '../src/curry';
describe('partial methods', () => { describe('partial methods', () => {
lodashStable.each(['partial', 'partialRight'], (methodName) => { lodashStable.each(['partial', 'partialRight'], (methodName) => {
const func = _[methodName], const func = _[methodName],
isPartial = methodName == 'partial', isPartial = methodName === 'partial',
ph = func.placeholder; ph = func.placeholder;
it(`\`_.${methodName}\` partially applies arguments`, () => { it(`\`_.${methodName}\` partially applies arguments`, () => {

View File

@@ -6,11 +6,11 @@ describe('pick methods', () => {
lodashStable.each(['pick', 'pickBy'], (methodName) => { lodashStable.each(['pick', 'pickBy'], (methodName) => {
let expected = { a: 1, c: 3 }, let expected = { a: 1, c: 3 },
func = _[methodName], func = _[methodName],
isPick = methodName == 'pick', isPick = methodName === 'pick',
object = { a: 1, b: 2, c: 3, d: 4 }, object = { a: 1, b: 2, c: 3, d: 4 },
resolve = lodashStable.nthArg(1); resolve = lodashStable.nthArg(1);
if (methodName == 'pickBy') { if (methodName === 'pickBy') {
resolve = function (object, props) { resolve = function (object, props) {
props = lodashStable.castArray(props); props = lodashStable.castArray(props);
return function (value) { return function (value) {

View File

@@ -6,7 +6,7 @@ describe('pickBy', () => {
it('should work with a predicate argument', () => { it('should work with a predicate argument', () => {
const object = { a: 1, b: 2, c: 3, d: 4 }; 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 }); assert.deepStrictEqual(actual, { a: 1, c: 3 });
}); });

View File

@@ -5,7 +5,7 @@ import { _ } from './utils';
describe('pull methods', () => { describe('pull methods', () => {
lodashStable.each(['pull', 'pullAll', 'pullAllWith'], (methodName) => { lodashStable.each(['pull', 'pullAll', 'pullAllWith'], (methodName) => {
const func = _[methodName], const func = _[methodName],
isPull = methodName == 'pull'; isPull = methodName === 'pull';
function pull(array, values) { function pull(array, values) {
return isPull ? func.apply(undefined, [array].concat(values)) : func(array, values); return isPull ? func.apply(undefined, [array].concat(values)) : func(array, values);

View File

@@ -93,7 +93,7 @@ describe('random', () => {
const actual = lodashStable.map( const actual = lodashStable.map(
randoms, 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); assert.deepStrictEqual(actual, expected);

View File

@@ -5,7 +5,7 @@ import { _, falsey } from './utils';
describe('range methods', () => { describe('range methods', () => {
lodashStable.each(['range', 'rangeRight'], (methodName) => { lodashStable.each(['range', 'rangeRight'], (methodName) => {
const func = _[methodName], const func = _[methodName],
isRange = methodName == 'range'; isRange = methodName === 'range';
function resolve(range) { function resolve(range) {
return isRange ? range : range.reverse(); return isRange ? range : range.reverse();

View File

@@ -6,7 +6,7 @@ describe('reduce methods', () => {
lodashStable.each(['reduce', 'reduceRight'], (methodName) => { lodashStable.each(['reduce', 'reduceRight'], (methodName) => {
const func = _[methodName], const func = _[methodName],
array = [1, 2, 3], array = [1, 2, 3],
isReduce = methodName == 'reduce'; isReduce = methodName === 'reduce';
it(`\`_.${methodName}\` should reduce a collection to a single value`, () => { it(`\`_.${methodName}\` should reduce a collection to a single value`, () => {
const actual = func(['a', 'b', 'c'], (accumulator, value) => accumulator + value, ''); const actual = func(['a', 'b', 'c'], (accumulator, value) => accumulator + value, '');

View File

@@ -37,7 +37,7 @@ describe('reduce', () => {
object = { a: 1, b: 2 }, object = { a: 1, b: 2 },
firstKey = head(keys(object)); 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( reduce(
object, object,
@@ -50,7 +50,7 @@ describe('reduce', () => {
assert.deepStrictEqual(args, expected); assert.deepStrictEqual(args, expected);
args = undefined; 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 () { reduce(object, function () {
args || (args = slice.call(arguments)); args || (args = slice.call(arguments));

View File

@@ -34,7 +34,7 @@ describe('reduceRight', () => {
it('should provide correct `iteratee` arguments when iterating an object', () => { it('should provide correct `iteratee` arguments when iterating an object', () => {
let args, let args,
object = { a: 1, b: 2 }, 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]; let expected = isFIFO ? [0, 2, 'b', object] : [0, 1, 'a', object];

View File

@@ -69,7 +69,7 @@ describe('remove', () => {
const array = [1, 2, 3]; const array = [1, 2, 3];
delete array[1]; delete array[1];
remove(array, (n) => n == null); remove(array, (n) => n === null);
assert.deepStrictEqual(array, [1, 3]); assert.deepStrictEqual(array, [1, 3]);
}); });

View File

@@ -6,8 +6,8 @@ import round from '../src/round';
describe('round methods', () => { describe('round methods', () => {
lodashStable.each(['ceil', 'floor', 'round'], (methodName) => { lodashStable.each(['ceil', 'floor', 'round'], (methodName) => {
const func = _[methodName], const func = _[methodName],
isCeil = methodName == 'ceil', isCeil = methodName === 'ceil',
isFloor = methodName == 'floor'; isFloor = methodName === 'floor';
it(`\`_.${methodName}\` should return a rounded number without a precision`, () => { it(`\`_.${methodName}\` should return a rounded number without a precision`, () => {
const actual = func(4.006); const actual = func(4.006);

View File

@@ -6,7 +6,7 @@ import sortBy from '../src/sortBy';
describe('sortedIndex methods', () => { describe('sortedIndex methods', () => {
lodashStable.each(['sortedIndex', 'sortedLastIndex'], (methodName) => { lodashStable.each(['sortedIndex', 'sortedLastIndex'], (methodName) => {
const func = _[methodName], const func = _[methodName],
isSortedIndex = methodName == 'sortedIndex'; isSortedIndex = methodName === 'sortedIndex';
it(`\`_.${methodName}\` should return the insert index`, () => { it(`\`_.${methodName}\` should return the insert index`, () => {
const array = [30, 50], const array = [30, 50],

View File

@@ -5,7 +5,7 @@ import { _, slice, MAX_ARRAY_LENGTH, MAX_ARRAY_INDEX } from './utils';
describe('sortedIndexBy methods', () => { describe('sortedIndexBy methods', () => {
lodashStable.each(['sortedIndexBy', 'sortedLastIndexBy'], (methodName) => { lodashStable.each(['sortedIndexBy', 'sortedLastIndexBy'], (methodName) => {
const func = _[methodName], const func = _[methodName],
isSortedIndexBy = methodName == 'sortedIndexBy'; isSortedIndexBy = methodName === 'sortedIndexBy';
it(`\`_.${methodName}\` should provide correct \`iteratee\` arguments`, () => { it(`\`_.${methodName}\` should provide correct \`iteratee\` arguments`, () => {
let args; let args;
@@ -52,7 +52,7 @@ describe('sortedIndexBy methods', () => {
? 0 ? 0
: Math.min(length, MAX_ARRAY_INDEX); : Math.min(length, MAX_ARRAY_INDEX);
assert.ok(steps == 32 || steps == 33); assert.ok(steps === 32 || steps === 33);
assert.strictEqual(actual, expected); assert.strictEqual(actual, expected);
}); });
}); });

View File

@@ -5,7 +5,7 @@ import { _ } from './utils';
describe('sortedIndexOf methods', () => { describe('sortedIndexOf methods', () => {
lodashStable.each(['sortedIndexOf', 'sortedLastIndexOf'], (methodName) => { lodashStable.each(['sortedIndexOf', 'sortedLastIndexOf'], (methodName) => {
const func = _[methodName], const func = _[methodName],
isSortedIndexOf = methodName == 'sortedIndexOf'; isSortedIndexOf = methodName === 'sortedIndexOf';
it(`\`_.${methodName}\` should perform a binary search`, () => { it(`\`_.${methodName}\` should perform a binary search`, () => {
const sorted = [4, 4, 5, 5, 6, 6]; const sorted = [4, 4, 5, 5, 6, 6];

View File

@@ -5,7 +5,7 @@ import { _, MAX_SAFE_INTEGER } from './utils';
describe('startsWith and endsWith', () => { describe('startsWith and endsWith', () => {
lodashStable.each(['startsWith', 'endsWith'], (methodName) => { lodashStable.each(['startsWith', 'endsWith'], (methodName) => {
const func = _[methodName], const func = _[methodName],
isStartsWith = methodName == 'startsWith'; isStartsWith = methodName === 'startsWith';
const string = 'abc', const string = 'abc',
chr = isStartsWith ? 'a' : 'c'; chr = isStartsWith ? 'a' : 'c';

View File

@@ -7,7 +7,7 @@ describe('strict mode checks', () => {
['assign', 'assignIn', 'bindAll', 'defaults', 'defaultsDeep', 'merge'], ['assign', 'assignIn', 'bindAll', 'defaults', 'defaultsDeep', 'merge'],
(methodName) => { (methodName) => {
const func = _[methodName], const func = _[methodName],
isBindAll = methodName == 'bindAll'; isBindAll = methodName === 'bindAll';
it(`\`_.${methodName}\` should ${ it(`\`_.${methodName}\` should ${
isStrict ? '' : 'not ' isStrict ? '' : 'not '

View File

@@ -58,7 +58,7 @@ describe('takeWhile', () => {
const actual = _(array) const actual = _(array)
.takeWhile((n) => n < 4) .takeWhile((n) => n < 4)
.take(2) .take(2)
.takeWhile((n) => n == 0) .takeWhile((n) => n === 0)
.value(); .value();
assert.deepEqual(actual, [0]); assert.deepEqual(actual, [0]);

View File

@@ -297,7 +297,7 @@ describe('template', () => {
it('should work with statements containing quotes', () => { it('should work with statements containing quotes', () => {
const compiled = template( const compiled = template(
'<%\ '<%\
if (a == \'A\' || a == "a") {\ if (a === \'A\' || a === "a") {\
%>\'a\',"A"<%\ %>\'a\',"A"<%\
} %>', } %>',
); );

View File

@@ -49,7 +49,7 @@ describe('throttle', () => {
const lodash = runInContext({ const lodash = runInContext({
Date: { Date: {
now: function () { now: function () {
return ++dateCount == 5 ? Infinity : +new Date(); return ++dateCount === 5 ? Infinity : +new Date();
}, },
}, },
}); });

View File

@@ -5,7 +5,7 @@ import { _, MAX_SAFE_INTEGER, MAX_INTEGER } from './utils';
describe('toInteger methods', () => { describe('toInteger methods', () => {
lodashStable.each(['toInteger', 'toSafeInteger'], (methodName) => { lodashStable.each(['toInteger', 'toSafeInteger'], (methodName) => {
const func = _[methodName], const func = _[methodName],
isSafe = methodName == 'toSafeInteger'; isSafe = methodName === 'toSafeInteger';
it(`\`_.${methodName}\` should convert values to integers`, () => { it(`\`_.${methodName}\` should convert values to integers`, () => {
assert.strictEqual(func(-5.6), -5); assert.strictEqual(func(-5.6), -5);

Some files were not shown because too many files have changed in this diff Show More