@formatjs/intl-supportedvaluesof 2.4.0 → 3.0.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.
package/polyfill.iife.js CHANGED
@@ -1,9 +1,8 @@
1
- //#region packages/intl-supportedvaluesof/should-polyfill.ts
1
+ // packages/intl-supportedvaluesof/should-polyfill.ts
2
2
  function shouldPolyfill() {
3
3
  return typeof Intl === "undefined" || !("supportedValuesOf" in Intl);
4
4
  }
5
- //#endregion
6
- //#region packages/ecma262-abstract/ToString.js
5
+ // packages/ecma262-abstract/ToString.js
7
6
  /**
8
7
  * https://tc39.es/ecma262/#sec-tostring
9
8
  */
@@ -11,8 +10,7 @@ function ToString(o) {
11
10
  if (typeof o === "symbol") throw TypeError("Cannot convert a Symbol value to a string");
12
11
  return String(o);
13
12
  }
14
- //#endregion
15
- //#region node_modules/.aspect_rules_js/@formatjs+fast-memoize@0.0.0/node_modules/@formatjs/fast-memoize/index.js
13
+ // node_modules/.aspect_rules_js/@formatjs+fast-memoize@0.0.0/node_modules/@formatjs/fast-memoize/index.js
16
14
  function memoize(fn, options) {
17
15
  const cache = options && options.cache ? options.cache : cacheDefault;
18
16
  const serializer = options && options.serializer ? options.serializer : serializerDefault;
@@ -77,8 +75,7 @@ const strategies = {
77
75
  variadic: strategyVariadic,
78
76
  monadic: strategyMonadic
79
77
  };
80
- //#endregion
81
- //#region packages/intl-supportedvaluesof/memoize.ts
78
+ // packages/intl-supportedvaluesof/memoize.ts
82
79
  /**
83
80
  * Implementation: Memoized factory for Intl.DateTimeFormat instances
84
81
  *
@@ -88,8 +85,7 @@ const strategies = {
88
85
  * Uses variadic memoization strategy to handle varying numbers of constructor arguments.
89
86
  */
90
87
  const createMemoizedDateTimeFormat = memoize((...args) => new Intl.DateTimeFormat(...args), { strategy: strategies.variadic });
91
- //#endregion
92
- //#region node_modules/.aspect_rules_js/@formatjs_generated+cldr.supported-values@0.0.0/node_modules/@formatjs_generated/cldr.supported-values/calendars.js
88
+ // node_modules/.aspect_rules_js/@formatjs_generated+cldr.supported-values@0.0.0/node_modules/@formatjs_generated/cldr.supported-values/calendars.js
93
89
  const calendars = [
94
90
  "buddhist",
95
91
  "chinese",
@@ -111,8 +107,7 @@ const calendars = [
111
107
  "persian",
112
108
  "roc"
113
109
  ];
114
- //#endregion
115
- //#region packages/intl-supportedvaluesof/get-supported-calendars.ts
110
+ // packages/intl-supportedvaluesof/get-supported-calendars.ts
116
111
  /**
117
112
  * Implementation: Tests if a calendar is supported by attempting to create
118
113
  * a DateTimeFormat with that calendar and verifying it was accepted.
@@ -134,8 +129,7 @@ function isSupportedCalendar(item) {
134
129
  function getSupportedCalendars() {
135
130
  return calendars.filter(isSupportedCalendar).sort();
136
131
  }
137
- //#endregion
138
- //#region node_modules/.aspect_rules_js/@formatjs_generated+cldr.supported-values@0.0.0/node_modules/@formatjs_generated/cldr.supported-values/collations.js
132
+ // node_modules/.aspect_rules_js/@formatjs_generated+cldr.supported-values@0.0.0/node_modules/@formatjs_generated/cldr.supported-values/collations.js
139
133
  const collations = [
140
134
  "big5han",
141
135
  "compat",
@@ -157,8 +151,7 @@ const collations = [
157
151
  "unihan",
158
152
  "zhuyin"
159
153
  ];
160
- //#endregion
161
- //#region node_modules/.aspect_rules_js/@formatjs_generated+cldr.collation@0.0.0/node_modules/@formatjs_generated/cldr.collation/locale-data.js
154
+ // node_modules/.aspect_rules_js/@formatjs_generated+cldr.collation@0.0.0/node_modules/@formatjs_generated/cldr.collation/locale-data.js
162
155
  const collationCandidateLocales = {
163
156
  "emoji": [
164
157
  "aa",
@@ -457,8 +450,7 @@ const collationCandidateLocales = {
457
450
  "stroke": ["zh", "zh-Hant"],
458
451
  "zhuyin": ["zh", "zh-Hant"]
459
452
  };
460
- //#endregion
461
- //#region packages/intl-supportedvaluesof/get-supported-collations.ts
453
+ // packages/intl-supportedvaluesof/get-supported-collations.ts
462
454
  function isSupportedCollation(collation) {
463
455
  const candidates = collationCandidateLocales[collation] || ["en"];
464
456
  for (const locale of candidates) try {
@@ -469,8 +461,7 @@ function isSupportedCollation(collation) {
469
461
  function getSupportedCollations() {
470
462
  return collations.filter(isSupportedCollation).sort();
471
463
  }
472
- //#endregion
473
- //#region packages/ecma402-abstract/utils.js
464
+ // packages/ecma402-abstract/utils.js
474
465
  function defineProperty(target, name, { value }) {
475
466
  Object.defineProperty(target, name, {
476
467
  configurable: true,
@@ -491,8 +482,7 @@ function ensureIntl() {
491
482
  const createMemoizedNumberFormat = memoize((...args) => new Intl.NumberFormat(...args), { strategy: strategies.variadic });
492
483
  memoize((...args) => new Intl.PluralRules(...args), { strategy: strategies.variadic });
493
484
  memoize((...args) => new Intl.ListFormat(...args), { strategy: strategies.variadic });
494
- //#endregion
495
- //#region node_modules/.aspect_rules_js/@formatjs_generated+cldr.supported-values@0.0.0/node_modules/@formatjs_generated/cldr.supported-values/currencies.js
485
+ // node_modules/.aspect_rules_js/@formatjs_generated+cldr.supported-values@0.0.0/node_modules/@formatjs_generated/cldr.supported-values/currencies.js
496
486
  const currencies = [
497
487
  "ADP",
498
488
  "AED",
@@ -560,7 +550,6 @@ const currencies = [
560
550
  "CLF",
561
551
  "CLP",
562
552
  "CNH",
563
- "CNX",
564
553
  "CNY",
565
554
  "COP",
566
555
  "COU",
@@ -802,8 +791,7 @@ const currencies = [
802
791
  "ZWL",
803
792
  "ZWR"
804
793
  ];
805
- //#endregion
806
- //#region packages/intl-supportedvaluesof/get-supported-currencies.ts
794
+ // packages/intl-supportedvaluesof/get-supported-currencies.ts
807
795
  /**
808
796
  * Implementation: Tests if a currency is supported by attempting to create
809
797
  * a NumberFormat with that currency and verifying it was accepted.
@@ -842,8 +830,7 @@ function getSupportedCurrencies() {
842
830
  }
843
831
  return supportedCurrencies.sort();
844
832
  }
845
- //#endregion
846
- //#region node_modules/.aspect_rules_js/@formatjs_generated+cldr.number@0.0.0/node_modules/@formatjs_generated/cldr.number/numbering-systems.js
833
+ // node_modules/.aspect_rules_js/@formatjs_generated+cldr.number@0.0.0/node_modules/@formatjs_generated/cldr.number/numbering-systems.js
847
834
  const numberingSystemNames = [
848
835
  "adlm",
849
836
  "ahom",
@@ -943,8 +930,7 @@ const numberingSystemNames = [
943
930
  "wara",
944
931
  "wcho"
945
932
  ];
946
- //#endregion
947
- //#region packages/intl-supportedvaluesof/get-supported-numbering-systems.ts
933
+ // packages/intl-supportedvaluesof/get-supported-numbering-systems.ts
948
934
  /**
949
935
  * Implementation: Tests if a numbering system is supported by attempting to create
950
936
  * a NumberFormat with that numbering system and verifying it was accepted.
@@ -967,8 +953,7 @@ function isSupportedNumberingSystem(system) {
967
953
  function getSupportedNumberingSystems() {
968
954
  return numberingSystemNames.filter(isSupportedNumberingSystem).sort();
969
955
  }
970
- //#endregion
971
- //#region node_modules/.aspect_rules_js/@formatjs_generated+cldr.supported-values@0.0.0/node_modules/@formatjs_generated/cldr.supported-values/timezones.js
956
+ // node_modules/.aspect_rules_js/@formatjs_generated+cldr.supported-values@0.0.0/node_modules/@formatjs_generated/cldr.supported-values/timezones.js
972
957
  const timezones = [
973
958
  "Africa/Abidjan",
974
959
  "Africa/Accra",
@@ -1429,8 +1414,7 @@ const timezones = [
1429
1414
  "Pacific/Wallis",
1430
1415
  "UTC"
1431
1416
  ];
1432
- //#endregion
1433
- //#region packages/intl-supportedvaluesof/get-supported-timezones.ts
1417
+ // packages/intl-supportedvaluesof/get-supported-timezones.ts
1434
1418
  /**
1435
1419
  * Implementation: Tests if a timezone is supported by attempting to create
1436
1420
  * a DateTimeFormat with that timezone and verifying it was accepted.
@@ -1452,8 +1436,7 @@ function isSupportedTimeZone(timeZone) {
1452
1436
  function getSupportedTimeZones() {
1453
1437
  return timezones.filter(isSupportedTimeZone).sort();
1454
1438
  }
1455
- //#endregion
1456
- //#region node_modules/.aspect_rules_js/@formatjs_generated+cldr.supported-values@0.0.0/node_modules/@formatjs_generated/cldr.supported-values/units.js
1439
+ // node_modules/.aspect_rules_js/@formatjs_generated+cldr.supported-values@0.0.0/node_modules/@formatjs_generated/cldr.supported-values/units.js
1457
1440
  const units = [
1458
1441
  "degree",
1459
1442
  "acre",
@@ -1501,8 +1484,7 @@ const units = [
1501
1484
  "liter",
1502
1485
  "milliliter"
1503
1486
  ];
1504
- //#endregion
1505
- //#region packages/intl-supportedvaluesof/get-supported-units.ts
1487
+ // packages/intl-supportedvaluesof/get-supported-units.ts
1506
1488
  /**
1507
1489
  * Implementation: Tests if a unit is supported by attempting to create
1508
1490
  * a NumberFormat with that unit and verifying it was accepted.
@@ -1527,8 +1509,7 @@ function isSupportedUnit(unit) {
1527
1509
  function getSupportedUnits() {
1528
1510
  return units.filter(isSupportedUnit).sort();
1529
1511
  }
1530
- //#endregion
1531
- //#region packages/intl-supportedvaluesof/index.ts
1512
+ // packages/intl-supportedvaluesof/index.ts
1532
1513
  /**
1533
1514
  * ECMA-402 Spec: Intl.supportedValuesOf(key)
1534
1515
  * ECMA-402 §8.3.2 Intl.supportedValuesOf, step 1.
@@ -1557,10 +1538,8 @@ const supportedValuesOf = { supportedValuesOf(key) {
1557
1538
  default: throw RangeError("Invalid key: " + key);
1558
1539
  }
1559
1540
  } }.supportedValuesOf;
1560
- //#endregion
1561
- //#region packages/intl-supportedvaluesof/polyfill.ts
1541
+ // packages/intl-supportedvaluesof/polyfill.ts
1562
1542
  const intl = ensureIntl();
1563
1543
  if (shouldPolyfill()) defineProperty(intl, "supportedValuesOf", { value: supportedValuesOf });
1564
- //#endregion
1565
1544
 
1566
1545
  //# sourceMappingURL=polyfill.iife.js.map
package/polyfill.js CHANGED
@@ -1,10 +1,9 @@
1
1
  import { memoize, strategies } from "@formatjs/fast-memoize";
2
- //#region packages/intl-supportedvaluesof/should-polyfill.ts
2
+ // packages/intl-supportedvaluesof/should-polyfill.ts
3
3
  function shouldPolyfill() {
4
4
  return typeof Intl === "undefined" || !("supportedValuesOf" in Intl);
5
5
  }
6
- //#endregion
7
- //#region packages/ecma262-abstract/ToString.js
6
+ // packages/ecma262-abstract/ToString.js
8
7
  /**
9
8
  * https://tc39.es/ecma262/#sec-tostring
10
9
  */
@@ -12,8 +11,7 @@ function ToString(o) {
12
11
  if (typeof o === "symbol") throw TypeError("Cannot convert a Symbol value to a string");
13
12
  return String(o);
14
13
  }
15
- //#endregion
16
- //#region packages/intl-supportedvaluesof/memoize.ts
14
+ // packages/intl-supportedvaluesof/memoize.ts
17
15
  /**
18
16
  * Implementation: Memoized factory for Intl.DateTimeFormat instances
19
17
  *
@@ -23,8 +21,7 @@ function ToString(o) {
23
21
  * Uses variadic memoization strategy to handle varying numbers of constructor arguments.
24
22
  */
25
23
  const createMemoizedDateTimeFormat = memoize((...args) => new Intl.DateTimeFormat(...args), { strategy: strategies.variadic });
26
- //#endregion
27
- //#region node_modules/.aspect_rules_js/@formatjs_generated+cldr.supported-values@0.0.0/node_modules/@formatjs_generated/cldr.supported-values/calendars.js
24
+ // node_modules/.aspect_rules_js/@formatjs_generated+cldr.supported-values@0.0.0/node_modules/@formatjs_generated/cldr.supported-values/calendars.js
28
25
  const calendars = [
29
26
  "buddhist",
30
27
  "chinese",
@@ -46,8 +43,7 @@ const calendars = [
46
43
  "persian",
47
44
  "roc"
48
45
  ];
49
- //#endregion
50
- //#region packages/intl-supportedvaluesof/get-supported-calendars.ts
46
+ // packages/intl-supportedvaluesof/get-supported-calendars.ts
51
47
  /**
52
48
  * Implementation: Tests if a calendar is supported by attempting to create
53
49
  * a DateTimeFormat with that calendar and verifying it was accepted.
@@ -69,8 +65,7 @@ function isSupportedCalendar(item) {
69
65
  function getSupportedCalendars() {
70
66
  return calendars.filter(isSupportedCalendar).sort();
71
67
  }
72
- //#endregion
73
- //#region node_modules/.aspect_rules_js/@formatjs_generated+cldr.supported-values@0.0.0/node_modules/@formatjs_generated/cldr.supported-values/collations.js
68
+ // node_modules/.aspect_rules_js/@formatjs_generated+cldr.supported-values@0.0.0/node_modules/@formatjs_generated/cldr.supported-values/collations.js
74
69
  const collations = [
75
70
  "big5han",
76
71
  "compat",
@@ -92,8 +87,7 @@ const collations = [
92
87
  "unihan",
93
88
  "zhuyin"
94
89
  ];
95
- //#endregion
96
- //#region node_modules/.aspect_rules_js/@formatjs_generated+cldr.collation@0.0.0/node_modules/@formatjs_generated/cldr.collation/locale-data.js
90
+ // node_modules/.aspect_rules_js/@formatjs_generated+cldr.collation@0.0.0/node_modules/@formatjs_generated/cldr.collation/locale-data.js
97
91
  const collationCandidateLocales = {
98
92
  "emoji": [
99
93
  "aa",
@@ -392,8 +386,7 @@ const collationCandidateLocales = {
392
386
  "stroke": ["zh", "zh-Hant"],
393
387
  "zhuyin": ["zh", "zh-Hant"]
394
388
  };
395
- //#endregion
396
- //#region packages/intl-supportedvaluesof/get-supported-collations.ts
389
+ // packages/intl-supportedvaluesof/get-supported-collations.ts
397
390
  function isSupportedCollation(collation) {
398
391
  const candidates = collationCandidateLocales[collation] || ["en"];
399
392
  for (const locale of candidates) try {
@@ -404,8 +397,7 @@ function isSupportedCollation(collation) {
404
397
  function getSupportedCollations() {
405
398
  return collations.filter(isSupportedCollation).sort();
406
399
  }
407
- //#endregion
408
- //#region packages/ecma402-abstract/utils.js
400
+ // packages/ecma402-abstract/utils.js
409
401
  function defineProperty(target, name, { value }) {
410
402
  Object.defineProperty(target, name, {
411
403
  configurable: true,
@@ -426,8 +418,7 @@ function ensureIntl() {
426
418
  const createMemoizedNumberFormat = memoize((...args) => new Intl.NumberFormat(...args), { strategy: strategies.variadic });
427
419
  memoize((...args) => new Intl.PluralRules(...args), { strategy: strategies.variadic });
428
420
  memoize((...args) => new Intl.ListFormat(...args), { strategy: strategies.variadic });
429
- //#endregion
430
- //#region node_modules/.aspect_rules_js/@formatjs_generated+cldr.supported-values@0.0.0/node_modules/@formatjs_generated/cldr.supported-values/currencies.js
421
+ // node_modules/.aspect_rules_js/@formatjs_generated+cldr.supported-values@0.0.0/node_modules/@formatjs_generated/cldr.supported-values/currencies.js
431
422
  const currencies = [
432
423
  "ADP",
433
424
  "AED",
@@ -495,7 +486,6 @@ const currencies = [
495
486
  "CLF",
496
487
  "CLP",
497
488
  "CNH",
498
- "CNX",
499
489
  "CNY",
500
490
  "COP",
501
491
  "COU",
@@ -737,8 +727,7 @@ const currencies = [
737
727
  "ZWL",
738
728
  "ZWR"
739
729
  ];
740
- //#endregion
741
- //#region packages/intl-supportedvaluesof/get-supported-currencies.ts
730
+ // packages/intl-supportedvaluesof/get-supported-currencies.ts
742
731
  /**
743
732
  * Implementation: Tests if a currency is supported by attempting to create
744
733
  * a NumberFormat with that currency and verifying it was accepted.
@@ -777,8 +766,7 @@ function getSupportedCurrencies() {
777
766
  }
778
767
  return supportedCurrencies.sort();
779
768
  }
780
- //#endregion
781
- //#region node_modules/.aspect_rules_js/@formatjs_generated+cldr.number@0.0.0/node_modules/@formatjs_generated/cldr.number/numbering-systems.js
769
+ // node_modules/.aspect_rules_js/@formatjs_generated+cldr.number@0.0.0/node_modules/@formatjs_generated/cldr.number/numbering-systems.js
782
770
  const numberingSystemNames = [
783
771
  "adlm",
784
772
  "ahom",
@@ -878,8 +866,7 @@ const numberingSystemNames = [
878
866
  "wara",
879
867
  "wcho"
880
868
  ];
881
- //#endregion
882
- //#region packages/intl-supportedvaluesof/get-supported-numbering-systems.ts
869
+ // packages/intl-supportedvaluesof/get-supported-numbering-systems.ts
883
870
  /**
884
871
  * Implementation: Tests if a numbering system is supported by attempting to create
885
872
  * a NumberFormat with that numbering system and verifying it was accepted.
@@ -902,8 +889,7 @@ function isSupportedNumberingSystem(system) {
902
889
  function getSupportedNumberingSystems() {
903
890
  return numberingSystemNames.filter(isSupportedNumberingSystem).sort();
904
891
  }
905
- //#endregion
906
- //#region node_modules/.aspect_rules_js/@formatjs_generated+cldr.supported-values@0.0.0/node_modules/@formatjs_generated/cldr.supported-values/timezones.js
892
+ // node_modules/.aspect_rules_js/@formatjs_generated+cldr.supported-values@0.0.0/node_modules/@formatjs_generated/cldr.supported-values/timezones.js
907
893
  const timezones = [
908
894
  "Africa/Abidjan",
909
895
  "Africa/Accra",
@@ -1364,8 +1350,7 @@ const timezones = [
1364
1350
  "Pacific/Wallis",
1365
1351
  "UTC"
1366
1352
  ];
1367
- //#endregion
1368
- //#region packages/intl-supportedvaluesof/get-supported-timezones.ts
1353
+ // packages/intl-supportedvaluesof/get-supported-timezones.ts
1369
1354
  /**
1370
1355
  * Implementation: Tests if a timezone is supported by attempting to create
1371
1356
  * a DateTimeFormat with that timezone and verifying it was accepted.
@@ -1387,8 +1372,7 @@ function isSupportedTimeZone(timeZone) {
1387
1372
  function getSupportedTimeZones() {
1388
1373
  return timezones.filter(isSupportedTimeZone).sort();
1389
1374
  }
1390
- //#endregion
1391
- //#region node_modules/.aspect_rules_js/@formatjs_generated+cldr.supported-values@0.0.0/node_modules/@formatjs_generated/cldr.supported-values/units.js
1375
+ // node_modules/.aspect_rules_js/@formatjs_generated+cldr.supported-values@0.0.0/node_modules/@formatjs_generated/cldr.supported-values/units.js
1392
1376
  const units = [
1393
1377
  "degree",
1394
1378
  "acre",
@@ -1436,8 +1420,7 @@ const units = [
1436
1420
  "liter",
1437
1421
  "milliliter"
1438
1422
  ];
1439
- //#endregion
1440
- //#region packages/intl-supportedvaluesof/get-supported-units.ts
1423
+ // packages/intl-supportedvaluesof/get-supported-units.ts
1441
1424
  /**
1442
1425
  * Implementation: Tests if a unit is supported by attempting to create
1443
1426
  * a NumberFormat with that unit and verifying it was accepted.
@@ -1462,8 +1445,7 @@ function isSupportedUnit(unit) {
1462
1445
  function getSupportedUnits() {
1463
1446
  return units.filter(isSupportedUnit).sort();
1464
1447
  }
1465
- //#endregion
1466
- //#region packages/intl-supportedvaluesof/index.ts
1448
+ // packages/intl-supportedvaluesof/index.ts
1467
1449
  /**
1468
1450
  * ECMA-402 Spec: Intl.supportedValuesOf(key)
1469
1451
  * ECMA-402 §8.3.2 Intl.supportedValuesOf, step 1.
@@ -1492,10 +1474,8 @@ const supportedValuesOf = { supportedValuesOf(key) {
1492
1474
  default: throw RangeError("Invalid key: " + key);
1493
1475
  }
1494
1476
  } }.supportedValuesOf;
1495
- //#endregion
1496
- //#region packages/intl-supportedvaluesof/polyfill.ts
1477
+ // packages/intl-supportedvaluesof/polyfill.ts
1497
1478
  const intl = ensureIntl();
1498
1479
  if (shouldPolyfill()) defineProperty(intl, "supportedValuesOf", { value: supportedValuesOf });
1499
- //#endregion
1500
1480
 
1501
1481
  //# sourceMappingURL=polyfill.js.map