File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77 * result.done is a promise that fulfills or rejects once the stream is done.
88 * Includes a shim for environments where TransformStream is not available.
99 */
10- export function transformStream ( sourceReadable , transformer ) {
10+ export function transformStream ( sourceReadable , transformer = { } ) {
1111 let transformedReadable
1212 let done
1313
@@ -47,7 +47,7 @@ class TransformStreamSource {
4747 }
4848
4949 async start ( controller ) {
50- if ( this . transformer ? .start ) {
50+ if ( this . transformer . start ) {
5151 try {
5252 await this . transformer . start ( controller )
5353 } catch ( err ) {
@@ -71,14 +71,14 @@ class TransformStreamSource {
7171 try {
7272 const data = await this . reader . read ( )
7373 if ( data . done ) {
74- if ( this . transformer ? .flush ) {
74+ if ( this . transformer . flush ) {
7575 await this . transformer . flush ( controller )
7676 }
7777 controller . close ( )
7878 this . resolveDone ( )
7979 return
8080 }
81- if ( this . transformer ? .transform ) {
81+ if ( this . transformer . transform ) {
8282 await this . transformer . transform ( data . value , wrappedController )
8383 } else {
8484 wrappedController . enqueue ( data . value )
You can’t perform that action at this time.
0 commit comments