Skip to content

Commit

Permalink
timers: check for nullish instead of falsy in loops
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Trott authored and danielleadams committed Mar 14, 2022
1 parent f066246 commit 63a67f8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/internal/timers.js
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ function getTimerCallbacks(runNextTicks) {

let list;
let ranAtLeastOneList = false;
while (list = timerListQueue.peek()) {
while ((list = timerListQueue.peek()) != null) {
if (list.expiry > now) {
nextExpiry = list.expiry;
return refCount > 0 ? nextExpiry : -nextExpiry;
Expand All @@ -511,7 +511,7 @@ function getTimerCallbacks(runNextTicks) {

let ranAtLeastOneTimer = false;
let timer;
while (timer = L.peek(list)) {
while ((timer = L.peek(list)) != null) {
const diff = now - timer._idleStart;

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

0 comments on commit 63a67f8

Please sign in to comment.