Skip to content

Commit 43a37d5

Browse files
authored
Merge pull request #23 from SocketDev/fix-old-browsers
fix for browsers that don't support ?. syntax
2 parents f548bba + 784ee9d commit 43a37d5

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

lib/transform-stream.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
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)

0 commit comments

Comments
 (0)