Skip to content

Commit

Permalink
lib: update Symbol.toStringTag by SymbolToStringTag primordial
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Sebastien-Ahkrin authored and MylesBorins committed Dec 17, 2019
1 parent 8dec909 commit 0d2172f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
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

0 comments on commit 0d2172f

Please sign in to comment.