GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — lib: use kEmptyObject and update JSDoc in webstreams · nodejs/node@4d73ea7

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal/webstreams
    • readablestream.js
    • transformstream.js
    • writablestream.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/webstreams/readablestream.js‎

Copy file name to clipboardExpand all lines: lib/internal/webstreams/readablestream.js
+1-10Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,16 +1132,7 @@ class ReadableByteStreamController {
11321132
enqueue(chunk) {
11331133
if (!isReadableByteStreamController(this))
11341134
throw new ERR_INVALID_THIS('ReadableByteStreamController');
1135-
if (!isArrayBufferView(chunk)) {
1136-
throw new ERR_INVALID_ARG_TYPE(
1137-
'chunk',
1138-
[
1139-
'Buffer',
1140-
'TypedArray',
1141-
'DataView',
1142-
],
1143-
chunk);
1144-
}
1135+
validateBuffer(chunk);
11451136
const chunkByteLength = ArrayBufferViewGetByteLength(chunk);
11461137
const chunkBuffer = ArrayBufferViewGetBuffer(chunk);
11471138
const chunkBufferByteLength = ArrayBufferPrototypeGetByteLength(chunkBuffer);
Collapse file

‎lib/internal/webstreams/transformstream.js‎

Copy file name to clipboardExpand all lines: lib/internal/webstreams/transformstream.js
+5-4Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const {
2626
const {
2727
createDeferredPromise,
2828
customInspectSymbol: kInspect,
29+
kEmptyObject,
2930
kEnumerableProperty,
3031
} = require('internal/util');
3132

@@ -117,8 +118,8 @@ class TransformStream {
117118
*/
118119
constructor(
119120
transformer = null,
120-
writableStrategy = {},
121-
readableStrategy = {}) {
121+
writableStrategy = kEmptyObject,
122+
readableStrategy = kEmptyObject) {
122123
const readableType = transformer?.readableType;
123124
const writableType = transformer?.writableType;
124125
const start = transformer?.start;
@@ -292,7 +293,7 @@ class TransformStreamDefaultController {
292293
}
293294

294295
/**
295-
* @param {any} chunk
296+
* @param {any} [chunk]
296297
*/
297298
enqueue(chunk = undefined) {
298299
if (!isTransformStreamDefaultController(this))
@@ -301,7 +302,7 @@ class TransformStreamDefaultController {
301302
}
302303

303304
/**
304-
* @param {any} reason
305+
* @param {any} [reason]
305306
*/
306307
error(reason = undefined) {
307308
if (!isTransformStreamDefaultController(this))
Collapse file

‎lib/internal/webstreams/writablestream.js‎

Copy file name to clipboardExpand all lines: lib/internal/webstreams/writablestream.js
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const {
3333
const {
3434
createDeferredPromise,
3535
customInspectSymbol: kInspect,
36+
kEmptyObject,
3637
kEnumerableProperty,
3738
SideEffectFreeRegExpPrototypeSymbolReplace,
3839
} = require('internal/util');
@@ -148,7 +149,7 @@ class WritableStream {
148149
* @param {UnderlyingSink} [sink]
149150
* @param {QueuingStrategy} [strategy]
150151
*/
151-
constructor(sink = null, strategy = {}) {
152+
constructor(sink = null, strategy = kEmptyObject) {
152153
const type = sink?.type;
153154
if (type !== undefined)
154155
throw new ERR_INVALID_ARG_VALUE.RangeError('type', type);
@@ -217,7 +218,7 @@ class WritableStream {
217218
}
218219

219220
/**
220-
* @param {any} reason
221+
* @param {any} [reason]
221222
* @returns {Promise<void>}
222223
*/
223224
abort(reason = undefined) {
@@ -475,7 +476,7 @@ class WritableStreamDefaultWriter {
475476
}
476477

477478
/**
478-
* @param {any} chunk
479+
* @param {any} [chunk]
479480
* @returns {Promise<void>}
480481
*/
481482
write(chunk = undefined) {

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.