@formatjs/utils 2.1.1 → 2.2.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,169 +1,169 @@
1
1
  // This is a generated file. Do not edit directly.
2
2
  export default {
3
- AFN: 2,
4
- EUR: 2,
5
- ALL: 2,
6
- DZD: 2,
7
- USD: 2,
8
- AOA: 2,
9
- XCD: 2,
10
- XAD: 2,
11
- ARS: 2,
12
- AMD: 2,
13
- AWG: 2,
14
- AUD: 2,
15
- AZN: 2,
16
- BSD: 2,
17
- BHD: 3,
18
- BDT: 2,
19
- BBD: 2,
20
- BYN: 2,
21
- BZD: 2,
22
- XOF: 0,
23
- BMD: 2,
24
- INR: 2,
25
- BTN: 2,
26
- BOB: 2,
27
- BOV: 2,
28
- BAM: 2,
29
- BWP: 2,
30
- NOK: 2,
31
- BRL: 2,
32
- BND: 2,
33
- BGN: 2,
34
- BIF: 0,
35
- CVE: 2,
36
- KHR: 2,
37
- XAF: 0,
38
- CAD: 2,
39
- KYD: 2,
40
- CLP: 0,
41
- CLF: 4,
42
- CNY: 2,
43
- COP: 2,
44
- COU: 2,
45
- KMF: 0,
46
- CDF: 2,
47
- NZD: 2,
48
- CRC: 2,
49
- CUP: 2,
50
- XCG: 2,
51
- CZK: 2,
52
- DKK: 2,
53
- DJF: 0,
54
- DOP: 2,
55
- EGP: 2,
56
- SVC: 2,
57
- ERN: 2,
58
- SZL: 2,
59
- ETB: 2,
60
- FKP: 2,
61
- FJD: 2,
62
- XPF: 0,
63
- GMD: 2,
64
- GEL: 2,
65
- GHS: 2,
66
- GIP: 2,
67
- GTQ: 2,
68
- GBP: 2,
69
- GNF: 0,
70
- GYD: 2,
71
- HTG: 2,
72
- HNL: 2,
73
- HKD: 2,
74
- HUF: 2,
75
- ISK: 0,
76
- IDR: 2,
77
- IRR: 2,
78
- IQD: 3,
79
- ILS: 2,
80
- JMD: 2,
81
- JPY: 0,
82
- JOD: 3,
83
- KZT: 2,
84
- KES: 2,
85
- KPW: 2,
86
- KRW: 0,
87
- KWD: 3,
88
- KGS: 2,
89
- LAK: 2,
90
- LBP: 2,
91
- LSL: 2,
92
- ZAR: 2,
93
- LRD: 2,
94
- LYD: 3,
95
- CHF: 2,
96
- MOP: 2,
97
- MKD: 2,
98
- MGA: 2,
99
- MWK: 2,
100
- MYR: 2,
101
- MVR: 2,
102
- MRU: 2,
103
- MUR: 2,
104
- MXN: 2,
105
- MXV: 2,
106
- MDL: 2,
107
- MNT: 2,
108
- MAD: 2,
109
- MZN: 2,
110
- MMK: 2,
111
- NAD: 2,
112
- NPR: 2,
113
- NIO: 2,
114
- NGN: 2,
115
- OMR: 3,
116
- PKR: 2,
117
- PAB: 2,
118
- PGK: 2,
119
- PYG: 0,
120
- PEN: 2,
121
- PHP: 2,
122
- PLN: 2,
123
- QAR: 2,
124
- RON: 2,
125
- RUB: 2,
126
- RWF: 0,
127
- SHP: 2,
128
- WST: 2,
129
- STN: 2,
130
- SAR: 2,
131
- RSD: 2,
132
- SCR: 2,
133
- SLE: 2,
134
- SGD: 2,
135
- SBD: 2,
136
- SOS: 2,
137
- SSP: 2,
138
- LKR: 2,
139
- SDG: 2,
140
- SRD: 2,
141
- SEK: 2,
142
- CHE: 2,
143
- CHW: 2,
144
- SYP: 2,
145
- TWD: 2,
146
- TJS: 2,
147
- TZS: 2,
148
- THB: 2,
149
- TOP: 2,
150
- TTD: 2,
151
- TND: 3,
152
- TRY: 2,
153
- TMT: 2,
154
- UGX: 0,
155
- UAH: 2,
156
- AED: 2,
157
- USN: 2,
158
- UYU: 2,
159
- UYI: 0,
160
- UYW: 4,
161
- UZS: 2,
162
- VUV: 0,
163
- VES: 2,
164
- VED: 2,
165
- VND: 0,
166
- YER: 2,
167
- ZMW: 2,
168
- ZWG: 2,
3
+ AFN: 2,
4
+ EUR: 2,
5
+ ALL: 2,
6
+ DZD: 2,
7
+ USD: 2,
8
+ AOA: 2,
9
+ XCD: 2,
10
+ XAD: 2,
11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 2,
97
+ MKD: 2,
98
+ MGA: 2,
99
+ MWK: 2,
100
+ MYR: 2,
101
+ MVR: 2,
102
+ MRU: 2,
103
+ MUR: 2,
104
+ MXN: 2,
105
+ MXV: 2,
106
+ MDL: 2,
107
+ MNT: 2,
108
+ MAD: 2,
109
+ MZN: 2,
110
+ MMK: 2,
111
+ NAD: 2,
112
+ NPR: 2,
113
+ NIO: 2,
114
+ NGN: 2,
115
+ OMR: 3,
116
+ PKR: 2,
117
+ PAB: 2,
118
+ PGK: 2,
119
+ PYG: 0,
120
+ PEN: 2,
121
+ PHP: 2,
122
+ PLN: 2,
123
+ QAR: 2,
124
+ RON: 2,
125
+ RUB: 2,
126
+ RWF: 0,
127
+ SHP: 2,
128
+ WST: 2,
129
+ STN: 2,
130
+ SAR: 2,
131
+ RSD: 2,
132
+ SCR: 2,
133
+ SLE: 2,
134
+ SGD: 2,
135
+ SBD: 2,
136
+ SOS: 2,
137
+ SSP: 2,
138
+ LKR: 2,
139
+ SDG: 2,
140
+ SRD: 2,
141
+ SEK: 2,
142
+ CHE: 2,
143
+ CHW: 2,
144
+ SYP: 2,
145
+ TWD: 2,
146
+ TJS: 2,
147
+ TZS: 2,
148
+ THB: 2,
149
+ TOP: 2,
150
+ TTD: 2,
151
+ TND: 3,
152
+ TRY: 2,
153
+ TMT: 2,
154
+ UGX: 0,
155
+ UAH: 2,
156
+ AED: 2,
157
+ USN: 2,
158
+ UYU: 2,
159
+ UYI: 0,
160
+ UYW: 4,
161
+ UZS: 2,
162
+ VUV: 0,
163
+ VES: 2,
164
+ VED: 2,
165
+ VND: 0,
166
+ YER: 2,
167
+ ZMW: 2,
168
+ ZWG: 2
169
169
  };
