@formatjs/intl-enumerator 1.4.7 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,9 @@
1
+ import { createMemoizedDateTimeFormat } from '@formatjs/ecma402-abstract';
1
2
  import { calendars } from './calendars.generated';
2
3
  function isSupportedCalendar(item, locale) {
3
4
  if (locale === void 0) { locale = 'en'; }
4
5
  try {
5
- var dateTimeFormat = new Intl.DateTimeFormat("".concat(locale, "-u-ca-").concat(item));
6
+ var dateTimeFormat = createMemoizedDateTimeFormat("".concat(locale, "-u-ca-").concat(item));
6
7
  var options = dateTimeFormat.resolvedOptions().calendar;
7
8
  if (item !== 'gregory' || options !== 'gregory')
8
9
  return true;
@@ -1,8 +1,9 @@
1
+ import { createMemoizedNumberFormat } from '@formatjs/ecma402-abstract';
1
2
  import { currencies } from './currencies.generated';
2
3
  function isSupportedCurrency(currency, locale) {
3
4
  if (locale === void 0) { locale = 'en'; }
4
5
  try {
5
- var numberFormat = new Intl.NumberFormat(locale, {
6
+ var numberFormat = createMemoizedNumberFormat(locale, {
6
7
  style: 'currency',
7
8
  currencyDisplay: 'name',
8
9
  currency: currency,
@@ -1,8 +1,9 @@
1
+ import { createMemoizedNumberFormat } from '@formatjs/ecma402-abstract';
1
2
  import { numberingSystemNames } from './numbering-systems.generated';
2
3
  function isSupportedNumberingSystem(system, locale) {
3
4
  if (locale === void 0) { locale = 'en'; }
4
5
  try {
5
- var numberFormat = new Intl.NumberFormat("".concat(locale, "-u-nu-").concat(system));
6
+ var numberFormat = createMemoizedNumberFormat("".concat(locale, "-u-nu-").concat(system));
6
7
  var options = numberFormat.resolvedOptions().numberingSystem;
7
8
  if ((options === system && system === 'latn') ||
8
9
  numberFormat.format(123) !== '123') {
@@ -1,8 +1,9 @@
1
+ import { createMemoizedDateTimeFormat } from '@formatjs/ecma402-abstract';
1
2
  import { timezones } from './timezones.generated';
2
3
  function isSupported(timeZone, locale) {
3
4
  if (locale === void 0) { locale = 'en'; }
4
5
  try {
5
- var formatter = new Intl.DateTimeFormat(locale, { timeZone: timeZone });
6
+ var formatter = createMemoizedDateTimeFormat(locale, { timeZone: timeZone });
6
7
  return formatter.resolvedOptions().timeZone === timeZone;
7
8
  }
8
9
  catch (_err) { }
@@ -1,8 +1,9 @@
1
+ import { createMemoizedNumberFormat } from '@formatjs/ecma402-abstract';
1
2
  import { units } from './units.generated';
2
3
  function isSupported(unit, locale) {
3
4
  if (locale === void 0) { locale = 'en'; }
4
5
  try {
5
- var formatter = new Intl.NumberFormat(locale, { style: 'unit', unit: unit });
6
+ var formatter = createMemoizedNumberFormat(locale, { style: 'unit', unit: unit });
6
7
  return formatter.resolvedOptions().unit === unit;
7
8
  }
8
9
  catch (_err) { }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formatjs/intl-enumerator",
3
- "version": "1.4.7",
3
+ "version": "1.5.0",
4
4
  "description": "Intl.Enumerator polyfill",
5
5
  "keywords": [
6
6
  "intl",
@@ -24,9 +24,7 @@
24
24
  "url": "https://github.com/formatjs/formatjs/issues"
25
25
  },
26
26
  "dependencies": {
27
- "tslib": "^2.4.0"
28
- },
29
- "devDependencies": {
30
- "@formatjs/ecma402-abstract": "2.0.0"
27
+ "tslib": "^2.4.0",
28
+ "@formatjs/ecma402-abstract": "2.1.0"
31
29
  }
32
30
  }
package/polyfill.iife.js CHANGED
@@ -4,6 +4,244 @@
4
4
  return !("supportedValuesOf" in Intl);
5
5
  }
6
6
 
7
+ // ../../../../../../../../execroot/formatjs/bazel-out/darwin_arm64-fastbuild/bin/node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/lib/262.js
8
+ var MINUTES_PER_HOUR = 60;
9
+ var SECONDS_PER_MINUTE = 60;
10
+ var MS_PER_SECOND = 1e3;
11
+ var MS_PER_MINUTE = MS_PER_SECOND * SECONDS_PER_MINUTE;
12
+ var MS_PER_HOUR = MS_PER_MINUTE * MINUTES_PER_HOUR;
13
+
14
+ // ../../../../../../../../execroot/formatjs/bazel-out/darwin_arm64-fastbuild/bin/node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/lib/IsSanctionedSimpleUnitIdentifier.js
15
+ var SANCTIONED_UNITS = [
16
+ "angle-degree",
17
+ "area-acre",
18
+ "area-hectare",
19
+ "concentr-percent",
20
+ "digital-bit",
21
+ "digital-byte",
22
+ "digital-gigabit",
23
+ "digital-gigabyte",
24
+ "digital-kilobit",
25
+ "digital-kilobyte",
26
+ "digital-megabit",
27
+ "digital-megabyte",
28
+ "digital-petabyte",
29
+ "digital-terabit",
30
+ "digital-terabyte",
31
+ "duration-day",
32
+ "duration-hour",
33
+ "duration-millisecond",
34
+ "duration-minute",
35
+ "duration-month",
36
+ "duration-second",
37
+ "duration-week",
38
+ "duration-year",
39
+ "length-centimeter",
40
+ "length-foot",
41
+ "length-inch",
42
+ "length-kilometer",
43
+ "length-meter",
44
+ "length-mile-scandinavian",
45
+ "length-mile",
46
+ "length-millimeter",
47
+ "length-yard",
48
+ "mass-gram",
49
+ "mass-kilogram",
50
+ "mass-ounce",
51
+ "mass-pound",
52
+ "mass-stone",
53
+ "temperature-celsius",
54
+ "temperature-fahrenheit",
55
+ "volume-fluid-ounce",
56
+ "volume-gallon",
57
+ "volume-liter",
58
+ "volume-milliliter"
59
+ ];
60
+ function removeUnitNamespace(unit) {
61
+ return unit.slice(unit.indexOf("-") + 1);
62
+ }
63
+ var SIMPLE_UNITS = SANCTIONED_UNITS.map(removeUnitNamespace);
64
+
65
+ // ../../../../../../../../execroot/formatjs/bazel-out/darwin_arm64-fastbuild/bin/node_modules/.aspect_rules_js/tslib@2.4.0/node_modules/tslib/tslib.es6.js
66
+ var extendStatics = function(d, b) {
67
+ extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
68
+ d2.__proto__ = b2;
69
+ } || function(d2, b2) {
70
+ for (var p in b2)
71
+ if (Object.prototype.hasOwnProperty.call(b2, p))
72
+ d2[p] = b2[p];
73
+ };
74
+ return extendStatics(d, b);
75
+ };
76
+ function __extends(d, b) {
77
+ if (typeof b !== "function" && b !== null)
78
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
79
+ extendStatics(d, b);
80
+ function __() {
81
+ this.constructor = d;
82
+ }
83
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
84
+ }
85
+ function __spreadArray(to, from, pack) {
86
+ if (pack || arguments.length === 2)
87
+ for (var i = 0, l = from.length, ar; i < l; i++) {
88
+ if (ar || !(i in from)) {
89
+ if (!ar)
90
+ ar = Array.prototype.slice.call(from, 0, i);
91
+ ar[i] = from[i];
92
+ }
93
+ }
94
+ return to.concat(ar || Array.prototype.slice.call(from));
95
+ }
96
+
97
+ // ../../../../../../../../execroot/formatjs/bazel-out/darwin_arm64-fastbuild/bin/node_modules/.aspect_rules_js/@formatjs+fast-memoize@0.0.0/node_modules/@formatjs/fast-memoize/lib/index.js
98
+ function memoize(fn, options) {
99
+ var cache = options && options.cache ? options.cache : cacheDefault;
100
+ var serializer = options && options.serializer ? options.serializer : serializerDefault;
101
+ var strategy = options && options.strategy ? options.strategy : strategyDefault;
102
+ return strategy(fn, {
103
+ cache,
104
+ serializer
105
+ });
106
+ }
107
+ function isPrimitive(value) {
108
+ return value == null || typeof value === "number" || typeof value === "boolean";
109
+ }
110
+ function monadic(fn, cache, serializer, arg) {
111
+ var cacheKey = isPrimitive(arg) ? arg : serializer(arg);
112
+ var computedValue = cache.get(cacheKey);
113
+ if (typeof computedValue === "undefined") {
114
+ computedValue = fn.call(this, arg);
115
+ cache.set(cacheKey, computedValue);
116
+ }
117
+ return computedValue;
118
+ }
119
+ function variadic(fn, cache, serializer) {
120
+ var args = Array.prototype.slice.call(arguments, 3);
121
+ var cacheKey = serializer(args);
122
+ var computedValue = cache.get(cacheKey);
123
+ if (typeof computedValue === "undefined") {
124
+ computedValue = fn.apply(this, args);
125
+ cache.set(cacheKey, computedValue);
126
+ }
127
+ return computedValue;
128
+ }
129
+ function assemble(fn, context, strategy, cache, serialize) {
130
+ return strategy.bind(context, fn, cache, serialize);
131
+ }
132
+ function strategyDefault(fn, options) {
133
+ var strategy = fn.length === 1 ? monadic : variadic;
134
+ return assemble(fn, this, strategy, options.cache.create(), options.serializer);
135
+ }
136
+ function strategyVariadic(fn, options) {
137
+ return assemble(fn, this, variadic, options.cache.create(), options.serializer);
138
+ }
139
+ function strategyMonadic(fn, options) {
140
+ return assemble(fn, this, monadic, options.cache.create(), options.serializer);
141
+ }
142
+ var serializerDefault = function() {
143
+ return JSON.stringify(arguments);
144
+ };
145
+ function ObjectWithoutPrototypeCache() {
146
+ this.cache = /* @__PURE__ */ Object.create(null);
147
+ }
148
+ ObjectWithoutPrototypeCache.prototype.get = function(key) {
149
+ return this.cache[key];
150
+ };
151
+ ObjectWithoutPrototypeCache.prototype.set = function(key, value) {
152
+ this.cache[key] = value;
153
+ };
154
+ var cacheDefault = {
155
+ create: function create() {
156
+ return new ObjectWithoutPrototypeCache();
157
+ }
158
+ };
159
+ var strategies = {
160
+ variadic: strategyVariadic,
161
+ monadic: strategyMonadic
162
+ };
163
+
164
+ // ../../../../../../../../execroot/formatjs/bazel-out/darwin_arm64-fastbuild/bin/node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/lib/utils.js
165
+ var createMemoizedNumberFormat = memoize(function() {
166
+ var _a;
167
+ var args = [];
168
+ for (var _i = 0; _i < arguments.length; _i++) {
169
+ args[_i] = arguments[_i];
170
+ }
171
+ return new ((_a = Intl.NumberFormat).bind.apply(_a, __spreadArray([void 0], args, false)))();
172
+ }, {
173
+ strategy: strategies.variadic
174
+ });
175
+ var createMemoizedDateTimeFormat = memoize(function() {
176
+ var _a;
177
+ var args = [];
178
+ for (var _i = 0; _i < arguments.length; _i++) {
179
+ args[_i] = arguments[_i];
180
+ }
181
+ return new ((_a = Intl.DateTimeFormat).bind.apply(_a, __spreadArray([void 0], args, false)))();
182
+ }, {
183
+ strategy: strategies.variadic
184
+ });
185
+ var createMemoizedPluralRules = memoize(function() {
186
+ var _a;
187
+ var args = [];
188
+ for (var _i = 0; _i < arguments.length; _i++) {
189
+ args[_i] = arguments[_i];
190
+ }
191
+ return new ((_a = Intl.PluralRules).bind.apply(_a, __spreadArray([void 0], args, false)))();
192
+ }, {
193
+ strategy: strategies.variadic
194
+ });
195
+ var createMemoizedLocale = memoize(function() {
196
+ var _a;
197
+ var args = [];
198
+ for (var _i = 0; _i < arguments.length; _i++) {
199
+ args[_i] = arguments[_i];
200
+ }
201
+ return new ((_a = Intl.Locale).bind.apply(_a, __spreadArray([void 0], args, false)))();
202
+ }, {
203
+ strategy: strategies.variadic
204
+ });
205
+ var createMemoizedListFormat = memoize(function() {
206
+ var _a;
207
+ var args = [];
208
+ for (var _i = 0; _i < arguments.length; _i++) {
209
+ args[_i] = arguments[_i];
210
+ }
211
+ return new ((_a = Intl.ListFormat).bind.apply(_a, __spreadArray([void 0], args, false)))();
212
+ }, {
213
+ strategy: strategies.variadic
214
+ });
215
+
216
+ // ../../../../../../../../execroot/formatjs/bazel-out/darwin_arm64-fastbuild/bin/node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/lib/regex.generated.js
217
+ var S_UNICODE_REGEX = /[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20BF\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC1\uFDFC\uFDFD\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDE8\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEE0-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF73\uDF80-\uDFD8\uDFE0-\uDFEB]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDD78\uDD7A-\uDDCB\uDDCD-\uDE53\uDE60-\uDE6D\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6\uDF00-\uDF92\uDF94-\uDFCA]/;
218
+
219
+ // ../../../../../../../../execroot/formatjs/bazel-out/darwin_arm64-fastbuild/bin/node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/lib/NumberFormat/format_to_parts.js
220
+ var CARET_S_UNICODE_REGEX = new RegExp("^".concat(S_UNICODE_REGEX.source));
221
+ var S_DOLLAR_UNICODE_REGEX = new RegExp("".concat(S_UNICODE_REGEX.source, "$"));
222
+
223
+ // ../../../../../../../../execroot/formatjs/bazel-out/darwin_arm64-fastbuild/bin/node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/lib/data.js
224
+ var MissingLocaleDataError = (
225
+ /** @class */
226
+ function(_super) {
227
+ __extends(MissingLocaleDataError2, _super);
228
+ function MissingLocaleDataError2() {
229
+ var _this = _super !== null && _super.apply(this, arguments) || this;
230
+ _this.type = "MISSING_LOCALE_DATA";
231
+ return _this;
232
+ }
233
+ return MissingLocaleDataError2;
234
+ }(Error)
235
+ );
236
+
237
+ // ../../../../../../../../execroot/formatjs/bazel-out/darwin_arm64-fastbuild/bin/node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/lib/types/date-time.js
238
+ var RangePatternType;
239
+ (function(RangePatternType2) {
240
+ RangePatternType2["startRange"] = "startRange";
241
+ RangePatternType2["shared"] = "shared";
242
+ RangePatternType2["endRange"] = "endRange";
243
+ })(RangePatternType || (RangePatternType = {}));
244
+
7
245
  // ../../../../../../../../execroot/formatjs/bazel-out/darwin_arm64-fastbuild/bin/packages/intl-enumerator/lib/src/calendars.generated.js
8
246
  var calendars = ["buddhist", "chinese", "coptic", "dangi", "ethioaa", "ethiopic", "gregory", "hebrew", "indian", "islamic", "islamic-civil", "islamic-rgsa", "islamic-tbla", "islamic-umalqura", "islamicc", "iso8601", "japanese", "persian", "roc"];
9
247
 
@@ -13,7 +251,7 @@
13
251
  locale = "en";
14
252
  }
15
253
  try {
16
- var dateTimeFormat = new Intl.DateTimeFormat("".concat(locale, "-u-ca-").concat(item));
254
+ var dateTimeFormat = createMemoizedDateTimeFormat("".concat(locale, "-u-ca-").concat(item));
17
255
  var options = dateTimeFormat.resolvedOptions().calendar;
18
256
  if (item !== "gregory" || options !== "gregory")
19
257
  return true;
@@ -56,7 +294,7 @@
56
294
  locale = "en";
57
295
  }
58
296
  try {
59
- var numberFormat = new Intl.NumberFormat(locale, {
297
+ var numberFormat = createMemoizedNumberFormat(locale, {
60
298
  style: "currency",
61
299
  currencyDisplay: "name",
62
300
  currency
@@ -101,7 +339,7 @@
101
339
  locale = "en";
102
340
  }
103
341
  try {
104
- var numberFormat = new Intl.NumberFormat("".concat(locale, "-u-nu-").concat(system));
342
+ var numberFormat = createMemoizedNumberFormat("".concat(locale, "-u-nu-").concat(system));
105
343
  var options = numberFormat.resolvedOptions().numberingSystem;
106
344
  if (options === system && system === "latn" || numberFormat.format(123) !== "123") {
107
345
  return true;
@@ -125,7 +363,7 @@
125
363
  locale = "en";
126
364
  }
127
365
  try {
128
- var formatter = new Intl.DateTimeFormat(locale, { timeZone });
366
+ var formatter = createMemoizedDateTimeFormat(locale, { timeZone });
129
367
  return formatter.resolvedOptions().timeZone === timeZone;
130
368
  } catch (_err) {
131
369
  }
@@ -146,7 +384,7 @@
146
384
  locale = "en";
147
385
  }
148
386
  try {
149
- var formatter = new Intl.NumberFormat(locale, { style: "unit", unit });
387
+ var formatter = createMemoizedNumberFormat(locale, { style: "unit", unit });
150
388
  return formatter.resolvedOptions().unit === unit;
151
389
  } catch (_err) {
152
390
  }
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getSupportedCalendars = void 0;
4
+ var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
4
5
  var calendars_generated_1 = require("./calendars.generated");
5
6
  function isSupportedCalendar(item, locale) {
6
7
  if (locale === void 0) { locale = 'en'; }
7
8
  try {
8
- var dateTimeFormat = new Intl.DateTimeFormat("".concat(locale, "-u-ca-").concat(item));
9
+ var dateTimeFormat = (0, ecma402_abstract_1.createMemoizedDateTimeFormat)("".concat(locale, "-u-ca-").concat(item));
9
10
  var options = dateTimeFormat.resolvedOptions().calendar;
10
11
  if (item !== 'gregory' || options !== 'gregory')
11
12
  return true;
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getSupportedCurrencies = void 0;
4
+ var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
4
5
  var currencies_generated_1 = require("./currencies.generated");
5
6
  function isSupportedCurrency(currency, locale) {
6
7
  if (locale === void 0) { locale = 'en'; }
7
8
  try {
8
- var numberFormat = new Intl.NumberFormat(locale, {
9
+ var numberFormat = (0, ecma402_abstract_1.createMemoizedNumberFormat)(locale, {
9
10
  style: 'currency',
10
11
  currencyDisplay: 'name',
11
12
  currency: currency,
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getSupportedNumberingSystems = void 0;
4
+ var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
4
5
  var numbering_systems_generated_1 = require("./numbering-systems.generated");
5
6
  function isSupportedNumberingSystem(system, locale) {
6
7
  if (locale === void 0) { locale = 'en'; }
7
8
  try {
8
- var numberFormat = new Intl.NumberFormat("".concat(locale, "-u-nu-").concat(system));
9
+ var numberFormat = (0, ecma402_abstract_1.createMemoizedNumberFormat)("".concat(locale, "-u-nu-").concat(system));
9
10
  var options = numberFormat.resolvedOptions().numberingSystem;
10
11
  if ((options === system && system === 'latn') ||
11
12
  numberFormat.format(123) !== '123') {
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getSupportedTimeZones = void 0;
4
+ var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
4
5
  var timezones_generated_1 = require("./timezones.generated");
5
6
  function isSupported(timeZone, locale) {
6
7
  if (locale === void 0) { locale = 'en'; }
7
8
  try {
8
- var formatter = new Intl.DateTimeFormat(locale, { timeZone: timeZone });
9
+ var formatter = (0, ecma402_abstract_1.createMemoizedDateTimeFormat)(locale, { timeZone: timeZone });
9
10
  return formatter.resolvedOptions().timeZone === timeZone;
10
11
  }
11
12
  catch (_err) { }
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getSupportedUnits = void 0;
4
+ var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
4
5
  var units_generated_1 = require("./units.generated");
5
6
  function isSupported(unit, locale) {
6
7
  if (locale === void 0) { locale = 'en'; }
7
8
  try {
8
- var formatter = new Intl.NumberFormat(locale, { style: 'unit', unit: unit });
9
+ var formatter = (0, ecma402_abstract_1.createMemoizedNumberFormat)(locale, { style: 'unit', unit: unit });
9
10
  return formatter.resolvedOptions().unit === unit;
10
11
  }
11
12
  catch (_err) { }