From e806bac12d25f8538320dda3e796313370f091ee Mon Sep 17 00:00:00 2001 From: uzlopak Date: Tue, 30 Jan 2024 07:05:04 +0100 Subject: [PATCH] chore: fix two codesmells --- lib/handler/RetryHandler.js | 2 +- lib/websocket/receiver.js | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/handler/RetryHandler.js b/lib/handler/RetryHandler.js index 13eb1005083..05d55792c1f 100644 --- a/lib/handler/RetryHandler.js +++ b/lib/handler/RetryHandler.js @@ -151,7 +151,7 @@ class RetryHandler { let retryAfterHeader = headers != null && headers['retry-after'] if (retryAfterHeader) { retryAfterHeader = Number(retryAfterHeader) - retryAfterHeader = isNaN(retryAfterHeader) + retryAfterHeader = Number.isNaN(retryAfterHeader) ? calculateRetryAfterHeader(retryAfterHeader) : retryAfterHeader * 1e3 // Retry-After is in seconds } diff --git a/lib/websocket/receiver.js b/lib/websocket/receiver.js index b8b63ceb9d8..c75939c29b7 100644 --- a/lib/websocket/receiver.js +++ b/lib/websocket/receiver.js @@ -236,9 +236,7 @@ class ByteParser extends Writable { } } - if (this.#byteOffset > 0) { - continue - } else { + if (this.#byteOffset === 0) { callback() break }