Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTrivikram Kamat <16024985+trivikr@users.noreply.github.com>2019-12-14 18:14:48 +0300
committerKamat, Trivikram <16024985+trivikr@users.noreply.github.com>2019-12-17 02:18:50 +0300
commitce49f90e14212cd900aba69bac76a8af288d2b58 (patch)
treebc4aeaef3cce97b055a090546fb1c51a46973d13 /lib
parent6859fcf6f7c0710508b2a1f461043547e8a85acc (diff)
stream: use for...of
PR-URL: https://github.com/nodejs/node/pull/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>
Diffstat (limited to 'lib')
-rw-r--r--lib/_stream_duplex.js4
-rw-r--r--lib/_stream_readable.js8
2 files changed, 5 insertions, 7 deletions
diff --git a/lib/_stream_duplex.js b/lib/_stream_duplex.js
index 572e6da94d8..af2522313f8 100644
--- a/lib/_stream_duplex.js
+++ b/lib/_stream_duplex.js
@@ -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];
}
diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js
index 5ed86c62b7a..d69e5aa5b35 100644
--- a/lib/_stream_readable.js
+++ b/lib/_stream_readable.js
@@ -877,8 +877,8 @@ Readable.prototype.unpipe = function(dest) {
state.pipes = [];
state.flowing = false;
- for (var i = 0; i < dests.length; i++)
- dests[i].emit('unpipe', this, { hasUnpiped: false });
+ for (const dest of dests)
+ dest.emit('unpipe', this, { hasUnpiped: false });
return this;
}
@@ -1082,8 +1082,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