Skip to content

Commit d1702f5

Browse files
Sebastien-Ahkrintargos
authored andcommitted
lib: update Symbol.toStringTag by SymbolToStringTag primordial
PR-URL: #30908 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent d4ea392 commit d1702f5

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

lib/internal/encoding.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const {
88
ObjectDefineProperties,
99
ObjectGetOwnPropertyDescriptors,
1010
Symbol,
11+
SymbolToStringTag,
1112
} = primordials;
1213

1314
const {
@@ -358,7 +359,7 @@ ObjectDefineProperties(
358359
'encode': { enumerable: true },
359360
'encodeInto': { enumerable: true },
360361
'encoding': { enumerable: true },
361-
[Symbol.toStringTag]: {
362+
[SymbolToStringTag]: {
362363
configurable: true,
363364
value: 'TextEncoder'
364365
} });
@@ -554,7 +555,7 @@ function makeTextDecoderJS() {
554555
ObjectDefineProperties(TextDecoder.prototype, {
555556
decode: { enumerable: true },
556557
[inspect]: { enumerable: false },
557-
[Symbol.toStringTag]: {
558+
[SymbolToStringTag]: {
558559
configurable: true,
559560
value: 'TextDecoder'
560561
}

lib/internal/url.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const {
1313
ReflectOwnKeys,
1414
Symbol,
1515
SymbolIterator,
16+
SymbolToStringTag,
1617
} = primordials;
1718

1819
const { inspect } = require('internal/util/inspect');
@@ -431,7 +432,7 @@ ObjectDefineProperties(URL.prototype, {
431432
return ret;
432433
}
433434
},
434-
[Symbol.toStringTag]: {
435+
[SymbolToStringTag]: {
435436
configurable: true,
436437
value: 'URL'
437438
},
@@ -859,7 +860,7 @@ function serializeParams(array) {
859860
// Mainly to mitigate func-name-matching ESLint rule
860861
function defineIDLClass(proto, classStr, obj) {
861862
// https://heycam.github.io/webidl/#dfn-class-string
862-
ObjectDefineProperty(proto, Symbol.toStringTag, {
863+
ObjectDefineProperty(proto, SymbolToStringTag, {
863864
writable: false,
864865
enumerable: false,
865866
configurable: true,
@@ -1244,7 +1245,7 @@ defineIDLClass(URLSearchParamsIteratorPrototype, 'URLSearchParams Iterator', {
12441245
} else {
12451246
outputStr = ` ${outputStrs.join(', ')}`;
12461247
}
1247-
return `${this[Symbol.toStringTag]} {${outputStr} }`;
1248+
return `${this[SymbolToStringTag]} {${outputStr} }`;
12481249
}
12491250
});
12501251

0 commit comments

Comments
 (0)