Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions lib/internal/webstreams/readablestream.js
Original file line number Diff line number Diff line change
Expand Up @@ -1105,16 +1105,7 @@ class ReadableByteStreamController {
enqueue(chunk) {
if (!isReadableByteStreamController(this))
throw new ERR_INVALID_THIS('ReadableByteStreamController');
if (!isArrayBufferView(chunk)) {
throw new ERR_INVALID_ARG_TYPE(
'chunk',
[
'Buffer',
'TypedArray',
'DataView',
],
chunk);
}
validateBuffer(chunk);
const chunkByteLength = ArrayBufferViewGetByteLength(chunk);
const chunkBuffer = ArrayBufferViewGetBuffer(chunk);
const chunkBufferByteLength = ArrayBufferPrototypeGetByteLength(chunkBuffer);
Expand Down
9 changes: 5 additions & 4 deletions lib/internal/webstreams/transformstream.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const {
const {
createDeferredPromise,
customInspectSymbol: kInspect,
kEmptyObject,
kEnumerableProperty,
} = require('internal/util');

Expand Down Expand Up @@ -117,8 +118,8 @@ class TransformStream {
*/
constructor(
transformer = null,
writableStrategy = {},
readableStrategy = {}) {
writableStrategy = kEmptyObject,
readableStrategy = kEmptyObject) {
const readableType = transformer?.readableType;
const writableType = transformer?.writableType;
const start = transformer?.start;
Expand Down Expand Up @@ -292,7 +293,7 @@ class TransformStreamDefaultController {
}

/**
* @param {any} chunk
* @param {any} [chunk]
*/
enqueue(chunk = undefined) {
if (!isTransformStreamDefaultController(this))
Expand All @@ -301,7 +302,7 @@ class TransformStreamDefaultController {
}

/**
* @param {any} reason
* @param {any} [reason]
*/
error(reason = undefined) {
if (!isTransformStreamDefaultController(this))
Expand Down
7 changes: 4 additions & 3 deletions lib/internal/webstreams/writablestream.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const {
const {
createDeferredPromise,
customInspectSymbol: kInspect,
kEmptyObject,
kEnumerableProperty,
} = require('internal/util');

Expand Down Expand Up @@ -133,7 +134,7 @@ class WritableStream {
* @param {UnderlyingSink} [sink]
* @param {QueuingStrategy} [strategy]
*/
constructor(sink = null, strategy = {}) {
constructor(sink = null, strategy = kEmptyObject) {
const type = sink?.type;
if (type !== undefined)
throw new ERR_INVALID_ARG_VALUE.RangeError('type', type);
Expand Down Expand Up @@ -202,7 +203,7 @@ class WritableStream {
}

/**
* @param {any} reason
* @param {any} [reason]
* @returns {Promise<void>}
*/
abort(reason = undefined) {
Expand Down Expand Up @@ -460,7 +461,7 @@ class WritableStreamDefaultWriter {
}

/**
* @param {any} chunk
* @param {any} [chunk]
* @returns {Promise<void>}
*/
write(chunk = undefined) {
Expand Down