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

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

View File

@@ -52,7 +52,7 @@ describe('case methods', () => {
it(`\`_.${methodName}\` should convert \`string\` to ${caseName} case`, () => {
const actual = lodashStable.map(strings, (string) => {
const expected = caseName == 'start' && string == 'FOO BAR' ? string : converted;
const expected = caseName === 'start' && string === 'FOO BAR' ? string : converted;
return func(string) === expected;
});
@@ -61,7 +61,7 @@ describe('case methods', () => {
it(`\`_.${methodName}\` should handle double-converting strings`, () => {
const actual = lodashStable.map(strings, (string) => {
const expected = caseName == 'start' && string == 'FOO BAR' ? string : converted;
const expected = caseName === 'start' && string === 'FOO BAR' ? string : converted;
return func(func(string)) === expected;
});

View File

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

View File

@@ -125,12 +125,12 @@ xdescribe('clone methods', function () {
actual = last(arguments);
});
assert.ok(isNpm ? actual.constructor.name == 'Stack' : actual instanceof mapCaches.Stack);
assert.ok(isNpm ? actual.constructor.name === 'Stack' : actual instanceof mapCaches.Stack);
});
lodashStable.each(['clone', 'cloneDeep'], (methodName) => {
const func = _[methodName],
isDeep = methodName == 'cloneDeep';
isDeep = methodName === 'cloneDeep';
lodashStable.forOwn(objects, (object, kind) => {
it(`\`_.${methodName}\` should clone ${kind}`, () => {
@@ -405,7 +405,7 @@ xdescribe('clone methods', function () {
lodashStable.each(['cloneWith', 'cloneDeepWith'], (methodName) => {
const func = _[methodName],
isDeep = methodName == 'cloneDeepWith';
isDeep = methodName === 'cloneDeepWith';
it(`\`_.${methodName}\` should provide correct \`customizer\` arguments`, () => {
const argsList = [],

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -78,7 +78,7 @@ describe('isMatchWith', () => {
actual = last(arguments);
});
assert.ok(isNpm ? actual.constructor.name == 'Stack' : actual instanceof mapCaches.Stack);
assert.ok(isNpm ? actual.constructor.name === 'Stack' : actual instanceof mapCaches.Stack);
});
it('should ensure `customizer` is a function', () => {

View File

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

View File

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

View File

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

View File

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

View File

@@ -34,7 +34,7 @@ describe('lodash(...) methods that return new wrapped values', () => {
lodashStable.each(funcs, (methodName) => {
it(`\`_(...).${methodName}\` should return a new wrapped value`, () => {
const value = methodName == 'split' ? 'abc' : [1, 2, 3],
const value = methodName === 'split' ? 'abc' : [1, 2, 3],
wrapped = _(value),
actual = wrapped[methodName]();

View File

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

View File

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

View File

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

View File

@@ -36,7 +36,7 @@ describe('mergeWith', () => {
actual = last(arguments);
});
assert.ok(isNpm ? actual.constructor.name == 'Stack' : actual instanceof mapCaches.Stack);
assert.ok(isNpm ? actual.constructor.name === 'Stack' : actual instanceof mapCaches.Stack);
});
it('should overwrite primitives with source object clones', () => {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -93,7 +93,7 @@ describe('random', () => {
const actual = lodashStable.map(
randoms,
(result, index) => result >= 0 && result <= array[index] && result % 1 == 0,
(result, index) => result >= 0 && result <= array[index] && result % 1 === 0,
);
assert.deepStrictEqual(actual, expected);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -49,7 +49,7 @@ describe('throttle', () => {
const lodash = runInContext({
Date: {
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', () => {
lodashStable.each(['toInteger', 'toSafeInteger'], (methodName) => {
const func = _[methodName],
isSafe = methodName == 'toSafeInteger';
isSafe = methodName === 'toSafeInteger';
it(`\`_.${methodName}\` should convert values to integers`, () => {
assert.strictEqual(func(-5.6), -5);

View File

@@ -5,7 +5,7 @@ import { _ } from './utils';
describe('toPairs methods', () => {
lodashStable.each(['toPairs', 'toPairsIn'], (methodName) => {
const func = _[methodName],
isToPairs = methodName == 'toPairs';
isToPairs = methodName === 'toPairs';
it(`\`_.${methodName}\` should create an array of string keyed-value pairs`, () => {
const object = { a: 1, b: 2 },

View File

@@ -169,7 +169,7 @@ describe('transform', () => {
});
const first = args[0];
if (key == 'array') {
if (key === 'array') {
assert.ok(first !== object && lodashStable.isArray(first));
assert.deepStrictEqual(args, [first, 1, 0, object]);
} else {

View File

@@ -17,21 +17,21 @@ describe('trim methods', () => {
it(`\`_.${methodName}\` should remove ${parts} whitespace`, () => {
const string = `${whitespace}a b c${whitespace}`,
expected = `${index == 2 ? whitespace : ''}a b c${index == 1 ? whitespace : ''}`;
expected = `${index === 2 ? whitespace : ''}a b c${index === 1 ? whitespace : ''}`;
assert.strictEqual(func(string), expected);
});
it(`\`_.${methodName}\` should coerce \`string\` to a string`, () => {
const object = { toString: lodashStable.constant(`${whitespace}a b c${whitespace}`) },
expected = `${index == 2 ? whitespace : ''}a b c${index == 1 ? whitespace : ''}`;
expected = `${index === 2 ? whitespace : ''}a b c${index === 1 ? whitespace : ''}`;
assert.strictEqual(func(object), expected);
});
it(`\`_.${methodName}\` should remove ${parts} \`chars\``, () => {
const string = '-_-a-b-c-_-',
expected = `${index == 2 ? '-_-' : ''}a-b-c${index == 1 ? '-_-' : ''}`;
expected = `${index === 2 ? '-_-' : ''}a-b-c${index === 1 ? '-_-' : ''}`;
assert.strictEqual(func(string, '_-'), expected);
});
@@ -39,7 +39,7 @@ describe('trim methods', () => {
it(`\`_.${methodName}\` should coerce \`chars\` to a string`, () => {
const object = { toString: lodashStable.constant('_-') },
string = '-_-a-b-c-_-',
expected = `${index == 2 ? '-_-' : ''}a-b-c${index == 1 ? '-_-' : ''}`;
expected = `${index === 2 ? '-_-' : ''}a-b-c${index === 1 ? '-_-' : ''}`;
assert.strictEqual(func(string, object), expected);
});
@@ -54,7 +54,7 @@ describe('trim methods', () => {
it(`\`_.${methodName}\` should work with \`undefined\` or empty string values for \`chars\``, () => {
const string = `${whitespace}a b c${whitespace}`,
expected = `${index == 2 ? whitespace : ''}a b c${index == 1 ? whitespace : ''}`;
expected = `${index === 2 ? whitespace : ''}a b c${index === 1 ? whitespace : ''}`;
assert.strictEqual(func(string, undefined), expected);
assert.strictEqual(func(string, ''), string);
@@ -62,7 +62,7 @@ describe('trim methods', () => {
it(`\`_.${methodName}\` should work as an iteratee for methods like \`_.map\``, () => {
const string = Object(`${whitespace}a b c${whitespace}`),
trimmed = `${index == 2 ? whitespace : ''}a b c${index == 1 ? whitespace : ''}`,
trimmed = `${index === 2 ? whitespace : ''}a b c${index === 1 ? whitespace : ''}`,
actual = lodashStable.map([string, string, string], func);
assert.deepStrictEqual(actual, [trimmed, trimmed, trimmed]);
@@ -70,7 +70,7 @@ describe('trim methods', () => {
it(`\`_.${methodName}\` should return an unwrapped value when implicitly chaining`, () => {
const string = `${whitespace}a b c${whitespace}`,
expected = `${index == 2 ? whitespace : ''}a b c${index == 1 ? whitespace : ''}`;
expected = `${index === 2 ? whitespace : ''}a b c${index === 1 ? whitespace : ''}`;
assert.strictEqual(_(string)[methodName](), expected);
});

View File

@@ -21,7 +21,7 @@ describe('unionWith', () => {
const objects = [{ x: 1, y: 1 }],
others = [{ x: 1, y: 2 }];
const actual = unionWith(objects, others, (a, b) => a.x == b.x);
const actual = unionWith(objects, others, (a, b) => a.x === b.x);
assert.deepStrictEqual(actual, [{ x: 1, y: 1 }]);
});

View File

@@ -6,7 +6,7 @@ import sortBy from '../src/sortBy';
describe('uniqBy methods', () => {
lodashStable.each(['uniqBy', 'sortedUniqBy'], (methodName) => {
let func = _[methodName],
isSorted = methodName == 'sortedUniqBy',
isSorted = methodName === 'sortedUniqBy',
objects = [{ a: 2 }, { a: 3 }, { a: 1 }, { a: 2 }, { a: 3 }, { a: 1 }];
if (isSorted) {

View File

@@ -5,7 +5,7 @@ import { _, args, strictArgs } from './utils';
describe('values methods', () => {
lodashStable.each(['values', 'valuesIn'], (methodName) => {
const func = _[methodName],
isValues = methodName == 'values';
isValues = methodName === 'values';
it(`\`_.${methodName}\` should get string keyed values of \`object\``, () => {
const object = { a: 1, b: 2 },

View File

@@ -6,7 +6,7 @@ describe('zipObject methods', () => {
lodashStable.each(['zipObject', 'zipObjectDeep'], (methodName) => {
const func = _[methodName],
object = { barney: 36, fred: 40 },
isDeep = methodName == 'zipObjectDeep';
isDeep = methodName === 'zipObjectDeep';
it(`\`_.${methodName}\` should zip together key/value arrays into an object`, () => {
const actual = func(['barney', 'fred'], [36, 40]);