diff --git a/lib/_http_server.js b/lib/_http_server.js index 192d0ddfb7a410..d01a48cb80bae1 100644 --- a/lib/_http_server.js +++ b/lib/_http_server.js @@ -25,6 +25,7 @@ const { ObjectKeys, ObjectSetPrototypeOf, Symbol, + SymbolFor, } = primordials; const net = require('net'); @@ -377,7 +378,7 @@ Server.prototype[EE.captureRejectionSymbol] = function( } break; default: - net.Server.prototype[Symbol.for('nodejs.rejection')] + net.Server.prototype[SymbolFor('nodejs.rejection')] .call(this, err, event, ...args); } }; diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index 2a534694566bfa..5d7a5c8e281047 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -26,6 +26,7 @@ const { ObjectDefineProperty, ObjectSetPrototypeOf, Symbol, + SymbolFor, } = primordials; const { @@ -1294,7 +1295,7 @@ Server.prototype[EE.captureRejectionSymbol] = function( sock.destroy(err); break; default: - net.Server.prototype[Symbol.for('nodejs.rejection')] + net.Server.prototype[SymbolFor('nodejs.rejection')] .call(this, err, event, sock); } }; diff --git a/lib/events.js b/lib/events.js index 203a20ed8057cd..c72d76faab8bd2 100644 --- a/lib/events.js +++ b/lib/events.js @@ -33,8 +33,9 @@ const { ReflectApply, ReflectOwnKeys, Symbol, + SymbolFor, } = primordials; -const kRejection = Symbol.for('nodejs.rejection'); +const kRejection = SymbolFor('nodejs.rejection'); let spliceOne; diff --git a/lib/internal/errors.js b/lib/internal/errors.js index f76fe328c214bb..ad12d99c7cc49c 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(); @@ -199,7 +200,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 6051a021785dde..6cdd6cba0b18bc 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;