timers: check for nullish instead of falsy in loops

This prepares the code for the no-cond-assign ESLint rule.

PR-URL: https://github.com/nodejs/node/pull/41614
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
Rich Trott authored and Danielle Adams committed 2022-03-14 09:32:03 -04:00
1 parent f066246729
commit 63a67f8dad
1 file changed
+2 -2
+2 -2
View File
@@ -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;
@@ -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.