Skip to content

Commit 05a16e7

Browse files
aduh95danielleadams
authored andcommitted
worker: refactor to avoid unsafe array iteration
PR-URL: #37346 Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Harshitha K P <harshitha014@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 6d53e79 commit 05a16e7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/internal/main/worker_thread.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
const {
77
ArrayPrototypeConcat,
8+
ArrayPrototypeForEach,
89
ArrayPrototypeSplice,
910
ObjectDefineProperty,
1011
PromisePrototypeCatch,
@@ -178,8 +179,9 @@ port.on('message', (message) => {
178179
}
179180
} else if (message.type === STDIO_PAYLOAD) {
180181
const { stream, chunks } = message;
181-
for (const { chunk, encoding } of chunks)
182+
ArrayPrototypeForEach(chunks, ({ chunk, encoding }) => {
182183
process[stream].push(chunk, encoding);
184+
});
183185
} else {
184186
assert(
185187
message.type === STDIO_WANTS_MORE_DATA,

0 commit comments

Comments
 (0)