Skip to content

Commit dacffd3

Browse files
Trottdanielleadams
authored andcommitted
repl: check for precise values rather than falsy in loops
This prepares the code for the no-cond-assign ESLint rule. PR-URL: #41614 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent a4ad26d commit dacffd3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/repl.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ function REPLServer(prompt,
381381
paused = false;
382382
let entry;
383383
const tmpCompletionEnabled = self.isCompletionEnabled;
384-
while (entry = ArrayPrototypeShift(pausedBuffer)) {
384+
while ((entry = ArrayPrototypeShift(pausedBuffer)) !== undefined) {
385385
const { 0: type, 1: payload, 2: isCompletionEnabled } = entry;
386386
switch (type) {
387387
case 'key': {
@@ -1450,7 +1450,7 @@ function complete(line, callback) {
14501450
ArrayPrototypePush(completionGroups,
14511451
getGlobalLexicalScopeNames(this[kContextId]));
14521452
let contextProto = this.context;
1453-
while (contextProto = ObjectGetPrototypeOf(contextProto)) {
1453+
while ((contextProto = ObjectGetPrototypeOf(contextProto)) !== null) {
14541454
ArrayPrototypePush(completionGroups,
14551455
filteredOwnPropertyNames(contextProto));
14561456
}

0 commit comments

Comments
 (0)