@formatjs/intl-enumerator 2.1.0 → 2.1.2
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/index.d.ts +8 -8
- package/index.js +2 -2
- package/package.json +2 -2
- package/polyfill-force.js +6 -6
- package/polyfill.iife.js +2022 -2798
- package/polyfill.js +8 -8
- package/should-polyfill.js +1 -1
- package/src/calendars.generated.d.ts +3 -1
- package/src/calendars.generated.js +21 -1
- package/src/collations.generated.d.ts +3 -1
- package/src/collations.generated.js +21 -1
- package/src/currencies.generated.d.ts +3 -1
- package/src/currencies.generated.js +309 -1
- package/src/get-supported-calendars.d.ts +1 -1
- package/src/get-supported-calendars.js +10 -15
- package/src/get-supported-collations.d.ts +1 -1
- package/src/get-supported-collations.js +7 -10
- package/src/get-supported-currencies.d.ts +1 -1
- package/src/get-supported-currencies.js +34 -39
- package/src/get-supported-numbering-systems.js +12 -17
- package/src/get-supported-timezones.d.ts +1 -1
- package/src/get-supported-timezones.js +9 -11
- package/src/get-supported-units.d.ts +1 -1
- package/src/get-supported-units.js +12 -11
- package/src/index.d.ts +1 -1
- package/src/index.js +15 -22
- package/src/numbering-systems.generated.js +99 -1
- package/src/timezones.generated.d.ts +4 -2
- package/src/timezones.generated.js +429 -1
- package/src/units.generated.d.ts +3 -1
- package/src/units.generated.js +45 -1
package/polyfill.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { shouldPolyfill } from
|
|
2
|
-
import { supportedValuesOf } from
|
|
1
|
+
import { shouldPolyfill } from "./should-polyfill.js";
|
|
2
|
+
import { supportedValuesOf } from "./src";
|
|
3
3
|
if (shouldPolyfill()) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
Object.defineProperty(Intl, "supportedValuesOf", {
|
|
5
|
+
value: supportedValuesOf,
|
|
6
|
+
enumerable: true,
|
|
7
|
+
writable: false,
|
|
8
|
+
configurable: false
|
|
9
|
+
});
|
|
10
10
|
}
|
package/should-polyfill.js
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
/* @generated */
|
|
2
|
+
// prettier-ignore
|
|
1
3
|
export declare const calendars: readonly ["buddhist", "chinese", "coptic", "dangi", "ethioaa", "ethiopic", "gregory", "hebrew", "indian", "islamic", "islamic-civil", "islamic-rgsa", "islamic-tbla", "islamic-umalqura", "islamicc", "iso8601", "japanese", "persian", "roc"];
|
|
2
|
-
export type Calendar = typeof calendars[number];
|
|
4
|
+
export type Calendar = (typeof calendars)[number];
|
|
@@ -1,3 +1,23 @@
|
|
|
1
1
|
/* @generated */
|
|
2
2
|
// prettier-ignore
|
|
3
|
-
export
|
|
3
|
+
export const calendars = [
|
|
4
|
+
"buddhist",
|
|
5
|
+
"chinese",
|
|
6
|
+
"coptic",
|
|
7
|
+
"dangi",
|
|
8
|
+
"ethioaa",
|
|
9
|
+
"ethiopic",
|
|
10
|
+
"gregory",
|
|
11
|
+
"hebrew",
|
|
12
|
+
"indian",
|
|
13
|
+
"islamic",
|
|
14
|
+
"islamic-civil",
|
|
15
|
+
"islamic-rgsa",
|
|
16
|
+
"islamic-tbla",
|
|
17
|
+
"islamic-umalqura",
|
|
18
|
+
"islamicc",
|
|
19
|
+
"iso8601",
|
|
20
|
+
"japanese",
|
|
21
|
+
"persian",
|
|
22
|
+
"roc"
|
|
23
|
+
];
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
/* @generated */
|
|
2
|
+
// prettier-ignore
|
|
1
3
|
export declare const collations: readonly ["big5han", "compat", "dict", "direct", "ducet", "emoji", "eor", "gb2312", "phonebk", "phonetic", "pinyin", "reformed", "search", "searchjl", "standard", "stroke", "trad", "unihan", "zhuyin"];
|
|
2
|
-
export type Collation = typeof collations[number];
|
|
4
|
+
export type Collation = (typeof collations)[number];
|
|
@@ -1,3 +1,23 @@
|
|
|
1
1
|
/* @generated */
|
|
2
2
|
// prettier-ignore
|
|
3
|
-
export
|
|
3
|
+
export const collations = [
|
|
4
|
+
"big5han",
|
|
5
|
+
"compat",
|
|
6
|
+
"dict",
|
|
7
|
+
"direct",
|
|
8
|
+
"ducet",
|
|
9
|
+
"emoji",
|
|
10
|
+
"eor",
|
|
11
|
+
"gb2312",
|
|
12
|
+
"phonebk",
|
|
13
|
+
"phonetic",
|
|
14
|
+
"pinyin",
|
|
15
|
+
"reformed",
|
|
16
|
+
"search",
|
|
17
|
+
"searchjl",
|
|
18
|
+
"standard",
|
|
19
|
+
"stroke",
|
|
20
|
+
"trad",
|
|
21
|
+
"unihan",
|
|
22
|
+
"zhuyin"
|
|
23
|
+
];
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
/* @generated */
|
|
2
|
+
// prettier-ignore
|
|
1
3
|
export declare const currencies: readonly ["ADP", "AED", "AFA", "AFN", "ALK", "ALL", "AMD", "ANG", "AOA", "AOK", "AON", "AOR", "ARA", "ARL", "ARM", "ARP", "ARS", "ATS", "AUD", "AWG", "AZM", "AZN", "BAD", "BAM", "BAN", "BBD", "BDT", "BEC", "BEF", "BEL", "BGL", "BGM", "BGN", "BGO", "BHD", "BIF", "BMD", "BND", "BOB", "BOL", "BOP", "BOV", "BRB", "BRC", "BRE", "BRL", "BRN", "BRR", "BRZ", "BSD", "BTN", "BUK", "BWP", "BYB", "BYN", "BYR", "BZD", "CAD", "CDF", "CHE", "CHF", "CHW", "CLE", "CLF", "CLP", "CNH", "CNX", "CNY", "COP", "COU", "CRC", "CSD", "CSK", "CUC", "CUP", "CVE", "CYP", "CZK", "DDM", "DEM", "DJF", "DKK", "DOP", "DZD", "ECS", "ECV", "EEK", "EGP", "ERN", "ESA", "ESB", "ESP", "ETB", "EUR", "FIM", "FJD", "FKP", "FRF", "GBP", "GEK", "GEL", "GHC", "GHS", "GIP", "GMD", "GNF", "GNS", "GQE", "GRD", "GTQ", "GWE", "GWP", "GYD", "HKD", "HNL", "HRD", "HRK", "HTG", "HUF", "IDR", "IEP", "ILP", "ILR", "ILS", "INR", "IQD", "IRR", "ISJ", "ISK", "ITL", "JMD", "JOD", "JPY", "KES", "KGS", "KHR", "KMF", "KPW", "KRH", "KRO", "KRW", "KWD", "KYD", "KZT", "LAK", "LBP", "LKR", "LRD", "LSL", "LTL", "LTT", "LUC", "LUF", "LUL", "LVL", "LVR", "LYD", "MAD", "MAF", "MCF", "MDC", "MDL", "MGA", "MGF", "MKD", "MKN", "MLF", "MMK", "MNT", "MOP", "MRO", "MRU", "MTL", "MTP", "MUR", "MVP", "MVR", "MWK", "MXN", "MXP", "MXV", "MYR", "MZE", "MZM", "MZN", "NAD", "NGN", "NIC", "NIO", "NLG", "NOK", "NPR", "NZD", "OMR", "PAB", "PEI", "PEN", "PES", "PGK", "PHP", "PKR", "PLN", "PLZ", "PTE", "PYG", "QAR", "RHD", "ROL", "RON", "RSD", "RUB", "RUR", "RWF", "SAR", "SBD", "SCR", "SDD", "SDG", "SDP", "SEK", "SGD", "SHP", "SIT", "SKK", "SLE", "SLL", "SOS", "SRD", "SRG", "SSP", "STD", "STN", "SUR", "SVC", "SYP", "SZL", "THB", "TJR", "TJS", "TMM", "TMT", "TND", "TOP", "TPE", "TRL", "TRY", "TTD", "TWD", "TZS", "UAH", "UAK", "UGS", "UGX", "USD", "USN", "USS", "UYI", "UYP", "UYU", "UYW", "UZS", "VEB", "VED", "VEF", "VES", "VND", "VNN", "VUV", "WST", "XAF", "XAG", "XAU", "XBA", "XBB", "XBC", "XBD", "XCD", "XCG", "XDR", "XEU", "XFO", "XFU", "XOF", "XPD", "XPF", "XPT", "XRE", "XSU", "XTS", "XUA", "XXX", "YDD", "YER", "YUD", "YUM", "YUN", "YUR", "ZAL", "ZAR", "ZMK", "ZMW", "ZRN", "ZRZ", "ZWD", "ZWG", "ZWL", "ZWR"];
|
|
2
|
-
export type Currency = typeof currencies[number];
|
|
4
|
+
export type Currency = (typeof currencies)[number];
|
|
@@ -1,3 +1,311 @@
|
|
|
1
1
|
/* @generated */
|
|
2
2
|
// prettier-ignore
|
|
3
|
-
export
|
|
3
|
+
export const currencies = [
|
|
4
|
+
"ADP",
|
|
5
|
+
"AED",
|
|
6
|
+
"AFA",
|
|
7
|
+
"AFN",
|
|
8
|
+
"ALK",
|
|
9
|
+
"ALL",
|
|
10
|
+
"AMD",
|
|
11
|
+
"ANG",
|
|
12
|
+
"AOA",
|
|
13
|
+
"AOK",
|
|
14
|
+
"AON",
|
|
15
|
+
"AOR",
|
|
16
|
+
"ARA",
|
|
17
|
+
"ARL",
|
|
18
|
+
"ARM",
|
|
19
|
+
"ARP",
|
|
20
|
+
"ARS",
|
|
21
|
+
"ATS",
|
|
22
|
+
"AUD",
|
|
23
|
+
"AWG",
|
|
24
|
+
"AZM",
|
|
25
|
+
"AZN",
|
|
26
|
+
"BAD",
|
|
27
|
+
"BAM",
|
|
28
|
+
"BAN",
|
|
29
|
+
"BBD",
|
|
30
|
+
"BDT",
|
|
31
|
+
"BEC",
|
|
32
|
+
"BEF",
|
|
33
|
+
"BEL",
|
|
34
|
+
"BGL",
|
|
35
|
+
"BGM",
|
|
36
|
+
"BGN",
|
|
37
|
+
"BGO",
|
|
38
|
+
"BHD",
|
|
39
|
+
"BIF",
|
|
40
|
+
"BMD",
|
|
41
|
+
"BND",
|
|
42
|
+
"BOB",
|
|
43
|
+
"BOL",
|
|
44
|
+
"BOP",
|
|
45
|
+
"BOV",
|
|
46
|
+
"BRB",
|
|
47
|
+
"BRC",
|
|
48
|
+
"BRE",
|
|
49
|
+
"BRL",
|
|
50
|
+
"BRN",
|
|
51
|
+
"BRR",
|
|
52
|
+
"BRZ",
|
|
53
|
+
"BSD",
|
|
54
|
+
"BTN",
|
|
55
|
+
"BUK",
|
|
56
|
+
"BWP",
|
|
57
|
+
"BYB",
|
|
58
|
+
"BYN",
|
|
59
|
+
"BYR",
|
|
60
|
+
"BZD",
|
|
61
|
+
"CAD",
|
|
62
|
+
"CDF",
|
|
63
|
+
"CHE",
|
|
64
|
+
"CHF",
|
|
65
|
+
"CHW",
|
|
66
|
+
"CLE",
|
|
67
|
+
"CLF",
|
|
68
|
+
"CLP",
|
|
69
|
+
"CNH",
|
|
70
|
+
"CNX",
|
|
71
|
+
"CNY",
|
|
72
|
+
"COP",
|
|
73
|
+
"COU",
|
|
74
|
+
"CRC",
|
|
75
|
+
"CSD",
|
|
76
|
+
"CSK",
|
|
77
|
+
"CUC",
|
|
78
|
+
"CUP",
|
|
79
|
+
"CVE",
|
|
80
|
+
"CYP",
|
|
81
|
+
"CZK",
|
|
82
|
+
"DDM",
|
|
83
|
+
"DEM",
|
|
84
|
+
"DJF",
|
|
85
|
+
"DKK",
|
|
86
|
+
"DOP",
|
|
87
|
+
"DZD",
|
|
88
|
+
"ECS",
|
|
89
|
+
"ECV",
|
|
90
|
+
"EEK",
|
|
91
|
+
"EGP",
|
|
92
|
+
"ERN",
|
|
93
|
+
"ESA",
|
|
94
|
+
"ESB",
|
|
95
|
+
"ESP",
|
|
96
|
+
"ETB",
|
|
97
|
+
"EUR",
|
|
98
|
+
"FIM",
|
|
99
|
+
"FJD",
|
|
100
|
+
"FKP",
|
|
101
|
+
"FRF",
|
|
102
|
+
"GBP",
|
|
103
|
+
"GEK",
|
|
104
|
+
"GEL",
|
|
105
|
+
"GHC",
|
|
106
|
+
"GHS",
|
|
107
|
+
"GIP",
|
|
108
|
+
"GMD",
|
|
109
|
+
"GNF",
|
|
110
|
+
"GNS",
|
|
111
|
+
"GQE",
|
|
112
|
+
"GRD",
|
|
113
|
+
"GTQ",
|
|
114
|
+
"GWE",
|
|
115
|
+
"GWP",
|
|
116
|
+
"GYD",
|
|
117
|
+
"HKD",
|
|
118
|
+
"HNL",
|
|
119
|
+
"HRD",
|
|
120
|
+
"HRK",
|
|
121
|
+
"HTG",
|
|
122
|
+
"HUF",
|
|
123
|
+
"IDR",
|
|
124
|
+
"IEP",
|
|
125
|
+
"ILP",
|
|
126
|
+
"ILR",
|
|
127
|
+
"ILS",
|
|
128
|
+
"INR",
|
|
129
|
+
"IQD",
|
|
130
|
+
"IRR",
|
|
131
|
+
"ISJ",
|
|
132
|
+
"ISK",
|
|
133
|
+
"ITL",
|
|
134
|
+
"JMD",
|
|
135
|
+
"JOD",
|
|
136
|
+
"JPY",
|
|
137
|
+
"KES",
|
|
138
|
+
"KGS",
|
|
139
|
+
"KHR",
|
|
140
|
+
"KMF",
|
|
141
|
+
"KPW",
|
|
142
|
+
"KRH",
|
|
143
|
+
"KRO",
|
|
144
|
+
"KRW",
|
|
145
|
+
"KWD",
|
|
146
|
+
"KYD",
|
|
147
|
+
"KZT",
|
|
148
|
+
"LAK",
|
|
149
|
+
"LBP",
|
|
150
|
+
"LKR",
|
|
151
|
+
"LRD",
|
|
152
|
+
"LSL",
|
|
153
|
+
"LTL",
|
|
154
|
+
"LTT",
|
|
155
|
+
"LUC",
|
|
156
|
+
"LUF",
|
|
157
|
+
"LUL",
|
|
158
|
+
"LVL",
|
|
159
|
+
"LVR",
|
|
160
|
+
"LYD",
|
|
161
|
+
"MAD",
|
|
162
|
+
"MAF",
|
|
163
|
+
"MCF",
|
|
164
|
+
"MDC",
|
|
165
|
+
"MDL",
|
|
166
|
+
"MGA",
|
|
167
|
+
"MGF",
|
|
168
|
+
"MKD",
|
|
169
|
+
"MKN",
|
|
170
|
+
"MLF",
|
|
171
|
+
"MMK",
|
|
172
|
+
"MNT",
|
|
173
|
+
"MOP",
|
|
174
|
+
"MRO",
|
|
175
|
+
"MRU",
|
|
176
|
+
"MTL",
|
|
177
|
+
"MTP",
|
|
178
|
+
"MUR",
|
|
179
|
+
"MVP",
|
|
180
|
+
"MVR",
|
|
181
|
+
"MWK",
|
|
182
|
+
"MXN",
|
|
183
|
+
"MXP",
|
|
184
|
+
"MXV",
|
|
185
|
+
"MYR",
|
|
186
|
+
"MZE",
|
|
187
|
+
"MZM",
|
|
188
|
+
"MZN",
|
|
189
|
+
"NAD",
|
|
190
|
+
"NGN",
|
|
191
|
+
"NIC",
|
|
192
|
+
"NIO",
|
|
193
|
+
"NLG",
|
|
194
|
+
"NOK",
|
|
195
|
+
"NPR",
|
|
196
|
+
"NZD",
|
|
197
|
+
"OMR",
|
|
198
|
+
"PAB",
|
|
199
|
+
"PEI",
|
|
200
|
+
"PEN",
|
|
201
|
+
"PES",
|
|
202
|
+
"PGK",
|
|
203
|
+
"PHP",
|
|
204
|
+
"PKR",
|
|
205
|
+
"PLN",
|
|
206
|
+
"PLZ",
|
|
207
|
+
"PTE",
|
|
208
|
+
"PYG",
|
|
209
|
+
"QAR",
|
|
210
|
+
"RHD",
|
|
211
|
+
"ROL",
|
|
212
|
+
"RON",
|
|
213
|
+
"RSD",
|
|
214
|
+
"RUB",
|
|
215
|
+
"RUR",
|
|
216
|
+
"RWF",
|
|
217
|
+
"SAR",
|
|
218
|
+
"SBD",
|
|
219
|
+
"SCR",
|
|
220
|
+
"SDD",
|
|
221
|
+
"SDG",
|
|
222
|
+
"SDP",
|
|
223
|
+
"SEK",
|
|
224
|
+
"SGD",
|
|
225
|
+
"SHP",
|
|
226
|
+
"SIT",
|
|
227
|
+
"SKK",
|
|
228
|
+
"SLE",
|
|
229
|
+
"SLL",
|
|
230
|
+
"SOS",
|
|
231
|
+
"SRD",
|
|
232
|
+
"SRG",
|
|
233
|
+
"SSP",
|
|
234
|
+
"STD",
|
|
235
|
+
"STN",
|
|
236
|
+
"SUR",
|
|
237
|
+
"SVC",
|
|
238
|
+
"SYP",
|
|
239
|
+
"SZL",
|
|
240
|
+
"THB",
|
|
241
|
+
"TJR",
|
|
242
|
+
"TJS",
|
|
243
|
+
"TMM",
|
|
244
|
+
"TMT",
|
|
245
|
+
"TND",
|
|
246
|
+
"TOP",
|
|
247
|
+
"TPE",
|
|
248
|
+
"TRL",
|
|
249
|
+
"TRY",
|
|
250
|
+
"TTD",
|
|
251
|
+
"TWD",
|
|
252
|
+
"TZS",
|
|
253
|
+
"UAH",
|
|
254
|
+
"UAK",
|
|
255
|
+
"UGS",
|
|
256
|
+
"UGX",
|
|
257
|
+
"USD",
|
|
258
|
+
"USN",
|
|
259
|
+
"USS",
|
|
260
|
+
"UYI",
|
|
261
|
+
"UYP",
|
|
262
|
+
"UYU",
|
|
263
|
+
"UYW",
|
|
264
|
+
"UZS",
|
|
265
|
+
"VEB",
|
|
266
|
+
"VED",
|
|
267
|
+
"VEF",
|
|
268
|
+
"VES",
|
|
269
|
+
"VND",
|
|
270
|
+
"VNN",
|
|
271
|
+
"VUV",
|
|
272
|
+
"WST",
|
|
273
|
+
"XAF",
|
|
274
|
+
"XAG",
|
|
275
|
+
"XAU",
|
|
276
|
+
"XBA",
|
|
277
|
+
"XBB",
|
|
278
|
+
"XBC",
|
|
279
|
+
"XBD",
|
|
280
|
+
"XCD",
|
|
281
|
+
"XCG",
|
|
282
|
+
"XDR",
|
|
283
|
+
"XEU",
|
|
284
|
+
"XFO",
|
|
285
|
+
"XFU",
|
|
286
|
+
"XOF",
|
|
287
|
+
"XPD",
|
|
288
|
+
"XPF",
|
|
289
|
+
"XPT",
|
|
290
|
+
"XRE",
|
|
291
|
+
"XSU",
|
|
292
|
+
"XTS",
|
|
293
|
+
"XUA",
|
|
294
|
+
"XXX",
|
|
295
|
+
"YDD",
|
|
296
|
+
"YER",
|
|
297
|
+
"YUD",
|
|
298
|
+
"YUM",
|
|
299
|
+
"YUN",
|
|
300
|
+
"YUR",
|
|
301
|
+
"ZAL",
|
|
302
|
+
"ZAR",
|
|
303
|
+
"ZMK",
|
|
304
|
+
"ZMW",
|
|
305
|
+
"ZRN",
|
|
306
|
+
"ZRZ",
|
|
307
|
+
"ZWD",
|
|
308
|
+
"ZWG",
|
|
309
|
+
"ZWL",
|
|
310
|
+
"ZWR"
|
|
311
|
+
];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Calendar } from
|
|
1
|
+
import type { Calendar } from "./calendars.generated.js";
|
|
2
2
|
export declare function getSupportedCalendars(localePrefix?: string): Calendar[];
|
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
import { createMemoizedDateTimeFormat } from
|
|
2
|
-
import { calendars } from
|
|
3
|
-
function isSupportedCalendar(item, locale) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
catch (_a) { }
|
|
12
|
-
return false;
|
|
1
|
+
import { createMemoizedDateTimeFormat } from "@formatjs/ecma402-abstract";
|
|
2
|
+
import { calendars } from "./calendars.generated.js";
|
|
3
|
+
function isSupportedCalendar(item, locale = "en") {
|
|
4
|
+
try {
|
|
5
|
+
const dateTimeFormat = createMemoizedDateTimeFormat(`${locale}-u-ca-${item}`);
|
|
6
|
+
const options = dateTimeFormat.resolvedOptions().calendar;
|
|
7
|
+
if (item !== "gregory" || options !== "gregory") return true;
|
|
8
|
+
} catch {}
|
|
9
|
+
return false;
|
|
13
10
|
}
|
|
14
11
|
export function getSupportedCalendars(localePrefix) {
|
|
15
|
-
|
|
16
|
-
return isSupportedCalendar(calendar, localePrefix);
|
|
17
|
-
});
|
|
12
|
+
return calendars.filter((calendar) => isSupportedCalendar(calendar, localePrefix));
|
|
18
13
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Collation } from
|
|
1
|
+
import type { Collation } from "./collations.generated.js";
|
|
2
2
|
export declare function getSupportedCollations(locale?: string): Collation[];
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import { collations } from
|
|
2
|
-
function isSupported(collation, locale) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
catch (_a) { }
|
|
9
|
-
return false;
|
|
1
|
+
import { collations } from "./collations.generated.js";
|
|
2
|
+
function isSupported(collation, locale = "en") {
|
|
3
|
+
try {
|
|
4
|
+
return Intl.Collator(`${locale}-u-co-${collation}`).resolvedOptions().collation === collation;
|
|
5
|
+
} catch {}
|
|
6
|
+
return false;
|
|
10
7
|
}
|
|
11
8
|
export function getSupportedCollations(locale) {
|
|
12
|
-
|
|
9
|
+
return collations.filter((collation) => isSupported(collation, locale));
|
|
13
10
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Currency } from
|
|
1
|
+
import type { Currency } from "./currencies.generated.js";
|
|
2
2
|
export declare function getSupportedCurrencies(locale?: string): Currency[];
|
|
@@ -1,42 +1,37 @@
|
|
|
1
|
-
import { createMemoizedNumberFormat } from
|
|
2
|
-
import { currencies } from
|
|
3
|
-
function isSupportedCurrency(currency, locale) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
catch (_a) { }
|
|
18
|
-
return false;
|
|
1
|
+
import { createMemoizedNumberFormat } from "@formatjs/ecma402-abstract";
|
|
2
|
+
import { currencies } from "./currencies.generated.js";
|
|
3
|
+
function isSupportedCurrency(currency, locale = "en") {
|
|
4
|
+
try {
|
|
5
|
+
const numberFormat = createMemoizedNumberFormat(locale, {
|
|
6
|
+
style: "currency",
|
|
7
|
+
currencyDisplay: "name",
|
|
8
|
+
currency
|
|
9
|
+
});
|
|
10
|
+
const format = numberFormat.format(123);
|
|
11
|
+
if (format.substring(0, 3) !== currency && format.substring(format.length - 3) !== currency) {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
} catch {}
|
|
15
|
+
return false;
|
|
19
16
|
}
|
|
20
17
|
export function getSupportedCurrencies(locale) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
return supportedCurrencies;
|
|
18
|
+
const ATOZ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
19
|
+
const supportedCurrencies = [];
|
|
20
|
+
for (const currency of currencies) {
|
|
21
|
+
if (currency.length === 3) {
|
|
22
|
+
if (isSupportedCurrency(currency, locale)) {
|
|
23
|
+
supportedCurrencies.push(currency);
|
|
24
|
+
}
|
|
25
|
+
} else if (currency.length === 5 && currency[3] === "~") {
|
|
26
|
+
const start = ATOZ.indexOf(currency[2]);
|
|
27
|
+
const end = ATOZ.indexOf(currency[4]);
|
|
28
|
+
for (let i = start; i <= end; i++) {
|
|
29
|
+
const currentCurrency = currency.substring(0, 2) + ATOZ[i];
|
|
30
|
+
if (isSupportedCurrency(currentCurrency, locale)) {
|
|
31
|
+
supportedCurrencies.push(currentCurrency);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return supportedCurrencies;
|
|
42
37
|
}
|
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
import { createMemoizedNumberFormat } from
|
|
2
|
-
import { numberingSystemNames } from
|
|
3
|
-
function isSupportedNumberingSystem(system, locale) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
catch (_a) { }
|
|
14
|
-
return false;
|
|
1
|
+
import { createMemoizedNumberFormat } from "@formatjs/ecma402-abstract";
|
|
2
|
+
import { numberingSystemNames } from "./numbering-systems.generated.js";
|
|
3
|
+
function isSupportedNumberingSystem(system, locale = "en") {
|
|
4
|
+
try {
|
|
5
|
+
const numberFormat = createMemoizedNumberFormat(`${locale}-u-nu-${system}`);
|
|
6
|
+
const options = numberFormat.resolvedOptions().numberingSystem;
|
|
7
|
+
if (options === system && system === "latn" || numberFormat.format(123) !== "123") {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
} catch {}
|
|
11
|
+
return false;
|
|
15
12
|
}
|
|
16
13
|
export function getSupportedNumberingSystems(locale) {
|
|
17
|
-
|
|
18
|
-
return isSupportedNumberingSystem(numberingSystemName, locale);
|
|
19
|
-
});
|
|
14
|
+
return numberingSystemNames.filter((numberingSystemName) => isSupportedNumberingSystem(numberingSystemName, locale));
|
|
20
15
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Timezone } from
|
|
1
|
+
import type { Timezone } from "./timezones.generated.js";
|
|
2
2
|
export declare function getSupportedTimeZones(locale?: string): Timezone[];
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import { createMemoizedDateTimeFormat } from
|
|
2
|
-
import { timezones } from
|
|
3
|
-
function isSupported(timeZone, locale) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
catch (_a) { }
|
|
10
|
-
return false;
|
|
1
|
+
import { createMemoizedDateTimeFormat } from "@formatjs/ecma402-abstract";
|
|
2
|
+
import { timezones } from "./timezones.generated.js";
|
|
3
|
+
function isSupported(timeZone, locale = "en") {
|
|
4
|
+
try {
|
|
5
|
+
const formatter = createMemoizedDateTimeFormat(locale, { timeZone });
|
|
6
|
+
return formatter.resolvedOptions().timeZone === timeZone;
|
|
7
|
+
} catch {}
|
|
8
|
+
return false;
|
|
11
9
|
}
|
|
12
10
|
export function getSupportedTimeZones(locale) {
|
|
13
|
-
|
|
11
|
+
return timezones.filter((timezone) => isSupported(timezone, locale));
|
|
14
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function getSupportedUnits(locale?: string): (
|
|
1
|
+
export declare function getSupportedUnits(locale?: string): ("degree" | "acre" | "hectare" | "percent" | "bit" | "byte" | "gigabit" | "gigabyte" | "kilobit" | "kilobyte" | "megabit" | "megabyte" | "petabyte" | "terabit" | "terabyte" | "day" | "hour" | "millisecond" | "minute" | "month" | "second" | "week" | "year" | "centimeter" | "foot" | "inch" | "kilometer" | "meter" | "mile-scandinavian" | "mile" | "millimeter" | "yard" | "gram" | "kilogram" | "ounce" | "pound" | "stone" | "celsius" | "fahrenheit" | "fluid-ounce" | "gallon" | "liter" | "milliliter")[];
|