diff --git a/lib/stream.js b/lib/stream.js index 420415a2259827..a26cc0b81c557e 100644 --- a/lib/stream.js +++ b/lib/stream.js @@ -61,7 +61,9 @@ Stream.isReadable = utils.isReadable; Stream.isWritable = utils.isWritable; Stream.Readable = require('internal/streams/readable'); -for (const key of ObjectKeys(streamReturningOperators)) { +const streamKeys = ObjectKeys(streamReturningOperators); +for (let i = 0; i < streamKeys.length; i++) { + const key = streamKeys[i]; const op = streamReturningOperators[key]; function fn(...args) { if (new.target) { @@ -79,7 +81,9 @@ for (const key of ObjectKeys(streamReturningOperators)) { writable: true, }); } -for (const key of ObjectKeys(promiseReturningOperators)) { +const promiseKeys = ObjectKeys(promiseReturningOperators); +for (let i = 0; i < promiseKeys.length; i++) { + const key = promiseKeys[i]; const op = promiseReturningOperators[key]; function fn(...args) { if (new.target) {