Skip to content

Commit 63a67f8

Browse files
Trottdanielleadams
authored andcommitted
timers: check for nullish instead of falsy in loops
This prepares the code for the no-cond-assign ESLint rule. PR-URL: #41614 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent f066246 commit 63a67f8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/internal/timers.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ function getTimerCallbacks(runNextTicks) {
490490

491491
let list;
492492
let ranAtLeastOneList = false;
493-
while (list = timerListQueue.peek()) {
493+
while ((list = timerListQueue.peek()) != null) {
494494
if (list.expiry > now) {
495495
nextExpiry = list.expiry;
496496
return refCount > 0 ? nextExpiry : -nextExpiry;
@@ -511,7 +511,7 @@ function getTimerCallbacks(runNextTicks) {
511511

512512
let ranAtLeastOneTimer = false;
513513
let timer;
514-
while (timer = L.peek(list)) {
514+
while ((timer = L.peek(list)) != null) {
515515
const diff = now - timer._idleStart;
516516

517517
// Check if this loop iteration is too early for the next timer.

0 commit comments

Comments
 (0)