| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 02a61dd commit c1cc1f9
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1002,7 +1002,7 @@ function eventTargetAgnosticAddListener(emitter, name, listener, flags) { | |||
| 1002 | 1002 | * @param {{ signal: AbortSignal; }} [options] | |
| 1003 | 1003 | * @returns {AsyncIterator} | |
| 1004 | 1004 | */ | |
| 1005 | - function on(emitter, event, options) { | ||
| 1005 | + function on(emitter, event, options = kEmptyObject) { | ||
| 1006 | 1006 | const signal = options?.signal; | |
| 1007 | 1007 | validateAbortSignal(signal, 'options.signal'); | |
| 1008 | 1008 | if (signal?.aborted) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -14,7 +14,10 @@ const { | |||
| 14 | 14 | ERR_INVALID_ARG_VALUE, | |
| 15 | 15 | }, | |
| 16 | 16 | } = require('internal/errors'); | |
| 17 | - const { createDeferredPromise } = require('internal/util'); | ||
| 17 | + const { | ||
| 18 | + createDeferredPromise, | ||
| 19 | + kEmptyObject, | ||
| 20 | + } = require('internal/util'); | ||
| 18 | 21 | ||
| 19 | 22 | const { | |
| 20 | 23 | kFsStatsFieldsNumber, | |
@@ -296,7 +299,7 @@ ObjectDefineProperty(FSEvent.prototype, 'owner', { | |||
| 296 | 299 | set(v) { return this[owner_symbol] = v; } | |
| 297 | 300 | }); | |
| 298 | 301 | ||
| 299 | - async function* watch(filename, options = {}) { | ||
| 302 | + async function* watch(filename, options = kEmptyObject) { | ||
| 300 | 303 | const path = toNamespacedPath(getValidatedPath(filename)); | |
| 301 | 304 | validateObject(options, 'options'); | |
| 302 | 305 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3326,7 +3326,7 @@ function createSecureServer(options, handler) { | |||
| 3326 | 3326 | function createServer(options, handler) { | |
| 3327 | 3327 | if (typeof options === 'function') { | |
| 3328 | 3328 | handler = options; | |
| 3329 | - options = {}; | ||
| 3329 | + options = kEmptyObject; | ||
| 3330 | 3330 | } | |
| 3331 | 3331 | return new Http2Server(options, handler); | |
| 3332 | 3332 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,6 +26,7 @@ const { | |||
| 26 | 26 | ||
| 27 | 27 | const { | |
| 28 | 28 | customInspectSymbol: kInspect, | |
| 29 | + kEmptyObject, | ||
| 29 | 30 | } = require('internal/util'); | |
| 30 | 31 | ||
| 31 | 32 | const { inspect } = require('internal/util/inspect'); | |
@@ -44,7 +45,7 @@ class SocketAddress extends JSTransferable { | |||
| 44 | 45 | return value?.[kHandle] !== undefined; | |
| 45 | 46 | } | |
| 46 | 47 | ||
| 47 | - constructor(options = {}) { | ||
| 48 | + constructor(options = kEmptyObject) { | ||
| 48 | 49 | super(); | |
| 49 | 50 | validateObject(options, 'options'); | |
| 50 | 51 | let { family = 'ipv4' } = options; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -108,6 +108,7 @@ const { | |||
| 108 | 108 | } = require('internal/errors'); | |
| 109 | 109 | const { isUint8Array } = require('internal/util/types'); | |
| 110 | 110 | const { queueMicrotask } = require('internal/process/task_queues'); | |
| 111 | + const { kEmptyObject } = require('internal/util'); | ||
| 111 | 112 | const { | |
| 112 | 113 | validateAbortSignal, | |
| 113 | 114 | validateBoolean, | |
@@ -1583,7 +1584,7 @@ function Server(options, connectionListener) { | |||
| 1583 | 1584 | ||
| 1584 | 1585 | if (typeof options === 'function') { | |
| 1585 | 1586 | connectionListener = options; | |
| 1586 | - options = {}; | ||
| 1587 | + options = kEmptyObject; | ||
| 1587 | 1588 | this.on('connection', connectionListener); | |
| 1588 | 1589 | } else if (options == null || typeof options === 'object') { | |
| 1589 | 1590 | options = { ...options }; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments