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 <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
  • Loading branch information
Trott authored and BethGriggs committed Jan 24, 2022
1 parent cf1d3d1 commit 2b4e46f
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 2b4e46f

Please sign in to comment.