summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Ahkrin <sebastien48criquet@gmail.com>2019-12-08 18:33:33 +0100
committerBeth Griggs <Bethany.Griggs@uk.ibm.com>2020-02-06 02:49:22 +0000
commit993c419ce761230e4404536e457618cc45971acc (patch)
treeb2627f51147fd2e092b4ffce7175f2f7926a84e5
parentb95c50b3928bdde49707d9d80e6184a8e4190104 (diff)
downloadnode-new-993c419ce761230e4404536e457618cc45971acc.tar.gz
lib: replace every Symbol.for by SymbolFor primordials
PR-URL: https://github.com/nodejs/node/pull/30857 Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
-rw-r--r--lib/internal/errors.js3
-rw-r--r--lib/internal/util.js3
-rw-r--r--lib/internal/worker.js3
3 files changed, 6 insertions, 3 deletions
diff --git a/lib/internal/errors.js b/lib/internal/errors.js
index 04443faeeb..c94bbb7a9b 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 526d2504ea..f80c921230 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 a1c70b74fc..d4ac7f8c5d 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;