wip: code formatting nits continued

This commit is contained in:
jdalton
2023-09-17 11:28:57 -07:00
parent b5c59317ea
commit 5308be3ba6
5 changed files with 15 additions and 12 deletions

View File

@@ -98,17 +98,19 @@ function debounce(func, wait, options) {
return result; return result;
} }
function startTimer(pendingFunc, wait) { function startTimer(pendingFunc, milliseconds) {
if (useRAF) { if (useRAF) {
root.cancelAnimationFrame(timerId); root.cancelAnimationFrame(timerId);
return root.requestAnimationFrame(pendingFunc); return root.requestAnimationFrame(pendingFunc);
} }
return setTimeout(pendingFunc, wait); // eslint-disable-next-line @typescript-eslint/no-implied-eval
return setTimeout(pendingFunc, milliseconds);
} }
function cancelTimer(id) { function cancelTimer(id) {
if (useRAF) { if (useRAF) {
return root.cancelAnimationFrame(id); root.cancelAnimationFrame(id);
return;
} }
clearTimeout(id); clearTimeout(id);
} }
@@ -152,6 +154,7 @@ function debounce(func, wait, options) {
} }
// Restart the timer. // Restart the timer.
timerId = startTimer(timerExpired, remainingWait(time)); timerId = startTimer(timerExpired, remainingWait(time));
return undefined;
} }
function trailingEdge(time) { function trailingEdge(time) {

View File

@@ -28,7 +28,7 @@ describe('conforms methods', () => {
}); });
let actual = lodashStable.filter(objects, par); let actual = lodashStable.filter(objects, par);
expect(actual, [objects[0]).toEqual(objects[2]]); expect(actual).toEqual([objects[0], objects[2]]);
par = conforms({ par = conforms({
b: function (value) { b: function (value) {
@@ -62,7 +62,7 @@ describe('conforms methods', () => {
const par = conforms(new Foo()); const par = conforms(new Foo());
const actual = lodashStable.filter(objects, par); const actual = lodashStable.filter(objects, par);
expect(actual, [objects[1]).toEqual(objects[2]]); expect(actual).toEqual([objects[1], objects[2]]);
}); });
it(`\`_.${methodName}\` should not invoke \`source\` predicates for missing \`object\` properties`, () => { it(`\`_.${methodName}\` should not invoke \`source\` predicates for missing \`object\` properties`, () => {

View File

@@ -6,7 +6,7 @@ describe('flatMapDepth', () => {
const array = [1, [2, [3, [4]], 5]]; const array = [1, [2, [3, [4]], 5]];
it('should use a default `depth` of `1`', () => { it('should use a default `depth` of `1`', () => {
expect(flatMapDepth(array, identity), [1, 2, [3, [4]]).toEqual(5]); expect(flatMapDepth(array, identity)).toEqual([1, 2, [3, [4]], 5]);
}); });
it('should use `_.identity` when `iteratee` is nullish', () => { it('should use `_.identity` when `iteratee` is nullish', () => {
@@ -22,11 +22,11 @@ describe('flatMapDepth', () => {
it('should treat a `depth` of < `1` as a shallow clone', () => { it('should treat a `depth` of < `1` as a shallow clone', () => {
lodashStable.each([-1, 0], (depth) => { lodashStable.each([-1, 0], (depth) => {
expect(flatMapDepth(array, identity, depth), [1, [2, [3, [4]]).toEqual(5]]); expect(flatMapDepth(array, identity, depth)).toEqual([1, [2, [3, [4]], 5]]);
}); });
}); });
it('should coerce `depth` to an integer', () => { it('should coerce `depth` to an integer', () => {
expect(flatMapDepth(array, identity, 2.2), [1, 2, 3, [4]).toEqual(5]); expect(flatMapDepth(array, identity, 2.2)).toEqual([1, 2, 3, [4], 5]);
}); });
}); });

View File

@@ -8,12 +8,12 @@ describe('omit', () => {
const nested = { a: 1, b: { c: 2, d: 3 } }; const nested = { a: 1, b: { c: 2, d: 3 } };
it('should flatten `paths`', () => { it('should flatten `paths`', () => {
expect(omit(object, 'a', 'c'), { b: 2).toEqual(d: 4 }); expect(omit(object, 'a', 'c')).toEqual({ b: 2, d: 4 });
expect(omit(object, ['a', 'd'], 'c')).toEqual({ b: 2 }); expect(omit(object, ['a', 'd'], 'c')).toEqual({ b: 2 });
}); });
it('should support deep paths', () => { it('should support deep paths', () => {
expect(omit(nested, 'b.c'), { a: 1).toEqual(b: { d: 3 } }); expect(omit(nested, 'b.c')).toEqual({ a: 1, b: { d: 3 } });
}); });
it('should support path arrays', () => { it('should support path arrays', () => {
@@ -55,7 +55,7 @@ describe('omit', () => {
}); });
it('should work with `arguments` object `paths`', () => { it('should work with `arguments` object `paths`', () => {
expect(omit(object, args), { b: 2).toEqual(d: 4 }); expect(omit(object, args)).toEqual({ b: 2, d: 4 });
}); });
it('should not mutate `object`', () => { it('should not mutate `object`', () => {

View File

@@ -80,7 +80,7 @@ describe('overEvery', () => {
}); });
over('a', 'b', 'c'); over('a', 'b', 'c');
expect(args, ['a', 'b').toEqual('c']); expect(args).toEqual(['a', 'b', 'c']);
}); });
it('should use `this` binding of function for `predicates`', () => { it('should use `this` binding of function for `predicates`', () => {