Skip to content

Commit c004aba

Browse files
MCproteintargos
authored andcommitted
lib: replace spread operator with primordials function
replaced the spread operator with ArrayPrototypeSlice to avoid reliance on user-mutable methods and enhance the safety of array iteration Refs: https://github.com/nodejs/node/blob/main/doc/contributing/primordials.md#unsafe-array-iteration PR-URL: #54053 Refs: https://github.com/nodejs/node/blob/main/doc/contributing/primordials.md#unsafe-array-iteration Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Raz Luvaton <rluvaton@gmail.com>
1 parent d3a743f commit c004aba

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎lib/internal/streams/compose.js‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
'use strict';
22

3+
const{
4+
ArrayPrototypeSlice,
5+
}=primordials;
6+
37
const{ pipeline }=require('internal/streams/pipeline');
48
constDuplex=require('internal/streams/duplex');
59
const{ destroyer }=require('internal/streams/destroy');
@@ -30,7 +34,7 @@ module.exports = function compose(...streams) {
3034
returnDuplex.from(streams[0]);
3135
}
3236

33-
constorgStreams=[...streams];
37+
constorgStreams=ArrayPrototypeSlice(streams);
3438

3539
if(typeofstreams[0]==='function'){
3640
streams[0]=Duplex.from(streams[0]);

0 commit comments

Comments
 (0)