diff --git a/lib/internal/errors.js b/lib/internal/errors.js index 04443faeebf8ff..c94bbb7a9bf413 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -17,6 +17,7 @@ const { ObjectDefineProperty, ObjectKeys, Symbol, + SymbolFor, } = primordials; const messages = new Map(); @@ -207,7 +208,7 @@ class SystemError extends Error { return `${this.name} [${this.code}]: ${this.message}`; } - [Symbol.for('nodejs.util.inspect.custom')](recurseTimes, ctx) { + [SymbolFor('nodejs.util.inspect.custom')](recurseTimes, ctx) { return lazyInternalUtilInspect().inspect(this, { ...ctx, getters: true, diff --git a/lib/internal/util.js b/lib/internal/util.js index 526d2504eaf462..f80c9212304a03 100644 --- a/lib/internal/util.js +++ b/lib/internal/util.js @@ -12,6 +12,7 @@ const { ObjectSetPrototypeOf, ReflectConstruct, Symbol, + SymbolFor, } = primordials; const { @@ -425,7 +426,7 @@ module.exports = { // Symbol used to provide a custom inspect function for an object as an // alternative to using 'inspect' - customInspectSymbol: Symbol.for('nodejs.util.inspect.custom'), + customInspectSymbol: SymbolFor('nodejs.util.inspect.custom'), // Used by the buffer module to capture an internal reference to the // default isEncoding implementation, just in case userland overrides it. diff --git a/lib/internal/worker.js b/lib/internal/worker.js index a1c70b74fcebf1..d4ac7f8c5d506b 100644 --- a/lib/internal/worker.js +++ b/lib/internal/worker.js @@ -8,6 +8,7 @@ const { ObjectCreate, ObjectEntries, Symbol, + SymbolFor, } = primordials; const EventEmitter = require('events'); @@ -62,7 +63,7 @@ const kOnCouldNotSerializeErr = Symbol('kOnCouldNotSerializeErr'); const kOnErrorMessage = Symbol('kOnErrorMessage'); const kParentSideStdio = Symbol('kParentSideStdio'); -const SHARE_ENV = Symbol.for('nodejs.worker_threads.SHARE_ENV'); +const SHARE_ENV = SymbolFor('nodejs.worker_threads.SHARE_ENV'); const debug = require('internal/util/debuglog').debuglog('worker'); let cwdCounter;