From 16dec4268cd725e07814889d82ef68db916f329b Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 20 Jan 2022 06:25:42 -0800 Subject: [PATCH] stream: check for null instead of falsy in loops MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Check for null in while loops. This is preparing 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/internal/streams/buffer_list.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/internal/streams/buffer_list.js b/lib/internal/streams/buffer_list.js index 2dc803d6fa0425..5279f65b4bdd23 100644 --- a/lib/internal/streams/buffer_list.js +++ b/lib/internal/streams/buffer_list.js @@ -57,7 +57,7 @@ module.exports = class BufferList { return ''; let p = this.head; let ret = '' + p.data; - while (p = p.next) + while ((p = p.next) !== null) ret += s + p.data; return ret; } @@ -129,7 +129,7 @@ module.exports = class BufferList { break; } ++c; - } while (p = p.next); + } while ((p = p.next) !== null); this.length -= c; return ret; } @@ -163,7 +163,7 @@ module.exports = class BufferList { break; } ++c; - } while (p = p.next); + } while ((p = p.next) !== null); this.length -= c; return ret; }