Skip to content

Commit 0d2172f

Browse files
Sebastien-AhkrinMylesBorins
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 8dec909 commit 0d2172f

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
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

lib/internal/util/comparisons.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ const {
1515
ObjectPrototypePropertyIsEnumerable,
1616
ObjectPrototypeToString,
1717
StringPrototypeValueOf,
18-
Symbol,
1918
SymbolPrototypeValueOf,
19+
SymbolToStringTag,
2020
} = primordials;
2121

2222
const { compare } = internalBinding('buffer');
@@ -120,7 +120,7 @@ function isEqualBoxedPrimitive(val1, val2) {
120120

121121
function isIdenticalTypedArrayType(a, b) {
122122
// Fast path to reduce type checks in the common case.
123-
const check = types[`is${a[Symbol.toStringTag]}`];
123+
const check = types[`is${a[SymbolToStringTag]}`];
124124
if (check !== undefined && check(a)) {
125125
return check(b);
126126
}

0 commit comments

Comments
 (0)