Skip to content

Commit 6df4f7b

Browse files
authored
stream: remove redundant method check from iter.pipeToSync
Signed-off-by: Renegade334 <contact.9a5d6388@renegade334.me.uk> PR-URL: nodejs#63099 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 60e4f7b commit 6df4f7b

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

lib/internal/streams/iter/pull.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,6 @@ function pipeToSync(source, ...args) {
764764
normalized;
765765

766766
let totalBytes = 0;
767-
const hasWriteSync = typeof writer.writeSync === 'function';
768767
const hasWritevSync = typeof writer.writevSync === 'function';
769768
const hasEndSync = typeof writer.endSync === 'function';
770769

@@ -778,11 +777,7 @@ function pipeToSync(source, ...args) {
778777
} else {
779778
for (let i = 0; i < batch.length; i++) {
780779
const chunk = batch[i];
781-
if (hasWriteSync) {
782-
writer.writeSync(chunk);
783-
} else {
784-
writer.write(chunk);
785-
}
780+
writer.writeSync(chunk);
786781
totalBytes += TypedArrayPrototypeGetByteLength(chunk);
787782
}
788783
}

0 commit comments

Comments
 (0)