Skip to content

Commit 15eff38

Browse files
committed
stream: replace native methods with primordials
Replace native methods with primordials.
1 parent 5c8ce91 commit 15eff38

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/internal/streams/writable.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626
'use strict';
2727

2828
const {
29+
ArrayPrototypePush,
2930
ArrayPrototypeSlice,
31+
ArrayPrototypeSplice,
3032
Error,
3133
FunctionPrototypeSymbolHasInstance,
3234
ObjectDefineProperties,
@@ -554,7 +556,7 @@ function writeOrBuffer(stream, state, chunk, encoding, callback) {
554556
state[kBufferedValue] = [];
555557
}
556558

557-
state[kBufferedValue].push({ chunk, encoding, callback });
559+
ArrayPrototypePush(state[kBufferedValue], { chunk, encoding, callback });
558560
if ((state[kState] & kAllBuffers) !== 0 && encoding !== 'buffer') {
559561
state[kState] &= ~kAllBuffers;
560562
}
@@ -784,7 +786,7 @@ function clearBuffer(stream, state) {
784786
if (i === buffered.length) {
785787
resetBuffer(state);
786788
} else if (i > 256) {
787-
buffered.splice(0, i);
789+
ArrayPrototypeSplice(buffered, 0, i);
788790
state.bufferedIndex = 0;
789791
} else {
790792
state.bufferedIndex = i;
@@ -858,7 +860,7 @@ Writable.prototype.end = function(chunk, encoding, cb) {
858860
} else {
859861
state[kState] |= kOnFinished;
860862
state[kOnFinishedValue] ??= [];
861-
state[kOnFinishedValue].push(cb);
863+
ArrayPrototypePush(state[kOnFinishedValue], cb);
862864
}
863865
}
864866

0 commit comments

Comments
 (0)