Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 54aa3b9

Browse filesBrowse files
Sebastien-Ahkrintargos
authored andcommitted
lib: replace every Symbol.for by SymbolFor primordials
PR-URL: #30857 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
1 parent c6535c0 commit 54aa3b9
Copy full SHA for 54aa3b9

File tree

Expand file treeCollapse file tree

3 files changed

+6
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+6
-3
lines changed
Open diff view settings
Collapse file

‎lib/internal/errors.js‎

Copy file name to clipboardExpand all lines: lib/internal/errors.js
+2-1Lines changed: 2 additions & 1 deletion
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,
Collapse file

‎lib/internal/util.js‎

Copy file name to clipboardExpand all lines: lib/internal/util.js
+2-1Lines changed: 2 additions & 1 deletion
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.
Collapse file

‎lib/internal/worker.js‎

Copy file name to clipboardExpand all lines: lib/internal/worker.js
+2-1Lines changed: 2 additions & 1 deletion
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.