| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,7 +11,10 @@ const { | |||
| 11 | 11 | ERR_INVALID_ARG_TYPE, | |
| 12 | 12 | ERR_STREAM_PREMATURE_CLOSE | |
| 13 | 13 | } = codes; | |
| 14 | - const { once } = require('internal/util'); | ||
| 14 | + const { | ||
| 15 | + kEmptyObject, | ||
| 16 | + once, | ||
| 17 | + } = require('internal/util'); | ||
| 15 | 18 | const { | |
| 16 | 19 | validateAbortSignal, | |
| 17 | 20 | validateFunction, | |
@@ -43,9 +46,9 @@ const nop = () => {}; | |||
| 43 | 46 | function eos(stream, options, callback) { | |
| 44 | 47 | if (arguments.length === 2) { | |
| 45 | 48 | callback = options; | |
| 46 | - options = {}; | ||
| 49 | + options = kEmptyObject; | ||
| 47 | 50 | } else if (options == null) { | |
| 48 | - options = {}; | ||
| 51 | + options = kEmptyObject; | ||
| 49 | 52 | } else { | |
| 50 | 53 | validateObject(options, 'options'); | |
| 51 | 54 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -55,6 +55,7 @@ const { | |||
| 55 | 55 | ||
| 56 | 56 | const { | |
| 57 | 57 | createDeferredPromise, | |
| 58 | + kEmptyObject, | ||
| 58 | 59 | } = require('internal/util'); | |
| 59 | 60 | ||
| 60 | 61 | const { | |
@@ -198,7 +199,7 @@ function newWritableStreamFromStreamWritable(streamWritable) { | |||
| 198 | 199 | * }} [options] | |
| 199 | 200 | * @returns {Writable} | |
| 200 | 201 | */ | |
| 201 | - function newStreamWritableFromWritableStream(writableStream, options = {}) { | ||
| 202 | + function newStreamWritableFromWritableStream(writableStream, options = kEmptyObject) { | ||
| 202 | 203 | if (!isWritableStream(writableStream)) { | |
| 203 | 204 | throw new ERR_INVALID_ARG_TYPE( | |
| 204 | 205 | 'writableStream', | |
@@ -441,7 +442,7 @@ function newReadableStreamFromStreamReadable(streamReadable) { | |||
| 441 | 442 | * }} [options] | |
| 442 | 443 | * @returns {Readable} | |
| 443 | 444 | */ | |
| 444 | - function newStreamReadableFromReadableStream(readableStream, options = {}) { | ||
| 445 | + function newStreamReadableFromReadableStream(readableStream, options = kEmptyObject) { | ||
| 445 | 446 | if (!isReadableStream(readableStream)) { | |
| 446 | 447 | throw new ERR_INVALID_ARG_TYPE( | |
| 447 | 448 | 'readableStream', | |
@@ -585,7 +586,7 @@ function newReadableWritablePairFromDuplex(duplex) { | |||
| 585 | 586 | * }} [options] | |
| 586 | 587 | * @returns {Duplex} | |
| 587 | 588 | */ | |
| 588 | - function newStreamDuplexFromReadableWritablePair(pair = {}, options = {}) { | ||
| 589 | + function newStreamDuplexFromReadableWritablePair(pair = kEmptyObject, options = kEmptyObject) { | ||
| 589 | 590 | validateObject(pair, 'pair'); | |
| 590 | 591 | const { | |
| 591 | 592 | readable: readableStream, | |
@@ -876,7 +877,7 @@ function newWritableStreamFromStreamBase(streamBase, strategy) { | |||
| 876 | 877 | * @param {QueuingStrategy} strategy | |
| 877 | 878 | * @returns {ReadableStream} | |
| 878 | 879 | */ | |
| 879 | - function newReadableStreamFromStreamBase(streamBase, strategy, options = {}) { | ||
| 880 | + function newReadableStreamFromStreamBase(streamBase, strategy, options = kEmptyObject) { | ||
| 880 | 881 | validateObject(streamBase, 'streamBase'); | |
| 881 | 882 | validateObject(options, 'options'); | |
| 882 | 883 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,6 +24,7 @@ const { | |||
| 24 | 24 | ||
| 25 | 25 | const { | |
| 26 | 26 | customInspectSymbol: kInspect, | |
| 27 | + kEmptyObject, | ||
| 27 | 28 | kEnumerableProperty, | |
| 28 | 29 | } = require('internal/util'); | |
| 29 | 30 | ||
@@ -114,7 +115,7 @@ class TextDecoderStream { | |||
| 114 | 115 | * ignoreBOM? : boolean, | |
| 115 | 116 | * }} [options] | |
| 116 | 117 | */ | |
| 117 | - constructor(encoding = 'utf-8', options = {}) { | ||
| 118 | + constructor(encoding = 'utf-8', options = kEmptyObject) { | ||
| 118 | 119 | this[kType] = 'TextDecoderStream'; | |
| 119 | 120 | this[kHandle] = new TextDecoder(encoding, options); | |
| 120 | 121 | this[kTransform] = new TransformStream({ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -50,6 +50,7 @@ const { | |||
| 50 | 50 | const { | |
| 51 | 51 | createDeferredPromise, | |
| 52 | 52 | customInspectSymbol: kInspect, | |
| 53 | + kEmptyObject, | ||
| 53 | 54 | kEnumerableProperty, | |
| 54 | 55 | } = require('internal/util'); | |
| 55 | 56 | ||
@@ -206,7 +207,7 @@ class ReadableStream { | |||
| 206 | 207 | * @param {UnderlyingSource} [source] | |
| 207 | 208 | * @param {QueuingStrategy} [strategy] | |
| 208 | 209 | */ | |
| 209 | - constructor(source = {}, strategy = {}) { | ||
| 210 | + constructor(source = {}, strategy = kEmptyObject) { | ||
| 210 | 211 | if (source === null) | |
| 211 | 212 | throw new ERR_INVALID_ARG_VALUE('source', 'Object', source); | |
| 212 | 213 | this[kState] = { | |
@@ -296,7 +297,7 @@ class ReadableStream { | |||
| 296 | 297 | * }} [options] | |
| 297 | 298 | * @returns {ReadableStreamReader} | |
| 298 | 299 | */ | |
| 299 | - getReader(options = {}) { | ||
| 300 | + getReader(options = kEmptyObject) { | ||
| 300 | 301 | if (!isReadableStream(this)) | |
| 301 | 302 | throw new ERR_INVALID_THIS('ReadableStream'); | |
| 302 | 303 | validateObject(options, 'options', { nullable: true, allowFunction: true }); | |
@@ -315,7 +316,7 @@ class ReadableStream { | |||
| 315 | 316 | * @param {StreamPipeOptions} [options] | |
| 316 | 317 | * @returns {ReadableStream} | |
| 317 | 318 | */ | |
| 318 | - pipeThrough(transform, options = {}) { | ||
| 319 | + pipeThrough(transform, options = kEmptyObject) { | ||
| 319 | 320 | if (!isReadableStream(this)) | |
| 320 | 321 | throw new ERR_INVALID_THIS('ReadableStream'); | |
| 321 | 322 | const readable = transform?.readable; | |
@@ -365,7 +366,7 @@ class ReadableStream { | |||
| 365 | 366 | * @param {StreamPipeOptions} [options] | |
| 366 | 367 | * @returns {Promise<void>} | |
| 367 | 368 | */ | |
| 368 | - pipeTo(destination, options = {}) { | ||
| 369 | + pipeTo(destination, options = kEmptyObject) { | ||
| 369 | 370 | try { | |
| 370 | 371 | if (!isReadableStream(this)) | |
| 371 | 372 | throw new ERR_INVALID_THIS('ReadableStream'); | |
@@ -416,7 +417,7 @@ class ReadableStream { | |||
| 416 | 417 | * }} [options] | |
| 417 | 418 | * @returns {AsyncIterable} | |
| 418 | 419 | */ | |
| 419 | - values(options = {}) { | ||
| 420 | + values(options = kEmptyObject) { | ||
| 420 | 421 | if (!isReadableStream(this)) | |
| 421 | 422 | throw new ERR_INVALID_THIS('ReadableStream'); | |
| 422 | 423 | validateObject(options, 'options'); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments