From 301a4f8781a0d57fb3042e2dc05a13ef0c8717f6 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 20 Jan 2022 06:38:40 -0800 Subject: [PATCH] repl: check for precise values rather than falsy in loops MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-By: Anna Henningsen --- lib/repl.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/repl.js b/lib/repl.js index 43af9c7c0e09a9..c576f5b7f3094d 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -381,7 +381,7 @@ function REPLServer(prompt, paused = false; let entry; const tmpCompletionEnabled = self.isCompletionEnabled; - while (entry = ArrayPrototypeShift(pausedBuffer)) { + while ((entry = ArrayPrototypeShift(pausedBuffer)) !== undefined) { const { 0: type, 1: payload, 2: isCompletionEnabled } = entry; switch (type) { case 'key': { @@ -1450,7 +1450,7 @@ function complete(line, callback) { ArrayPrototypePush(completionGroups, getGlobalLexicalScopeNames(this[kContextId])); let contextProto = this.context; - while (contextProto = ObjectGetPrototypeOf(contextProto)) { + while ((contextProto = ObjectGetPrototypeOf(contextProto)) !== null) { ArrayPrototypePush(completionGroups, filteredOwnPropertyNames(contextProto)); }