diff --git a/lib/internal/blob.js b/lib/internal/blob.js index 723e0983435a75..836baac7ed2452 100644 --- a/lib/internal/blob.js +++ b/lib/internal/blob.js @@ -44,6 +44,7 @@ const { const { createDeferredPromise, customInspectSymbol: kInspect, + kEmptyObject, } = require('internal/util'); const { inspect } = require('internal/util/inspect'); @@ -134,7 +135,7 @@ class Blob { * }} [options] * @constructs {Blob} */ - constructor(sources = [], options = {}) { + constructor(sources = [], options = kEmptyObject) { if (sources === null || typeof sources[SymbolIterator] !== 'function' || typeof sources === 'string') { diff --git a/lib/internal/encoding.js b/lib/internal/encoding.js index 1c0c17d534f036..f9fa43228d5f57 100644 --- a/lib/internal/encoding.js +++ b/lib/internal/encoding.js @@ -33,6 +33,7 @@ const kEncoder = Symbol('encoder'); const { getConstructorOf, customInspectSymbol: inspect, + kEmptyObject, kEnumerableProperty, } = require('internal/util'); @@ -379,7 +380,7 @@ function makeTextDecoderICU() { } = internalBinding('icu'); class TextDecoder { - constructor(encoding = 'utf-8', options = {}) { + constructor(encoding = 'utf-8', options = kEmptyObject) { encoding = `${encoding}`; validateObject(options, 'options', { nullable: true, @@ -408,7 +409,7 @@ function makeTextDecoderICU() { } - decode(input = empty, options = {}) { + decode(input = empty, options = kEmptyObject) { validateDecoder(this); if (isAnyArrayBuffer(input)) { input = lazyBuffer().from(input); @@ -453,7 +454,7 @@ function makeTextDecoderJS() { } class TextDecoder { - constructor(encoding = 'utf-8', options = {}) { + constructor(encoding = 'utf-8', options = kEmptyObject) { encoding = `${encoding}`; validateObject(options, 'options', { nullable: true, @@ -481,7 +482,7 @@ function makeTextDecoderJS() { this[kBOMSeen] = false; } - decode(input = empty, options = {}) { + decode(input = empty, options = kEmptyObject) { validateDecoder(this); if (isAnyArrayBuffer(input)) { input = lazyBuffer().from(input); diff --git a/lib/internal/histogram.js b/lib/internal/histogram.js index 4237e716dc07e4..ca540e555e0160 100644 --- a/lib/internal/histogram.js +++ b/lib/internal/histogram.js @@ -17,6 +17,7 @@ const { const { customInspectSymbol: kInspect, + kEmptyObject, } = require('internal/util'); const { inspect } = require('util'); @@ -352,7 +353,7 @@ internalRecordableHistogram.prototype[kDeserialize] = () => {}; * }} [options] * @returns {RecordableHistogram} */ -function createHistogram(options = {}) { +function createHistogram(options = kEmptyObject) { validateObject(options, 'options'); const { lowest = 1, diff --git a/lib/internal/promise_hooks.js b/lib/internal/promise_hooks.js index be70879cbcbb93..0938a86d06407b 100644 --- a/lib/internal/promise_hooks.js +++ b/lib/internal/promise_hooks.js @@ -11,6 +11,7 @@ const { const { setPromiseHooks } = internalBinding('async_wrap'); const { triggerUncaughtException } = internalBinding('errors'); +const { kEmptyObject } = require('internal/util'); const { validatePlainFunction } = require('internal/validators'); const hooks = { @@ -101,7 +102,7 @@ const onBefore = makeUseHook('before'); const onAfter = makeUseHook('after'); const onSettled = makeUseHook('settled'); -function createHook({ init, before, after, settled } = {}) { +function createHook({ init, before, after, settled } = kEmptyObject) { const hooks = []; if (init) ArrayPrototypePush(hooks, onInit(init));