Skip to content

Commit 54aa3b9

Browse files
Sebastien-Ahkrintargos
authored andcommitted
lib: replace every Symbol.for by SymbolFor primordials
PR-URL: #30857 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
1 parent c6535c0 commit 54aa3b9

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

lib/internal/errors.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const {
1717
ObjectDefineProperty,
1818
ObjectKeys,
1919
Symbol,
20+
SymbolFor,
2021
} = primordials;
2122

2223
const messages = new Map();
@@ -207,7 +208,7 @@ class SystemError extends Error {
207208
return `${this.name} [${this.code}]: ${this.message}`;
208209
}
209210

210-
[Symbol.for('nodejs.util.inspect.custom')](recurseTimes, ctx) {
211+
[SymbolFor('nodejs.util.inspect.custom')](recurseTimes, ctx) {
211212
return lazyInternalUtilInspect().inspect(this, {
212213
...ctx,
213214
getters: true,

lib/internal/util.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const {
1212
ObjectSetPrototypeOf,
1313
ReflectConstruct,
1414
Symbol,
15+
SymbolFor,
1516
} = primordials;
1617

1718
const {
@@ -425,7 +426,7 @@ module.exports = {
425426

426427
// Symbol used to provide a custom inspect function for an object as an
427428
// alternative to using 'inspect'
428-
customInspectSymbol: Symbol.for('nodejs.util.inspect.custom'),
429+
customInspectSymbol: SymbolFor('nodejs.util.inspect.custom'),
429430

430431
// Used by the buffer module to capture an internal reference to the
431432
// default isEncoding implementation, just in case userland overrides it.

lib/internal/worker.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const {
88
ObjectCreate,
99
ObjectEntries,
1010
Symbol,
11+
SymbolFor,
1112
} = primordials;
1213

1314
const EventEmitter = require('events');
@@ -62,7 +63,7 @@ const kOnCouldNotSerializeErr = Symbol('kOnCouldNotSerializeErr');
6263
const kOnErrorMessage = Symbol('kOnErrorMessage');
6364
const kParentSideStdio = Symbol('kParentSideStdio');
6465

65-
const SHARE_ENV = Symbol.for('nodejs.worker_threads.SHARE_ENV');
66+
const SHARE_ENV = SymbolFor('nodejs.worker_threads.SHARE_ENV');
6667
const debug = require('internal/util/debuglog').debuglog('worker');
6768

6869
let cwdCounter;

0 commit comments

Comments
 (0)