Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: update Symbol.toStringTag by SymbolToStringTag primordial #30908

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/internal/encoding.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const {
ObjectDefineProperties,
ObjectGetOwnPropertyDescriptors,
Symbol,
SymbolToStringTag,
} = primordials;

const {
Expand Down Expand Up @@ -358,7 +359,7 @@ ObjectDefineProperties(
'encode': { enumerable: true },
'encodeInto': { enumerable: true },
'encoding': { enumerable: true },
[Symbol.toStringTag]: {
[SymbolToStringTag]: {
configurable: true,
value: 'TextEncoder'
} });
Expand Down Expand Up @@ -554,7 +555,7 @@ function makeTextDecoderJS() {
ObjectDefineProperties(TextDecoder.prototype, {
decode: { enumerable: true },
[inspect]: { enumerable: false },
[Symbol.toStringTag]: {
[SymbolToStringTag]: {
configurable: true,
value: 'TextDecoder'
}
Expand Down
7 changes: 4 additions & 3 deletions lib/internal/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const {
ReflectOwnKeys,
Symbol,
SymbolIterator,
SymbolToStringTag,
} = primordials;

const { inspect } = require('internal/util/inspect');
Expand Down Expand Up @@ -431,7 +432,7 @@ ObjectDefineProperties(URL.prototype, {
return ret;
}
},
[Symbol.toStringTag]: {
[SymbolToStringTag]: {
configurable: true,
value: 'URL'
},
Expand Down Expand Up @@ -859,7 +860,7 @@ function serializeParams(array) {
// Mainly to mitigate func-name-matching ESLint rule
function defineIDLClass(proto, classStr, obj) {
// https://heycam.github.io/webidl/#dfn-class-string
ObjectDefineProperty(proto, Symbol.toStringTag, {
ObjectDefineProperty(proto, SymbolToStringTag, {
writable: false,
enumerable: false,
configurable: true,
Expand Down Expand Up @@ -1244,7 +1245,7 @@ defineIDLClass(URLSearchParamsIteratorPrototype, 'URLSearchParams Iterator', {
} else {
outputStr = ` ${outputStrs.join(', ')}`;
}
return `${this[Symbol.toStringTag]} {${outputStr} }`;
return `${this[SymbolToStringTag]} {${outputStr} }`;
}
});

Expand Down
4 changes: 2 additions & 2 deletions lib/internal/util/comparisons.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ const {
ObjectPrototypePropertyIsEnumerable,
ObjectPrototypeToString,
StringPrototypeValueOf,
Symbol,
SymbolPrototypeValueOf,
SymbolToStringTag,
} = primordials;

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

function isIdenticalTypedArrayType(a, b) {
// Fast path to reduce type checks in the common case.
const check = types[`is${a[Symbol.toStringTag]}`];
const check = types[`is${a[SymbolToStringTag]}`];
if (check !== undefined && check(a)) {
return check(b);
}
Expand Down