Skip to content

Commit 7fdc21f

Browse files
committed
stream: optimize internal pipe handling with optional chaining
1 parent 2828147 commit 7fdc21f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/internal/webstreams/readablestream.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1374,8 +1374,8 @@ function readableStreamPipeTo(
13741374
preventCancel,
13751375
signal) {
13761376

1377-
const sourceStreamBase = source[kStreamBase];
1378-
const destStreamBase = dest[kStreamBase];
1377+
const sourceStreamBase = source?.[kStreamBase];
1378+
const destStreamBase = dest?.[kStreamBase];
13791379

13801380
if (sourceStreamBase !== undefined &&
13811381
destStreamBase !== undefined &&
@@ -1395,7 +1395,7 @@ function readableStreamPipeTo(
13951395
};
13961396
pipe.start();
13971397
} catch (error) {
1398-
return PromiseReject(error);
1398+
promise.reject(error);
13991399
}
14001400

14011401
return promise.promise;

0 commit comments

Comments
 (0)