Skip to content

Commit

Permalink
Polyfill: Use original Map objects
Browse files Browse the repository at this point in the history
  • Loading branch information
ptomato committed Aug 22, 2023
1 parent ca7288c commit 3ca02f1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions polyfill/lib/ecmascript.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ const ArrayPrototypeSort = Array.prototype.sort;
const ArrayPrototypeFind = Array.prototype.find;
const IntlDateTimeFormat = globalThis.Intl.DateTimeFormat;
const IntlSupportedValuesOf = globalThis.Intl.supportedValuesOf;
const MapCtor = Map;
const MapPrototypeSet = Map.prototype.set;
const MathAbs = Math.abs;
const MathFloor = Math.floor;
const MathMax = Math.max;
Expand Down Expand Up @@ -2702,10 +2704,10 @@ export function GetAvailableNamedTimeZoneIdentifier(identifier) {
if (canonicalTimeZoneIdsCache === undefined) {
const canonicalTimeZoneIds = IntlSupportedValuesOf?.('timeZone');
if (canonicalTimeZoneIds) {
canonicalTimeZoneIdsCache = new Map();
canonicalTimeZoneIdsCache = new MapCtor();
for (let ix = 0; ix < canonicalTimeZoneIds.length; ix++) {
const id = canonicalTimeZoneIds[ix];
canonicalTimeZoneIdsCache.set(ASCIILowercase(id), id);
Call(MapPrototypeSet, canonicalTimeZoneIdsCache, [ASCIILowercase(id), id]);
}
} else {
canonicalTimeZoneIdsCache = null;
Expand Down

0 comments on commit 3ca02f1

Please sign in to comment.