Skip to content

Commit

Permalink
stream: use for...of
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
trivikr authored and targos committed Jan 14, 2020
1 parent 95f332f commit f6acf9a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions lib/_stream_duplex.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ ObjectSetPrototypeOf(Duplex, Readable);

{
// Allow the keys array to be GC'ed.
const keys = ObjectKeys(Writable.prototype);
for (let v = 0; v < keys.length; v++) {
const method = keys[v];
for (const method of ObjectKeys(Writable.prototype)) {
if (!Duplex.prototype[method])
Duplex.prototype[method] = Writable.prototype[method];
}
Expand Down
4 changes: 2 additions & 2 deletions lib/_stream_readable.js
Original file line number Diff line number Diff line change
Expand Up @@ -1064,8 +1064,8 @@ Readable.prototype.wrap = function(stream) {
}

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

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

0 comments on commit f6acf9a

Please sign in to comment.