Skip to content

Commit 16dec42

Browse files
TrottBethGriggs
authored andcommitted
stream: check for null instead of falsy in loops
Check for null in while loops. This is preparing the code for the no-cond-assign ESLint rule. PR-URL: #41614 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
1 parent 627f19a commit 16dec42

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/internal/streams/buffer_list.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ module.exports = class BufferList {
5757
return '';
5858
let p = this.head;
5959
let ret = '' + p.data;
60-
while (p = p.next)
60+
while ((p = p.next) !== null)
6161
ret += s + p.data;
6262
return ret;
6363
}
@@ -129,7 +129,7 @@ module.exports = class BufferList {
129129
break;
130130
}
131131
++c;
132-
} while (p = p.next);
132+
} while ((p = p.next) !== null);
133133
this.length -= c;
134134
return ret;
135135
}
@@ -163,7 +163,7 @@ module.exports = class BufferList {
163163
break;
164164
}
165165
++c;
166-
} while (p = p.next);
166+
} while ((p = p.next) !== null);
167167
this.length -= c;
168168
return ret;
169169
}

0 commit comments

Comments
 (0)