Skip to content

Commit 023c555

Browse files
committed
Simplify #1297
1 parent 9925e50 commit 023c555

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/jsutils/applyToStringTag.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,16 @@
1616
*
1717
* @method applyToStringTag
1818
*
19-
* @param {Class<*>} classObject a class such as Object, String, Number but
19+
* @param {Class<any>} classObject a class such as Object, String, Number but
2020
* typically one of your own creation through the class keyword; `class A {}`,
2121
* for example.
2222
*/
23-
export function applyToStringTag(classObject: Class<*>): void {
24-
const symbolType: string = typeof Symbol;
25-
const toStringTagType: string = typeof Symbol.toStringTag;
26-
27-
if (symbolType === 'function' && toStringTagType === 'symbol') {
23+
export default function applyToStringTag(classObject: Class<any>): void {
24+
if (typeof Symbol === 'function' && Symbol.toStringTag) {
2825
Object.defineProperty(classObject.prototype, Symbol.toStringTag, {
2926
get() {
3027
return this.constructor.name;
3128
},
3229
});
3330
}
3431
}
35-
36-
/** Support both default export and named `applyToStringTag` export */
37-
export default applyToStringTag;

0 commit comments

Comments
 (0)