From 7f69973208aec72deecebeff06d64d8895d0458b Mon Sep 17 00:00:00 2001 From: Mohammed Keyvanzadeh Date: Mon, 7 Feb 2022 01:04:09 +0330 Subject: [PATCH] stream: use standard for loop instead of for..of Use the standard `for` loop style instead of `for..of` for consistency. PR-URL: https://github.com/nodejs/node/pull/41871 Reviewed-By: Matteo Collina Reviewed-By: Benjamin Gruenbaum Reviewed-By: Robert Nagy Reviewed-By: Darshan Sen Reviewed-By: James M Snell Reviewed-By: Antoine du Hamel Reviewed-By: Mestery Reviewed-By: Minwoo Jung --- lib/internal/streams/duplex.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/internal/streams/duplex.js b/lib/internal/streams/duplex.js index bc92e9021ab57c..79f91fa0866e25 100644 --- a/lib/internal/streams/duplex.js +++ b/lib/internal/streams/duplex.js @@ -42,8 +42,10 @@ ObjectSetPrototypeOf(Duplex.prototype, Readable.prototype); ObjectSetPrototypeOf(Duplex, Readable); { + const keys = ObjectKeys(Writable.prototype); // Allow the keys array to be GC'ed. - for (const method of ObjectKeys(Writable.prototype)) { + for (let i = 0; i < keys.length; i++) { + const method = keys[i]; if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; }