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 <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
Anatoli Papirovski 2018-02-05 13:09:08 -05:00
parent c11cb038a1
commit 8204b0f9c6
No known key found for this signature in database
GPG Key ID: 614E2E1ABEB4B2C0

View File

@ -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 {