0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-21 13:09:21 +01:00

stream: change stream to use index instead of for...of

PR-URL: https://github.com/nodejs/node/pull/54474
Refs: https://github.com/nodejs/node/blob/main/doc/contributing/primordials.md#unsafe-array-iteration
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Raz Luvaton <rluvaton@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Wiyeong Seo 2024-08-23 16:31:55 +09:00 committed by GitHub
parent d7871442e2
commit 4de992fa5b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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) {