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 3, 2022
1 parent edc9291 commit 6e9e3df
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 6e9e3df

Please sign in to comment.