From 06ddf5363178a6a0e178af5cc29d0da615af99c4 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Wed, 21 Dec 2022 10:04:29 -0800 Subject: [PATCH] [Refactor] use `es-set-tostringtag` --- lib/map-iterator.js | 12 ++---------- package.json | 1 + 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/lib/map-iterator.js b/lib/map-iterator.js index 36da6b4..3d9ebda 100644 --- a/lib/map-iterator.js +++ b/lib/map-iterator.js @@ -1,12 +1,11 @@ 'use strict'; -var hasSymbols = require('has-symbols')(); var SLOT = require('internal-slot'); +var setToStringTag = require('es-set-tostringtag'); var GetIntrinsic = require('get-intrinsic'); var CreateIterResultObject = require('es-abstract/2022/CreateIterResultObject'); var CreateMethodProperty = require('es-abstract/2022/CreateMethodProperty'); -var DefinePropertyOrThrow = require('es-abstract/2022/DefinePropertyOrThrow'); var OrdinaryObjectCreate = require('es-abstract/2022/OrdinaryObjectCreate'); var requireMapSlot = require('./validation').requireMapSlot; @@ -69,13 +68,6 @@ CreateMethodProperty( } ); -if (hasSymbols && Symbol.toStringTag) { - DefinePropertyOrThrow(MapIterator.prototype, Symbol.toStringTag, { - '[[Configurable]]': true, - '[[Enumerable]]': false, - '[[Value]]': 'Map Iterator', - '[[Writable]]': false - }); -} +setToStringTag(MapIterator.prototype, 'Map Iterator'); module.exports = MapIterator; diff --git a/package.json b/package.json index face1d9..b196387 100644 --- a/package.json +++ b/package.json @@ -74,6 +74,7 @@ "define-properties": "^1.1.4", "es-abstract": "^1.20.5", "es-get-iterator": "^1.1.2", + "es-set-tostringtag": "^1.0.0", "for-each": "^0.3.3", "get-intrinsic": "^1.1.3", "globalthis": "^1.0.3",