Skip to content

Commit 5e914f2

Browse files
committed
deep-squash: rename nullObject to kEmptyObject
1 parent b6bfaf1 commit 5e914f2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+134
-134
lines changed

lib/_tls_wrap.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const {
4141
const {
4242
assertCrypto,
4343
deprecate,
44-
nullObject,
44+
kEmptyObject,
4545
} = require('internal/util');
4646

4747
assertCrypto();
@@ -1182,9 +1182,9 @@ function Server(options, listener) {
11821182

11831183
if (typeof options === 'function') {
11841184
listener = options;
1185-
options = nullObject;
1185+
options = kEmptyObject;
11861186
} else if (options == null || typeof options === 'object') {
1187-
options = options ?? nullObject;
1187+
options = options ?? kEmptyObject;
11881188
} else {
11891189
throw new ERR_INVALID_ARG_TYPE('options', 'Object', options);
11901190
}

lib/async_hooks.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const {
2020
ERR_ASYNC_TYPE,
2121
ERR_INVALID_ASYNC_ID
2222
} = require('internal/errors').codes;
23-
const { nullObject } = require('internal/util');
23+
const { kEmptyObject } = require('internal/util');
2424
const {
2525
validateFunction,
2626
validateString,
@@ -157,7 +157,7 @@ function createHook(fns) {
157157
const destroyedSymbol = Symbol('destroyed');
158158

159159
class AsyncResource {
160-
constructor(type, opts = nullObject) {
160+
constructor(type, opts = kEmptyObject) {
161161
validateString(type, 'type');
162162

163163
let triggerAsyncId = opts;

lib/child_process.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const {
4646
convertToValidSignal,
4747
createDeferredPromise,
4848
getSystemErrorName,
49-
nullObject,
49+
kEmptyObject,
5050
promisify,
5151
} = require('internal/util');
5252
const { isArrayBufferView } = require('internal/util/types');
@@ -509,7 +509,7 @@ function normalizeSpawnArguments(file, args, options) {
509509
}
510510

511511
if (options === undefined)
512-
options = nullObject;
512+
options = kEmptyObject;
513513
else
514514
validateObject(options, 'options');
515515

lib/events.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const {
5353
} = primordials;
5454
const kRejection = SymbolFor('nodejs.rejection');
5555

56-
const { nullObject } = require('internal/util');
56+
const { kEmptyObject } = require('internal/util');
5757

5858
const { inspect } = require('internal/util/inspect');
5959

@@ -941,7 +941,7 @@ function getEventListeners(emitterOrTarget, type) {
941941
* @param {{ signal: AbortSignal; }} [options]
942942
* @returns {Promise}
943943
*/
944-
async function once(emitter, name, options = nullObject) {
944+
async function once(emitter, name, options = kEmptyObject) {
945945
const signal = options?.signal;
946946
validateAbortSignal(signal, 'options.signal');
947947
if (signal?.aborted)

lib/fs.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ const { toPathIfFileURL } = require('internal/url');
8686
const {
8787
customPromisifyArgs,
8888
deprecate,
89-
nullObject,
89+
kEmptyObject,
9090
promisify,
9191
} = require('internal/util');
9292
const {
@@ -627,7 +627,7 @@ function read(fd, buffer, offsetOrOptions, length, position, callback) {
627627
if (!isArrayBufferView(buffer)) {
628628
// This is fs.read(fd, params, callback)
629629
params = buffer;
630-
({ buffer = Buffer.alloc(16384) } = params ?? nullObject);
630+
({ buffer = Buffer.alloc(16384) } = params ?? kEmptyObject);
631631
}
632632
callback = offsetOrOptions;
633633
} else {
@@ -640,7 +640,7 @@ function read(fd, buffer, offsetOrOptions, length, position, callback) {
640640
offset = 0,
641641
length = buffer.byteLength - offset,
642642
position = null,
643-
} = params ?? nullObject);
643+
} = params ?? kEmptyObject);
644644
}
645645

646646
validateBuffer(buffer);
@@ -705,7 +705,7 @@ function readSync(fd, buffer, offset, length, position) {
705705

706706
if (arguments.length <= 3) {
707707
// Assume fs.readSync(fd, buffer, options)
708-
const options = offset || nullObject;
708+
const options = offset || kEmptyObject;
709709

710710
({
711711
offset = 0,
@@ -833,7 +833,7 @@ function write(fd, buffer, offsetOrOptions, length, position, callback) {
833833
offset = 0,
834834
length = buffer.byteLength - offset,
835835
position = null,
836-
} = offsetOrOptions ?? nullObject);
836+
} = offsetOrOptions ?? kEmptyObject);
837837
}
838838

839839
if (offset == null || typeof offset === 'function') {
@@ -903,7 +903,7 @@ function writeSync(fd, buffer, offsetOrOptions, length, position) {
903903
offset = 0,
904904
length = buffer.byteLength - offset,
905905
position = null,
906-
} = offsetOrOptions ?? nullObject);
906+
} = offsetOrOptions ?? kEmptyObject);
907907
}
908908
if (position === undefined)
909909
position = null;
@@ -1461,7 +1461,7 @@ function readdirSync(path, options) {
14611461
function fstat(fd, options = { bigint: false }, callback) {
14621462
if (typeof options === 'function') {
14631463
callback = options;
1464-
options = nullObject;
1464+
options = kEmptyObject;
14651465
}
14661466
fd = getValidatedFd(fd);
14671467
callback = makeStatsCallback(callback);
@@ -1485,7 +1485,7 @@ function fstat(fd, options = { bigint: false }, callback) {
14851485
function lstat(path, options = { bigint: false }, callback) {
14861486
if (typeof options === 'function') {
14871487
callback = options;
1488-
options = nullObject;
1488+
options = kEmptyObject;
14891489
}
14901490
callback = makeStatsCallback(callback);
14911491
path = getValidatedPath(path);
@@ -1508,7 +1508,7 @@ function lstat(path, options = { bigint: false }, callback) {
15081508
function stat(path, options = { bigint: false }, callback) {
15091509
if (typeof options === 'function') {
15101510
callback = options;
1511-
options = nullObject;
1511+
options = kEmptyObject;
15121512
}
15131513
callback = makeStatsCallback(callback);
15141514
path = getValidatedPath(path);

lib/internal/blob.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const {
4444
const {
4545
createDeferredPromise,
4646
customInspectSymbol: kInspect,
47-
nullObject,
47+
kEmptyObject,
4848
} = require('internal/util');
4949
const { inspect } = require('internal/util/inspect');
5050

@@ -135,7 +135,7 @@ class Blob {
135135
* }} [options]
136136
* @constructs {Blob}
137137
*/
138-
constructor(sources = [], options = nullObject) {
138+
constructor(sources = [], options = kEmptyObject) {
139139
if (sources === null ||
140140
typeof sources[SymbolIterator] !== 'function' ||
141141
typeof sources === 'string') {

lib/internal/cluster/worker.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const {
77

88
const EventEmitter = require('events');
99

10-
const { nullObject } = require('internal/util');
10+
const { kEmptyObject } = require('internal/util');
1111

1212
module.exports = Worker;
1313

@@ -19,7 +19,7 @@ function Worker(options) {
1919
ReflectApply(EventEmitter, this, []);
2020

2121
if (options === null || typeof options !== 'object')
22-
options = nullObject;
22+
options = kEmptyObject;
2323

2424
this.exitedAfterDisconnect = undefined;
2525

lib/internal/crypto/keygen.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const {
4040

4141
const {
4242
customPromisifyArgs,
43-
nullObject,
43+
kEmptyObject,
4444
} = require('internal/util');
4545

4646
const {
@@ -121,7 +121,7 @@ function handleError(ret) {
121121
};
122122
}
123123

124-
function parseKeyEncoding(keyType, options = nullObject) {
124+
function parseKeyEncoding(keyType, options = kEmptyObject) {
125125
const { publicKeyEncoding, privateKeyEncoding } = options;
126126

127127
let publicFormat, publicType;

lib/internal/crypto/random.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const {
2727

2828
const {
2929
lazyDOMException,
30-
nullObject,
30+
kEmptyObject,
3131
} = require('internal/util');
3232

3333
const { Buffer, kMaxLength } = require('buffer');
@@ -400,7 +400,7 @@ function randomUUID(options) {
400400
validateObject(options, 'options');
401401
const {
402402
disableEntropyCache = false,
403-
} = options || nullObject;
403+
} = options || kEmptyObject;
404404

405405
validateBoolean(disableEntropyCache, 'options.disableEntropyCache');
406406

@@ -465,7 +465,7 @@ function generatePrime(size, options, callback) {
465465
validateInt32(size, 'size', 1);
466466
if (typeof options === 'function') {
467467
callback = options;
468-
options = nullObject;
468+
options = kEmptyObject;
469469
}
470470
validateFunction(callback, 'callback');
471471

@@ -483,7 +483,7 @@ function generatePrime(size, options, callback) {
483483
job.run();
484484
}
485485

486-
function generatePrimeSync(size, options = nullObject) {
486+
function generatePrimeSync(size, options = kEmptyObject) {
487487
validateInt32(size, 'size', 1);
488488

489489
const job = createRandomPrimeJob(kCryptoJobSync, size, options);
@@ -507,7 +507,7 @@ function unsignedBigIntToBuffer(bigint, name) {
507507
return Buffer.from(padded, 'hex');
508508
}
509509

510-
function checkPrime(candidate, options = nullObject, callback) {
510+
function checkPrime(candidate, options = kEmptyObject, callback) {
511511
if (typeof candidate === 'bigint')
512512
candidate = unsignedBigIntToBuffer(candidate, 'candidate');
513513
if (!isAnyArrayBuffer(candidate) && !isArrayBufferView(candidate)) {
@@ -525,7 +525,7 @@ function checkPrime(candidate, options = nullObject, callback) {
525525
}
526526
if (typeof options === 'function') {
527527
callback = options;
528-
options = nullObject;
528+
options = kEmptyObject;
529529
}
530530
validateFunction(callback, 'callback');
531531
validateObject(options, 'options');
@@ -540,7 +540,7 @@ function checkPrime(candidate, options = nullObject, callback) {
540540
job.run();
541541
}
542542

543-
function checkPrimeSync(candidate, options = nullObject) {
543+
function checkPrimeSync(candidate, options = kEmptyObject) {
544544
if (typeof candidate === 'bigint')
545545
candidate = unsignedBigIntToBuffer(candidate, 'candidate');
546546
if (!isAnyArrayBuffer(candidate) && !isArrayBufferView(candidate)) {

lib/internal/crypto/x509.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const {
2323

2424
const {
2525
customInspectSymbol: kInspect,
26-
nullObject,
26+
kEmptyObject,
2727
} = require('internal/util');
2828

2929
const {
@@ -65,7 +65,7 @@ function isX509Certificate(value) {
6565
return value[kInternalState] !== undefined;
6666
}
6767

68-
function getFlags(options = nullObject) {
68+
function getFlags(options = kEmptyObject) {
6969
validateObject(options, 'options');
7070
const {
7171
subject = 'default', // Can be 'default', 'always', or 'never'

lib/internal/encoding.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const {
3232
getConstructorOf,
3333
customInspectSymbol: inspect,
3434
kEnumerableProperty,
35-
nullObject,
35+
kEmptyObject,
3636
} = require('internal/util');
3737

3838
const {
@@ -378,7 +378,7 @@ function makeTextDecoderICU() {
378378
} = internalBinding('icu');
379379

380380
class TextDecoder {
381-
constructor(encoding = 'utf-8', options = nullObject) {
381+
constructor(encoding = 'utf-8', options = kEmptyObject) {
382382
encoding = `${encoding}`;
383383
validateObject(options, 'options', {
384384
nullable: true,
@@ -407,7 +407,7 @@ function makeTextDecoderICU() {
407407
}
408408

409409

410-
decode(input = empty, options = nullObject) {
410+
decode(input = empty, options = kEmptyObject) {
411411
validateDecoder(this);
412412
if (isAnyArrayBuffer(input)) {
413413
input = lazyBuffer().from(input);
@@ -452,7 +452,7 @@ function makeTextDecoderJS() {
452452
}
453453

454454
class TextDecoder {
455-
constructor(encoding = 'utf-8', options = nullObject) {
455+
constructor(encoding = 'utf-8', options = kEmptyObject) {
456456
encoding = `${encoding}`;
457457
validateObject(options, 'options', {
458458
nullable: true,
@@ -480,7 +480,7 @@ function makeTextDecoderJS() {
480480
this[kBOMSeen] = false;
481481
}
482482

483-
decode(input = empty, options = nullObject) {
483+
decode(input = empty, options = kEmptyObject) {
484484
validateDecoder(this);
485485
if (isAnyArrayBuffer(input)) {
486486
input = lazyBuffer().from(input);

lib/internal/event_target.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const { validateObject, validateString } = require('internal/validators');
3838
const {
3939
customInspectSymbol,
4040
kEnumerableProperty,
41-
nullObject,
41+
kEmptyObject,
4242
} = require('internal/util');
4343
const { inspect } = require('util');
4444

@@ -455,7 +455,7 @@ class EventTarget {
455455
* signal?: AbortSignal
456456
* }} [options]
457457
*/
458-
addEventListener(type, listener, options = nullObject) {
458+
addEventListener(type, listener, options = kEmptyObject) {
459459
if (!isEventTarget(this))
460460
throw new ERR_INVALID_THIS('EventTarget');
461461
if (arguments.length < 2)
@@ -542,7 +542,7 @@ class EventTarget {
542542
* capture?: boolean,
543543
* }} [options]
544544
*/
545-
removeEventListener(type, listener, options = nullObject) {
545+
removeEventListener(type, listener, options = kEmptyObject) {
546546
if (!isEventTarget(this))
547547
throw new ERR_INVALID_THIS('EventTarget');
548548
if (!shouldAddListener(listener))
@@ -870,7 +870,7 @@ function validateEventListenerOptions(options) {
870870
return { capture: options };
871871

872872
if (options === null)
873-
return nullObject;
873+
return kEmptyObject;
874874
validateObject(options, 'options', {
875875
allowArray: true, allowFunction: true,
876876
});

0 commit comments

Comments
 (0)