From 8204b0f9c6dbbdba1ca4120698a7f87ca1c9d91c Mon Sep 17 00:00:00 2001 From: Anatoli Papirovski Date: Mon, 5 Feb 2018 13:09:08 -0500 Subject: [PATCH] timers: simplify clearTimeout & clearInterval Remove unnecessary condition from timeout & interval clearing. PR-URL: https://github.com/nodejs/node/pull/18579 Reviewed-By: James M Snell Reviewed-By: Matteo Collina Reviewed-By: Ruben Bridgewater --- lib/timers.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/timers.js b/lib/timers.js index 954c73f6026..39a22454ac9 100644 --- a/lib/timers.js +++ b/lib/timers.js @@ -465,8 +465,8 @@ function rearm(timer, start = TimerWrap.now()) { const clearTimeout = exports.clearTimeout = function(timer) { - if (timer && (timer[kOnTimeout] || timer._onTimeout)) { - timer[kOnTimeout] = timer._onTimeout = null; + if (timer && timer._onTimeout) { + timer._onTimeout = null; if (timer instanceof Timeout) { timer.close(); // for after === 0 } else {