mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
wip: code formatting nits continued
This commit is contained in:
@@ -98,17 +98,19 @@ function debounce(func, wait, options) {
|
||||
return result;
|
||||
}
|
||||
|
||||
function startTimer(pendingFunc, wait) {
|
||||
function startTimer(pendingFunc, milliseconds) {
|
||||
if (useRAF) {
|
||||
root.cancelAnimationFrame(timerId);
|
||||
return root.requestAnimationFrame(pendingFunc);
|
||||
}
|
||||
return setTimeout(pendingFunc, wait);
|
||||
// eslint-disable-next-line @typescript-eslint/no-implied-eval
|
||||
return setTimeout(pendingFunc, milliseconds);
|
||||
}
|
||||
|
||||
function cancelTimer(id) {
|
||||
if (useRAF) {
|
||||
return root.cancelAnimationFrame(id);
|
||||
root.cancelAnimationFrame(id);
|
||||
return;
|
||||
}
|
||||
clearTimeout(id);
|
||||
}
|
||||
@@ -152,6 +154,7 @@ function debounce(func, wait, options) {
|
||||
}
|
||||
// Restart the timer.
|
||||
timerId = startTimer(timerExpired, remainingWait(time));
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function trailingEdge(time) {
|
||||
|
||||
@@ -28,7 +28,7 @@ describe('conforms methods', () => {
|
||||
});
|
||||
|
||||
let actual = lodashStable.filter(objects, par);
|
||||
expect(actual, [objects[0]).toEqual(objects[2]]);
|
||||
expect(actual).toEqual([objects[0], objects[2]]);
|
||||
|
||||
par = conforms({
|
||||
b: function (value) {
|
||||
@@ -62,7 +62,7 @@ describe('conforms methods', () => {
|
||||
const par = conforms(new Foo());
|
||||
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`, () => {
|
||||
|
||||
@@ -6,7 +6,7 @@ describe('flatMapDepth', () => {
|
||||
const array = [1, [2, [3, [4]], 5]];
|
||||
|
||||
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', () => {
|
||||
@@ -22,11 +22,11 @@ describe('flatMapDepth', () => {
|
||||
|
||||
it('should treat a `depth` of < `1` as a shallow clone', () => {
|
||||
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', () => {
|
||||
expect(flatMapDepth(array, identity, 2.2), [1, 2, 3, [4]).toEqual(5]);
|
||||
expect(flatMapDepth(array, identity, 2.2)).toEqual([1, 2, 3, [4], 5]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -8,12 +8,12 @@ describe('omit', () => {
|
||||
const nested = { a: 1, b: { c: 2, d: 3 } };
|
||||
|
||||
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 });
|
||||
});
|
||||
|
||||
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', () => {
|
||||
@@ -55,7 +55,7 @@ describe('omit', () => {
|
||||
});
|
||||
|
||||
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`', () => {
|
||||
|
||||
@@ -80,7 +80,7 @@ describe('overEvery', () => {
|
||||
});
|
||||
|
||||
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`', () => {
|
||||
|
||||
Reference in New Issue
Block a user