From d22098658cfbc9366c57201a9bb848fc4b5da36e Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Wed, 21 Dec 2022 11:20:33 -0800 Subject: [PATCH] [Refactor] use `es-set-tostringtag` --- package.json | 1 + shim.js | 11 ++--------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index a77c53a..706e1df 100644 --- a/package.json +++ b/package.json @@ -73,6 +73,7 @@ "call-bind": "^1.0.2", "define-properties": "^1.1.4", "es-abstract": "^1.20.5", + "es-set-tostringtag": "^2.0.0", "globalthis": "^1.0.3" }, "auto-changelog": { diff --git a/shim.js b/shim.js index 76063bf..2699b98 100644 --- a/shim.js +++ b/shim.js @@ -1,22 +1,15 @@ 'use strict'; var CreateMethodProperty = require('es-abstract/2022/CreateMethodProperty'); -var DefinePropertyOrThrow = require('es-abstract/2022/DefinePropertyOrThrow'); var globalThis = require('globalthis')(); +var setToStringTag = require('es-set-tostringtag'); var getPolyfill = require('./polyfill'); module.exports = function shimReflectApply() { if (typeof Reflect === 'undefined') { var R = {}; - if (typeof Symbol === 'function' && Symbol.toStringTag) { - DefinePropertyOrThrow(R, Symbol.toStringTag, { - '[[Configurable]]': true, - '[[Enumerable]]': false, - '[[Value]]': 'Reflect', - '[[Writable]]': false - }); - } + setToStringTag(R, 'Reflect'); CreateMethodProperty(globalThis, 'Reflect', R); }