Skip to content

Commit 5e72978

Browse files
committed
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
1 parent d6515f2 commit 5e72978

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/internal/streams/compose.js

Lines changed: 4 additions & 3 deletions
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
const Duplex = require('internal/streams/duplex');
59
const { destroyer } = require('internal/streams/destroy');
@@ -20,9 +24,6 @@ const {
2024
},
2125
} = require('internal/errors');
2226
const eos = require('internal/streams/end-of-stream');
23-
const {
24-
ArrayPrototypeSlice
25-
} = primordials;
2627

2728
module.exports = function compose(...streams) {
2829
if (streams.length === 0) {

0 commit comments

Comments
 (0)