@@ -1,12 +1,12 @@
1
1
  /**
2
- * Look up default currency for a country code.
3
- * @param countryCode country code (alpha-2)
4
- * @returns default currency code, or USD if not found
5
- */
2
+ * Look up default currency for a country code.
3
+ * @param countryCode country code (alpha-2)
4
+ * @returns default currency code, or USD if not found
5
+ */
6
6
  export declare function defaultCurrency(countryCode?: string): string;
7
7
  /**
8
- * Look up countries using a default currency.
9
- * @param currencyCode currency code (ISO 4217)
10
- * @returns list of country codes (alpha-2)
11
- */
8
+ * Look up countries using a default currency.
9
+ * @param currencyCode currency code (ISO 4217)
10
+ * @returns list of country codes (alpha-2)
11
+ */
12
12
  export declare function countriesUsingDefaultCurrency(currencyCode?: string): string[];
@@ -1,27 +1,27 @@
1
- import { canonicalizeCountryCode } from './countryCodes.js';
2
- import data from './defaultCurrencyData.generated.js';
3
- var COUNTRIES_BY_DEFAULT_CURRENCY = Object.keys(data).reduce(function (acc, countryCode) {
4
- var currencyCode = data[countryCode];
5
- if (!acc[currencyCode]) {
6
- acc[currencyCode] = [];
7
- }
8
- acc[currencyCode].push(countryCode);
9
- return acc;
1
+ import { canonicalizeCountryCode } from "./countryCodes.js";
2
+ import data from "./defaultCurrencyData.generated.js";
3
+ const COUNTRIES_BY_DEFAULT_CURRENCY = Object.keys(data).reduce((acc, countryCode) => {
4
+ const currencyCode = data[countryCode];
5
+ if (!acc[currencyCode]) {
6
+ acc[currencyCode] = [];
7
+ }
8
+ acc[currencyCode].push(countryCode);
9
+ return acc;
10
10
  }, {});
11
11
  /**
12
- * Look up default currency for a country code.
13
- * @param countryCode country code (alpha-2)
14
- * @returns default currency code, or USD if not found
15
- */
12
+ * Look up default currency for a country code.
13
+ * @param countryCode country code (alpha-2)
14
+ * @returns default currency code, or USD if not found
15
+ */
16
16
  export function defaultCurrency(countryCode) {
17
- countryCode = canonicalizeCountryCode(countryCode);
18
- return ((countryCode && countryCode in data && data[countryCode]) || 'USD');
17
+ countryCode = canonicalizeCountryCode(countryCode);
18
+ return countryCode && countryCode in data && data[countryCode] || "USD";
19
19
  }
20
20
  /**
21
- * Look up countries using a default currency.
22
- * @param currencyCode currency code (ISO 4217)
23
- * @returns list of country codes (alpha-2)
24
- */
21
+ * Look up countries using a default currency.
22
+ * @param currencyCode currency code (ISO 4217)
23
+ * @returns list of country codes (alpha-2)
24
+ */
25
25
  export function countriesUsingDefaultCurrency(currencyCode) {
26
- return COUNTRIES_BY_DEFAULT_CURRENCY[currencyCode || 'USD'] || [];
26
+ return COUNTRIES_BY_DEFAULT_CURRENCY[currencyCode || "USD"] || [];
27
27
  }