Skip to content

Commit f6acf9a

Browse files
trivikrtargos
authored andcommitted
stream: use for...of
PR-URL: #30960 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 95f332f commit f6acf9a

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

lib/_stream_duplex.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ ObjectSetPrototypeOf(Duplex, Readable);
4242

4343
{
4444
// Allow the keys array to be GC'ed.
45-
const keys = ObjectKeys(Writable.prototype);
46-
for (let v = 0; v < keys.length; v++) {
47-
const method = keys[v];
45+
for (const method of ObjectKeys(Writable.prototype)) {
4846
if (!Duplex.prototype[method])
4947
Duplex.prototype[method] = Writable.prototype[method];
5048
}

lib/_stream_readable.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1064,8 +1064,8 @@ Readable.prototype.wrap = function(stream) {
10641064
}
10651065

10661066
// Proxy certain important events.
1067-
for (var n = 0; n < kProxyEvents.length; n++) {
1068-
stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
1067+
for (const kProxyEvent of kProxyEvents) {
1068+
stream.on(kProxyEvent, this.emit.bind(this, kProxyEvent));
10691069
}
10701070

10711071
// When we try to consume some more bytes, simply unpause the

0 commit comments

Comments
 (0)