@formatjs/intl-numberformat 7.2.4 → 7.3.1
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.js +1 -1
- package/lib/should-polyfill.d.ts +1 -1
- package/lib/should-polyfill.d.ts.map +1 -1
- package/lib/should-polyfill.js +7 -2
- package/lib/src/core.js +2 -2
- package/lib/supported-locales.d.ts +2 -0
- package/lib/supported-locales.d.ts.map +1 -0
- package/lib/supported-locales.js +2 -0
- package/package.json +3 -2
- package/polyfill-force.js +3 -3
- package/polyfill.iife.js +51 -43
- package/polyfill.js +4 -4
- package/should-polyfill.d.ts +1 -1
- package/should-polyfill.d.ts.map +1 -1
- package/should-polyfill.js +7 -2
- package/src/core.js +16 -16
- package/supported-locales.d.ts +2 -0
- package/supported-locales.d.ts.map +1 -0
- package/supported-locales.js +5 -0
package/index.js
CHANGED
package/lib/should-polyfill.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function shouldPolyfill(locale?: string |
|
|
1
|
+
export declare function shouldPolyfill(locale?: string): string | undefined;
|
|
2
2
|
//# sourceMappingURL=should-polyfill.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"should-polyfill.d.ts","sourceRoot":"","sources":["../../../../../../packages/intl-numberformat/should-polyfill.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"should-polyfill.d.ts","sourceRoot":"","sources":["../../../../../../packages/intl-numberformat/should-polyfill.ts"],"names":[],"mappings":"AAgDA,wBAAgB,cAAc,CAAC,MAAM,SAAO,sBAU3C"}
|
package/lib/should-polyfill.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { match } from '@formatjs/intl-localematcher';
|
|
2
|
+
import { supportedLocales } from './supported-locales';
|
|
1
3
|
/**
|
|
2
4
|
* Check if this is old Node that only supports en
|
|
3
5
|
* @returns
|
|
@@ -40,9 +42,12 @@ function supportedLocalesOf(locale) {
|
|
|
40
42
|
return Intl.NumberFormat.supportedLocalesOf(locales).length === locales.length;
|
|
41
43
|
}
|
|
42
44
|
export function shouldPolyfill(locale) {
|
|
43
|
-
|
|
45
|
+
if (locale === void 0) { locale = 'en'; }
|
|
46
|
+
if (typeof Intl === 'undefined' ||
|
|
44
47
|
!('NumberFormat' in Intl) ||
|
|
45
48
|
!supportsES2020() ||
|
|
46
49
|
onlySupportsEn() ||
|
|
47
|
-
!supportedLocalesOf(locale))
|
|
50
|
+
!supportedLocalesOf(locale)) {
|
|
51
|
+
return locale ? match([locale], supportedLocales, 'en') : undefined;
|
|
52
|
+
}
|
|
48
53
|
}
|
package/lib/src/core.js
CHANGED
|
@@ -41,7 +41,7 @@ export var NumberFormat = function (locales, options) {
|
|
|
41
41
|
var internalSlots = getInternalSlots(this);
|
|
42
42
|
var dataLocale = internalSlots.dataLocale;
|
|
43
43
|
var dataLocaleData = NumberFormat.localeData[dataLocale];
|
|
44
|
-
invariant(dataLocaleData !== undefined, "Cannot load locale-dependent data for "
|
|
44
|
+
invariant(dataLocaleData !== undefined, "Cannot load locale-dependent data for ".concat(dataLocale, "."));
|
|
45
45
|
internalSlots.pl = new Intl.PluralRules(dataLocale, {
|
|
46
46
|
minimumFractionDigits: internalSlots.minimumFractionDigits,
|
|
47
47
|
maximumFractionDigits: internalSlots.maximumFractionDigits,
|
|
@@ -169,7 +169,7 @@ NumberFormat.__addLocaleData = function __addLocaleData() {
|
|
|
169
169
|
NumberFormat.__addUnitData = function __addUnitData(locale, unitsData) {
|
|
170
170
|
var _a = NumberFormat.localeData, _b = locale, existingData = _a[_b];
|
|
171
171
|
if (!existingData) {
|
|
172
|
-
throw new Error("Locale data for \""
|
|
172
|
+
throw new Error("Locale data for \"".concat(locale, "\" has not been loaded in NumberFormat. \nPlease __addLocaleData before adding additional unit data"));
|
|
173
173
|
}
|
|
174
174
|
for (var unit in unitsData.simple) {
|
|
175
175
|
existingData.units.simple[unit] = unitsData.simple[unit];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supported-locales.d.ts","sourceRoot":"","sources":["../../../../../../packages/intl-numberformat/supported-locales.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,gBAAgB,EAAE,MAAM,EAA+nI,CAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// This file is generated from supported-locales-gen.ts
|
|
2
|
+
export var supportedLocales = ["af-NA", "af", "agq", "ak", "am", "ar-AE", "ar-BH", "ar-DJ", "ar-DZ", "ar-EG", "ar-EH", "ar-ER", "ar-IL", "ar-IQ", "ar-JO", "ar-KM", "ar-KW", "ar-LB", "ar-LY", "ar-MA", "ar-MR", "ar-OM", "ar-PS", "ar-QA", "ar-SA", "ar-SD", "ar-SO", "ar-SS", "ar-SY", "ar-TD", "ar-TN", "ar-YE", "ar", "as", "asa", "ast", "az-Cyrl", "az-Latn", "az", "bas", "be", "bem", "bez", "bg", "bm", "bn-IN", "bn", "bo-IN", "bo", "br", "brx", "bs-Cyrl", "bs-Latn", "bs", "ca-AD", "ca-ES-VALENCIA", "ca-FR", "ca-IT", "ca", "ccp-IN", "ccp", "ce", "ceb", "cgg", "chr", "ckb-IR", "ckb", "cs", "cy", "da-GL", "da", "dav", "de-AT", "de-BE", "de-CH", "de-IT", "de-LI", "de-LU", "de", "dje", "doi", "dsb", "dua", "dyo", "dz", "ebu", "ee-TG", "ee", "el-CY", "el", "en-001", "en-150", "en-AE", "en-AG", "en-AI", "en-AS", "en-AT", "en-AU", "en-BB", "en-BE", "en-BI", "en-BM", "en-BS", "en-BW", "en-BZ", "en-CA", "en-CC", "en-CH", "en-CK", "en-CM", "en-CX", "en-CY", "en-DE", "en-DG", "en-DK", "en-DM", "en-ER", "en-FI", "en-FJ", "en-FK", "en-FM", "en-GB", "en-GD", "en-GG", "en-GH", "en-GI", "en-GM", "en-GU", "en-GY", "en-HK", "en-IE", "en-IL", "en-IM", "en-IN", "en-IO", "en-JE", "en-JM", "en-KE", "en-KI", "en-KN", "en-KY", "en-LC", "en-LR", "en-LS", "en-MG", "en-MH", "en-MO", "en-MP", "en-MS", "en-MT", "en-MU", "en-MW", "en-MY", "en-NA", "en-NF", "en-NG", "en-NL", "en-NR", "en-NU", "en-NZ", "en-PG", "en-PH", "en-PK", "en-PN", "en-PR", "en-PW", "en-RW", "en-SB", "en-SC", "en-SD", "en-SE", "en-SG", "en-SH", "en-SI", "en-SL", "en-SS", "en-SX", "en-SZ", "en-TC", "en-TK", "en-TO", "en-TT", "en-TV", "en-TZ", "en-UG", "en-UM", "en-US-POSIX", "en-VC", "en-VG", "en-VI", "en-VU", "en-WS", "en-ZA", "en-ZM", "en-ZW", "en", "eo", "es-419", "es-AR", "es-BO", "es-BR", "es-BZ", "es-CL", "es-CO", "es-CR", "es-CU", "es-DO", "es-EA", "es-EC", "es-GQ", "es-GT", "es-HN", "es-IC", "es-MX", "es-NI", "es-PA", "es-PE", "es-PH", "es-PR", "es-PY", "es-SV", "es-US", "es-UY", "es-VE", "es", "et", "eu", "ewo", "fa-AF", "fa", "ff-Adlm-BF", "ff-Adlm-CM", "ff-Adlm-GH", "ff-Adlm-GM", "ff-Adlm-GW", "ff-Adlm-LR", "ff-Adlm-MR", "ff-Adlm-NE", "ff-Adlm-NG", "ff-Adlm-SL", "ff-Adlm-SN", "ff-Adlm", "ff-Latn-BF", "ff-Latn-CM", "ff-Latn-GH", "ff-Latn-GM", "ff-Latn-GN", "ff-Latn-GW", "ff-Latn-LR", "ff-Latn-MR", "ff-Latn-NE", "ff-Latn-NG", "ff-Latn-SL", "ff-Latn", "ff", "fi", "fil", "fo-DK", "fo", "fr-BE", "fr-BF", "fr-BI", "fr-BJ", "fr-BL", "fr-CA", "fr-CD", "fr-CF", "fr-CG", "fr-CH", "fr-CI", "fr-CM", "fr-DJ", "fr-DZ", "fr-GA", "fr-GF", "fr-GN", "fr-GP", "fr-GQ", "fr-HT", "fr-KM", "fr-LU", "fr-MA", "fr-MC", "fr-MF", "fr-MG", "fr-ML", "fr-MQ", "fr-MR", "fr-MU", "fr-NC", "fr-NE", "fr-PF", "fr-PM", "fr-RE", "fr-RW", "fr-SC", "fr-SN", "fr-SY", "fr-TD", "fr-TG", "fr-TN", "fr-VU", "fr-WF", "fr-YT", "fr", "fur", "fy", "ga-GB", "ga", "gd", "gl", "gsw-FR", "gsw-LI", "gsw", "gu", "guz", "gv", "ha-GH", "ha-NE", "ha", "haw", "he", "hi", "hr-BA", "hr", "hsb", "hu", "hy", "ia", "id", "ig", "ii", "is", "it-CH", "it-SM", "it-VA", "it", "ja", "jgo", "jmc", "jv", "ka", "kab", "kam", "kde", "kea", "khq", "ki", "kk", "kkj", "kl", "kln", "km", "kn", "ko-KP", "ko", "kok", "ks-Arab", "ks", "ksb", "ksf", "ksh", "ku", "kw", "ky", "lag", "lb", "lg", "lkt", "ln-AO", "ln-CF", "ln-CG", "ln", "lo", "lrc-IQ", "lrc", "lt", "lu", "luo", "luy", "lv", "mai", "mas-TZ", "mas", "mer", "mfe", "mg", "mgh", "mgo", "mi", "mk", "ml", "mn", "mni-Beng", "mni", "mr", "ms-BN", "ms-ID", "ms-SG", "ms", "mt", "mua", "my", "mzn", "naq", "nb-SJ", "nb", "nd", "nds-NL", "nds", "ne-IN", "ne", "nl-AW", "nl-BE", "nl-BQ", "nl-CW", "nl-SR", "nl-SX", "nl", "nmg", "nn", "nnh", "no", "nus", "nyn", "om-KE", "om", "or", "os-RU", "os", "pa-Arab", "pa-Guru", "pa", "pcm", "pl", "ps-PK", "ps", "pt-AO", "pt-CH", "pt-CV", "pt-GQ", "pt-GW", "pt-LU", "pt-MO", "pt-MZ", "pt-PT", "pt-ST", "pt-TL", "pt", "qu-BO", "qu-EC", "qu", "rm", "rn", "ro-MD", "ro", "rof", "ru-BY", "ru-KG", "ru-KZ", "ru-MD", "ru-UA", "ru", "rw", "rwk", "sa", "sah", "saq", "sat-Olck", "sat", "sbp", "sd-Arab", "sd-Deva", "sd", "se-FI", "se-SE", "se", "seh", "ses", "sg", "shi-Latn", "shi-Tfng", "shi", "si", "sk", "sl", "smn", "sn", "so-DJ", "so-ET", "so-KE", "so", "sq-MK", "sq-XK", "sq", "sr-Cyrl-BA", "sr-Cyrl-ME", "sr-Cyrl-XK", "sr-Cyrl", "sr-Latn-BA", "sr-Latn-ME", "sr-Latn-XK", "sr-Latn", "sr", "su-Latn", "su", "sv-AX", "sv-FI", "sv", "sw-CD", "sw-KE", "sw-UG", "sw", "ta-LK", "ta-MY", "ta-SG", "ta", "te", "teo-KE", "teo", "tg", "th", "ti-ER", "ti", "tk", "to", "tr-CY", "tr", "tt", "twq", "tzm", "ug", "uk", "ur-IN", "ur", "uz-Arab", "uz-Cyrl", "uz-Latn", "uz", "vai-Latn", "vai-Vaii", "vai", "vi", "vun", "wae", "wo", "xh", "xog", "yav", "yi", "yo-BJ", "yo", "yue-Hans", "yue-Hant", "yue", "zgh", "zh-Hans-HK", "zh-Hans-MO", "zh-Hans-SG", "zh-Hans", "zh-Hant-HK", "zh-Hant-MO", "zh-Hant", "zh", "zu"];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formatjs/intl-numberformat",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.3.1",
|
|
4
4
|
"description": "Ponyfill for ES2020 Intl.NumberFormat",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"polyfill",
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
"url": "git+https://github.com/formatjs/formatjs.git"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@formatjs/ecma402-abstract": "1.
|
|
25
|
+
"@formatjs/ecma402-abstract": "1.11.1",
|
|
26
|
+
"@formatjs/intl-localematcher": "0.2.22",
|
|
26
27
|
"tslib": "^2.1.0"
|
|
27
28
|
},
|
|
28
29
|
"bugs": {
|
package/polyfill-force.js
CHANGED
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
var core_1 = require("./src/core");
|
|
4
4
|
var to_locale_string_1 = require("./src/to_locale_string");
|
|
5
5
|
var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
|
|
6
|
-
ecma402_abstract_1.defineProperty(Intl, 'NumberFormat', { value: core_1.NumberFormat });
|
|
7
|
-
ecma402_abstract_1.defineProperty(Number.prototype, 'toLocaleString', {
|
|
6
|
+
(0, ecma402_abstract_1.defineProperty)(Intl, 'NumberFormat', { value: core_1.NumberFormat });
|
|
7
|
+
(0, ecma402_abstract_1.defineProperty)(Number.prototype, 'toLocaleString', {
|
|
8
8
|
value: function toLocaleString(locales, options) {
|
|
9
|
-
return to_locale_string_1.toLocaleString(this, locales, options);
|
|
9
|
+
return (0, to_locale_string_1.toLocaleString)(this, locales, options);
|
|
10
10
|
},
|
|
11
11
|
});
|
package/polyfill.iife.js
CHANGED
|
@@ -8,11 +8,8 @@
|
|
|
8
8
|
var __markAsModule = function(target) {
|
|
9
9
|
return __defProp(target, "__esModule", { value: true });
|
|
10
10
|
};
|
|
11
|
-
var __require = typeof require !== "undefined" ? require : function(x) {
|
|
12
|
-
throw new Error('Dynamic require of "' + x + '" is not supported');
|
|
13
|
-
};
|
|
14
11
|
var __commonJS = function(cb, mod) {
|
|
15
|
-
return function
|
|
12
|
+
return function __require() {
|
|
16
13
|
return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
17
14
|
};
|
|
18
15
|
};
|
|
@@ -91,7 +88,7 @@
|
|
|
91
88
|
for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
|
|
92
89
|
var locale = requestedLocales_1[_i];
|
|
93
90
|
var noExtensionLocale = locale.replace(utils_1.UNICODE_EXTENSION_SEQUENCE_REGEX, "");
|
|
94
|
-
var availableLocale = BestAvailableLocale_1.BestAvailableLocale(availableLocales, noExtensionLocale);
|
|
91
|
+
var availableLocale = (0, BestAvailableLocale_1.BestAvailableLocale)(availableLocales, noExtensionLocale);
|
|
95
92
|
if (availableLocale) {
|
|
96
93
|
result.locale = availableLocale;
|
|
97
94
|
if (locale !== noExtensionLocale) {
|
|
@@ -116,10 +113,10 @@
|
|
|
116
113
|
var BestAvailableLocale_1 = require_BestAvailableLocale();
|
|
117
114
|
var utils_1 = require_utils();
|
|
118
115
|
function BestFitMatcher(availableLocales, requestedLocales, getDefaultLocale) {
|
|
119
|
-
var minimizedAvailableLocaleMap =
|
|
120
|
-
|
|
121
|
-
return
|
|
122
|
-
}
|
|
116
|
+
var minimizedAvailableLocaleMap = {};
|
|
117
|
+
availableLocales.forEach(function(l2) {
|
|
118
|
+
return minimizedAvailableLocaleMap[l2] = l2;
|
|
119
|
+
});
|
|
123
120
|
var minimizedAvailableLocales = new Set();
|
|
124
121
|
availableLocales.forEach(function(locale2) {
|
|
125
122
|
var minimizedLocale = new Intl.Locale(locale2).minimize().toString();
|
|
@@ -148,7 +145,7 @@
|
|
|
148
145
|
foundLocale = minimizedRequestedLocale;
|
|
149
146
|
break;
|
|
150
147
|
}
|
|
151
|
-
foundLocale = BestAvailableLocale_1.BestAvailableLocale(minimizedAvailableLocales, maximizedRequestedLocale);
|
|
148
|
+
foundLocale = (0, BestAvailableLocale_1.BestAvailableLocale)(minimizedAvailableLocales, maximizedRequestedLocale);
|
|
152
149
|
}
|
|
153
150
|
return {
|
|
154
151
|
locale: foundLocale && minimizedAvailableLocaleMap[foundLocale] || getDefaultLocale()
|
|
@@ -166,9 +163,9 @@
|
|
|
166
163
|
exports.UnicodeExtensionValue = void 0;
|
|
167
164
|
var utils_1 = require_utils();
|
|
168
165
|
function UnicodeExtensionValue(extension, key) {
|
|
169
|
-
utils_1.invariant(key.length === 2, "key must have 2 elements");
|
|
166
|
+
(0, utils_1.invariant)(key.length === 2, "key must have 2 elements");
|
|
170
167
|
var size = extension.length;
|
|
171
|
-
var searchValue = "-"
|
|
168
|
+
var searchValue = "-".concat(key, "-");
|
|
172
169
|
var pos = extension.indexOf(searchValue);
|
|
173
170
|
if (pos !== -1) {
|
|
174
171
|
var start = pos + 4;
|
|
@@ -195,7 +192,7 @@
|
|
|
195
192
|
}
|
|
196
193
|
return extension.slice(start, end);
|
|
197
194
|
}
|
|
198
|
-
searchValue = "-"
|
|
195
|
+
searchValue = "-".concat(key);
|
|
199
196
|
pos = extension.indexOf(searchValue);
|
|
200
197
|
if (pos !== -1 && pos + 3 === size) {
|
|
201
198
|
return "";
|
|
@@ -220,40 +217,40 @@
|
|
|
220
217
|
var matcher = options.localeMatcher;
|
|
221
218
|
var r;
|
|
222
219
|
if (matcher === "lookup") {
|
|
223
|
-
r = LookupMatcher_1.LookupMatcher(availableLocales, requestedLocales, getDefaultLocale);
|
|
220
|
+
r = (0, LookupMatcher_1.LookupMatcher)(availableLocales, requestedLocales, getDefaultLocale);
|
|
224
221
|
} else {
|
|
225
|
-
r = BestFitMatcher_1.BestFitMatcher(availableLocales, requestedLocales, getDefaultLocale);
|
|
222
|
+
r = (0, BestFitMatcher_1.BestFitMatcher)(availableLocales, requestedLocales, getDefaultLocale);
|
|
226
223
|
}
|
|
227
224
|
var foundLocale = r.locale;
|
|
228
225
|
var result = { locale: "", dataLocale: foundLocale };
|
|
229
226
|
var supportedExtension = "-u";
|
|
230
227
|
for (var _i = 0, relevantExtensionKeys_1 = relevantExtensionKeys; _i < relevantExtensionKeys_1.length; _i++) {
|
|
231
228
|
var key = relevantExtensionKeys_1[_i];
|
|
232
|
-
utils_1.invariant(foundLocale in localeData, "Missing locale data for "
|
|
229
|
+
(0, utils_1.invariant)(foundLocale in localeData, "Missing locale data for ".concat(foundLocale));
|
|
233
230
|
var foundLocaleData = localeData[foundLocale];
|
|
234
|
-
utils_1.invariant(typeof foundLocaleData === "object" && foundLocaleData !== null, "locale data "
|
|
231
|
+
(0, utils_1.invariant)(typeof foundLocaleData === "object" && foundLocaleData !== null, "locale data ".concat(key, " must be an object"));
|
|
235
232
|
var keyLocaleData = foundLocaleData[key];
|
|
236
|
-
utils_1.invariant(Array.isArray(keyLocaleData), "keyLocaleData for "
|
|
233
|
+
(0, utils_1.invariant)(Array.isArray(keyLocaleData), "keyLocaleData for ".concat(key, " must be an array"));
|
|
237
234
|
var value = keyLocaleData[0];
|
|
238
|
-
utils_1.invariant(typeof value === "string" || value === null, "value must be string or null but got "
|
|
235
|
+
(0, utils_1.invariant)(typeof value === "string" || value === null, "value must be string or null but got ".concat(typeof value, " in key ").concat(key));
|
|
239
236
|
var supportedExtensionAddition = "";
|
|
240
237
|
if (r.extension) {
|
|
241
|
-
var requestedValue = UnicodeExtensionValue_1.UnicodeExtensionValue(r.extension, key);
|
|
238
|
+
var requestedValue = (0, UnicodeExtensionValue_1.UnicodeExtensionValue)(r.extension, key);
|
|
242
239
|
if (requestedValue !== void 0) {
|
|
243
240
|
if (requestedValue !== "") {
|
|
244
241
|
if (~keyLocaleData.indexOf(requestedValue)) {
|
|
245
242
|
value = requestedValue;
|
|
246
|
-
supportedExtensionAddition = "-"
|
|
243
|
+
supportedExtensionAddition = "-".concat(key, "-").concat(value);
|
|
247
244
|
}
|
|
248
245
|
} else if (~requestedValue.indexOf("true")) {
|
|
249
246
|
value = "true";
|
|
250
|
-
supportedExtensionAddition = "-"
|
|
247
|
+
supportedExtensionAddition = "-".concat(key);
|
|
251
248
|
}
|
|
252
249
|
}
|
|
253
250
|
}
|
|
254
251
|
if (key in options) {
|
|
255
252
|
var optionsValue = options[key];
|
|
256
|
-
utils_1.invariant(typeof optionsValue === "string" || typeof optionsValue === "undefined" || optionsValue === null, "optionsValue must be String, Undefined or Null");
|
|
253
|
+
(0, utils_1.invariant)(typeof optionsValue === "string" || typeof optionsValue === "undefined" || optionsValue === null, "optionsValue must be String, Undefined or Null");
|
|
257
254
|
if (~keyLocaleData.indexOf(optionsValue)) {
|
|
258
255
|
if (optionsValue !== value) {
|
|
259
256
|
value = optionsValue;
|
|
@@ -295,7 +292,7 @@
|
|
|
295
292
|
for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
|
|
296
293
|
var locale = requestedLocales_1[_i];
|
|
297
294
|
var noExtensionLocale = locale.replace(utils_1.UNICODE_EXTENSION_SEQUENCE_REGEX, "");
|
|
298
|
-
var availableLocale = BestAvailableLocale_1.BestAvailableLocale(availableLocales, noExtensionLocale);
|
|
295
|
+
var availableLocale = (0, BestAvailableLocale_1.BestAvailableLocale)(availableLocales, noExtensionLocale);
|
|
299
296
|
if (availableLocale) {
|
|
300
297
|
subset.push(availableLocale);
|
|
301
298
|
}
|
|
@@ -313,18 +310,18 @@
|
|
|
313
310
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
314
311
|
exports.ResolveLocale = exports.LookupSupportedLocales = exports.match = void 0;
|
|
315
312
|
var ResolveLocale_1 = require_ResolveLocale();
|
|
316
|
-
function
|
|
313
|
+
function match2(requestedLocales, availableLocales, defaultLocale, opts) {
|
|
317
314
|
var locales = availableLocales.reduce(function(all, l) {
|
|
318
315
|
all.add(l);
|
|
319
316
|
return all;
|
|
320
317
|
}, new Set());
|
|
321
|
-
return ResolveLocale_1.ResolveLocale(locales, requestedLocales, {
|
|
318
|
+
return (0, ResolveLocale_1.ResolveLocale)(locales, requestedLocales, {
|
|
322
319
|
localeMatcher: (opts === null || opts === void 0 ? void 0 : opts.algorithm) || "best fit"
|
|
323
320
|
}, [], {}, function() {
|
|
324
321
|
return defaultLocale;
|
|
325
322
|
}).locale;
|
|
326
323
|
}
|
|
327
|
-
exports.match =
|
|
324
|
+
exports.match = match2;
|
|
328
325
|
var LookupSupportedLocales_1 = require_LookupSupportedLocales();
|
|
329
326
|
Object.defineProperty(exports, "LookupSupportedLocales", { enumerable: true, get: function() {
|
|
330
327
|
return LookupSupportedLocales_1.LookupSupportedLocales;
|
|
@@ -426,7 +423,7 @@
|
|
|
426
423
|
if (val !== void 0) {
|
|
427
424
|
val = Number(val);
|
|
428
425
|
if (isNaN(val) || val < min || val > max) {
|
|
429
|
-
throw new RangeError(val
|
|
426
|
+
throw new RangeError("".concat(val, " is outside of range [").concat(min, ", ").concat(max, "]"));
|
|
430
427
|
}
|
|
431
428
|
return Math.floor(val);
|
|
432
429
|
}
|
|
@@ -458,7 +455,7 @@
|
|
|
458
455
|
if (values !== void 0 && !values.filter(function(val) {
|
|
459
456
|
return val == value;
|
|
460
457
|
}).length) {
|
|
461
|
-
throw new RangeError(value
|
|
458
|
+
throw new RangeError("".concat(value, " is not within ").concat(values.join(", ")));
|
|
462
459
|
}
|
|
463
460
|
return value;
|
|
464
461
|
}
|
|
@@ -674,10 +671,10 @@
|
|
|
674
671
|
m = m + repeat("0", e - p + 1);
|
|
675
672
|
int = e + 1;
|
|
676
673
|
} else if (e >= 0) {
|
|
677
|
-
m = m.slice(0, e + 1)
|
|
674
|
+
m = "".concat(m.slice(0, e + 1), ".").concat(m.slice(e + 1));
|
|
678
675
|
int = e + 1;
|
|
679
676
|
} else {
|
|
680
|
-
m = "0."
|
|
677
|
+
m = "0.".concat(repeat("0", -e - 1)).concat(m);
|
|
681
678
|
int = 1;
|
|
682
679
|
}
|
|
683
680
|
if (m.indexOf(".") >= 0 && maxPrecision > minPrecision) {
|
|
@@ -720,7 +717,7 @@
|
|
|
720
717
|
}
|
|
721
718
|
var a = m.slice(0, k - f);
|
|
722
719
|
var b = m.slice(k - f);
|
|
723
|
-
m = a
|
|
720
|
+
m = "".concat(a, ".").concat(b);
|
|
724
721
|
int = a.length;
|
|
725
722
|
} else {
|
|
726
723
|
int = m.length;
|
|
@@ -815,8 +812,8 @@
|
|
|
815
812
|
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]/;
|
|
816
813
|
|
|
817
814
|
// bazel-out/darwin-fastbuild/bin/packages/ecma402-abstract/lib/NumberFormat/format_to_parts.js
|
|
818
|
-
var CARET_S_UNICODE_REGEX = new RegExp("^"
|
|
819
|
-
var S_DOLLAR_UNICODE_REGEX = new RegExp(S_UNICODE_REGEX.source
|
|
815
|
+
var CARET_S_UNICODE_REGEX = new RegExp("^".concat(S_UNICODE_REGEX.source));
|
|
816
|
+
var S_DOLLAR_UNICODE_REGEX = new RegExp("".concat(S_UNICODE_REGEX.source, "$"));
|
|
820
817
|
var CLDR_NUMBER_PATTERN = /[#0](?:[\.,][#0]+)*/g;
|
|
821
818
|
function formatToParts(numberResult, data, pl, options) {
|
|
822
819
|
var sign = numberResult.sign, exponent = numberResult.exponent, magnitude = numberResult.magnitude;
|
|
@@ -866,11 +863,11 @@
|
|
|
866
863
|
var currencyData = data.numbers.currency[numberingSystem] || data.numbers.currency[defaultNumberingSystem];
|
|
867
864
|
var afterCurrency = currencyData.currencySpacing.afterInsertBetween;
|
|
868
865
|
if (afterCurrency && !S_DOLLAR_UNICODE_REGEX.test(nonNameCurrencyPart)) {
|
|
869
|
-
numberPattern = numberPattern.replace("\xA4{0}", "\xA4"
|
|
866
|
+
numberPattern = numberPattern.replace("\xA4{0}", "\xA4".concat(afterCurrency, "{0}"));
|
|
870
867
|
}
|
|
871
868
|
var beforeCurrency = currencyData.currencySpacing.beforeInsertBetween;
|
|
872
869
|
if (beforeCurrency && !CARET_S_UNICODE_REGEX.test(nonNameCurrencyPart)) {
|
|
873
|
-
numberPattern = numberPattern.replace("{0}\xA4", "{0}"
|
|
870
|
+
numberPattern = numberPattern.replace("{0}\xA4", "{0}".concat(beforeCurrency, "\xA4"));
|
|
874
871
|
}
|
|
875
872
|
}
|
|
876
873
|
var numberPatternParts = numberPattern.split(/({c:[^}]+}|\{0\}|[¤%\-\+])/g);
|
|
@@ -1060,7 +1057,7 @@
|
|
|
1060
1057
|
}
|
|
1061
1058
|
function getPatternForSign(pattern, sign) {
|
|
1062
1059
|
if (pattern.indexOf(";") < 0) {
|
|
1063
|
-
pattern = pattern
|
|
1060
|
+
pattern = "".concat(pattern, ";-").concat(pattern);
|
|
1064
1061
|
}
|
|
1065
1062
|
var _a = pattern.split(";"), zeroPattern = _a[0], negativePattern = _a[1];
|
|
1066
1063
|
switch (sign) {
|
|
@@ -1069,7 +1066,7 @@
|
|
|
1069
1066
|
case -1:
|
|
1070
1067
|
return negativePattern;
|
|
1071
1068
|
default:
|
|
1072
|
-
return negativePattern.indexOf("-") >= 0 ? negativePattern.replace(/-/g, "+") : "+"
|
|
1069
|
+
return negativePattern.indexOf("-") >= 0 ? negativePattern.replace(/-/g, "+") : "+".concat(zeroPattern);
|
|
1073
1070
|
}
|
|
1074
1071
|
}
|
|
1075
1072
|
function getCompactDisplayPattern(numberResult, pl, data, style, compactDisplay, currencyDisplay, numberingSystem) {
|
|
@@ -1258,12 +1255,12 @@
|
|
|
1258
1255
|
opt.localeMatcher = matcher;
|
|
1259
1256
|
var numberingSystem = GetOption(options, "numberingSystem", "string", void 0, void 0);
|
|
1260
1257
|
if (numberingSystem !== void 0 && numberingSystemNames2.indexOf(numberingSystem) < 0) {
|
|
1261
|
-
throw RangeError("Invalid numberingSystems: "
|
|
1258
|
+
throw RangeError("Invalid numberingSystems: ".concat(numberingSystem));
|
|
1262
1259
|
}
|
|
1263
1260
|
opt.nu = numberingSystem;
|
|
1264
1261
|
var r = (0, import_intl_localematcher.ResolveLocale)(availableLocales, requestedLocales, opt, ["nu"], localeData, getDefaultLocale);
|
|
1265
1262
|
var dataLocaleData = localeData[r.dataLocale];
|
|
1266
|
-
invariant(!!dataLocaleData, "Missing locale data for "
|
|
1263
|
+
invariant(!!dataLocaleData, "Missing locale data for ".concat(r.dataLocale));
|
|
1267
1264
|
var internalSlots = getInternalSlots2(nf);
|
|
1268
1265
|
internalSlots.locale = r.locale;
|
|
1269
1266
|
internalSlots.dataLocale = r.dataLocale;
|
|
@@ -1402,7 +1399,7 @@
|
|
|
1402
1399
|
var internalSlots = getInternalSlots(this);
|
|
1403
1400
|
var dataLocale = internalSlots.dataLocale;
|
|
1404
1401
|
var dataLocaleData = NumberFormat.localeData[dataLocale];
|
|
1405
|
-
invariant(dataLocaleData !== void 0, "Cannot load locale-dependent data for "
|
|
1402
|
+
invariant(dataLocaleData !== void 0, "Cannot load locale-dependent data for ".concat(dataLocale, "."));
|
|
1406
1403
|
internalSlots.pl = new Intl.PluralRules(dataLocale, {
|
|
1407
1404
|
minimumFractionDigits: internalSlots.minimumFractionDigits,
|
|
1408
1405
|
maximumFractionDigits: internalSlots.maximumFractionDigits,
|
|
@@ -1511,7 +1508,7 @@
|
|
|
1511
1508
|
NumberFormat.__addUnitData = function __addUnitData(locale, unitsData) {
|
|
1512
1509
|
var _a = NumberFormat.localeData, _b = locale, existingData = _a[_b];
|
|
1513
1510
|
if (!existingData) {
|
|
1514
|
-
throw new Error('Locale data for "'
|
|
1511
|
+
throw new Error('Locale data for "'.concat(locale, '" has not been loaded in NumberFormat. \nPlease __addLocaleData before adding additional unit data'));
|
|
1515
1512
|
}
|
|
1516
1513
|
for (var unit in unitsData.simple) {
|
|
1517
1514
|
existingData.units.simple[unit] = unitsData.simple[unit];
|
|
@@ -1569,6 +1566,12 @@
|
|
|
1569
1566
|
return numberFormat.format(x);
|
|
1570
1567
|
}
|
|
1571
1568
|
|
|
1569
|
+
// bazel-out/darwin-fastbuild/bin/packages/intl-numberformat/lib/should-polyfill.js
|
|
1570
|
+
var import_intl_localematcher3 = __toModule(require_intl_localematcher());
|
|
1571
|
+
|
|
1572
|
+
// bazel-out/darwin-fastbuild/bin/packages/intl-numberformat/lib/supported-locales.js
|
|
1573
|
+
var supportedLocales = ["af-NA", "af", "agq", "ak", "am", "ar-AE", "ar-BH", "ar-DJ", "ar-DZ", "ar-EG", "ar-EH", "ar-ER", "ar-IL", "ar-IQ", "ar-JO", "ar-KM", "ar-KW", "ar-LB", "ar-LY", "ar-MA", "ar-MR", "ar-OM", "ar-PS", "ar-QA", "ar-SA", "ar-SD", "ar-SO", "ar-SS", "ar-SY", "ar-TD", "ar-TN", "ar-YE", "ar", "as", "asa", "ast", "az-Cyrl", "az-Latn", "az", "bas", "be", "bem", "bez", "bg", "bm", "bn-IN", "bn", "bo-IN", "bo", "br", "brx", "bs-Cyrl", "bs-Latn", "bs", "ca-AD", "ca-ES-VALENCIA", "ca-FR", "ca-IT", "ca", "ccp-IN", "ccp", "ce", "ceb", "cgg", "chr", "ckb-IR", "ckb", "cs", "cy", "da-GL", "da", "dav", "de-AT", "de-BE", "de-CH", "de-IT", "de-LI", "de-LU", "de", "dje", "doi", "dsb", "dua", "dyo", "dz", "ebu", "ee-TG", "ee", "el-CY", "el", "en-001", "en-150", "en-AE", "en-AG", "en-AI", "en-AS", "en-AT", "en-AU", "en-BB", "en-BE", "en-BI", "en-BM", "en-BS", "en-BW", "en-BZ", "en-CA", "en-CC", "en-CH", "en-CK", "en-CM", "en-CX", "en-CY", "en-DE", "en-DG", "en-DK", "en-DM", "en-ER", "en-FI", "en-FJ", "en-FK", "en-FM", "en-GB", "en-GD", "en-GG", "en-GH", "en-GI", "en-GM", "en-GU", "en-GY", "en-HK", "en-IE", "en-IL", "en-IM", "en-IN", "en-IO", "en-JE", "en-JM", "en-KE", "en-KI", "en-KN", "en-KY", "en-LC", "en-LR", "en-LS", "en-MG", "en-MH", "en-MO", "en-MP", "en-MS", "en-MT", "en-MU", "en-MW", "en-MY", "en-NA", "en-NF", "en-NG", "en-NL", "en-NR", "en-NU", "en-NZ", "en-PG", "en-PH", "en-PK", "en-PN", "en-PR", "en-PW", "en-RW", "en-SB", "en-SC", "en-SD", "en-SE", "en-SG", "en-SH", "en-SI", "en-SL", "en-SS", "en-SX", "en-SZ", "en-TC", "en-TK", "en-TO", "en-TT", "en-TV", "en-TZ", "en-UG", "en-UM", "en-US-POSIX", "en-VC", "en-VG", "en-VI", "en-VU", "en-WS", "en-ZA", "en-ZM", "en-ZW", "en", "eo", "es-419", "es-AR", "es-BO", "es-BR", "es-BZ", "es-CL", "es-CO", "es-CR", "es-CU", "es-DO", "es-EA", "es-EC", "es-GQ", "es-GT", "es-HN", "es-IC", "es-MX", "es-NI", "es-PA", "es-PE", "es-PH", "es-PR", "es-PY", "es-SV", "es-US", "es-UY", "es-VE", "es", "et", "eu", "ewo", "fa-AF", "fa", "ff-Adlm-BF", "ff-Adlm-CM", "ff-Adlm-GH", "ff-Adlm-GM", "ff-Adlm-GW", "ff-Adlm-LR", "ff-Adlm-MR", "ff-Adlm-NE", "ff-Adlm-NG", "ff-Adlm-SL", "ff-Adlm-SN", "ff-Adlm", "ff-Latn-BF", "ff-Latn-CM", "ff-Latn-GH", "ff-Latn-GM", "ff-Latn-GN", "ff-Latn-GW", "ff-Latn-LR", "ff-Latn-MR", "ff-Latn-NE", "ff-Latn-NG", "ff-Latn-SL", "ff-Latn", "ff", "fi", "fil", "fo-DK", "fo", "fr-BE", "fr-BF", "fr-BI", "fr-BJ", "fr-BL", "fr-CA", "fr-CD", "fr-CF", "fr-CG", "fr-CH", "fr-CI", "fr-CM", "fr-DJ", "fr-DZ", "fr-GA", "fr-GF", "fr-GN", "fr-GP", "fr-GQ", "fr-HT", "fr-KM", "fr-LU", "fr-MA", "fr-MC", "fr-MF", "fr-MG", "fr-ML", "fr-MQ", "fr-MR", "fr-MU", "fr-NC", "fr-NE", "fr-PF", "fr-PM", "fr-RE", "fr-RW", "fr-SC", "fr-SN", "fr-SY", "fr-TD", "fr-TG", "fr-TN", "fr-VU", "fr-WF", "fr-YT", "fr", "fur", "fy", "ga-GB", "ga", "gd", "gl", "gsw-FR", "gsw-LI", "gsw", "gu", "guz", "gv", "ha-GH", "ha-NE", "ha", "haw", "he", "hi", "hr-BA", "hr", "hsb", "hu", "hy", "ia", "id", "ig", "ii", "is", "it-CH", "it-SM", "it-VA", "it", "ja", "jgo", "jmc", "jv", "ka", "kab", "kam", "kde", "kea", "khq", "ki", "kk", "kkj", "kl", "kln", "km", "kn", "ko-KP", "ko", "kok", "ks-Arab", "ks", "ksb", "ksf", "ksh", "ku", "kw", "ky", "lag", "lb", "lg", "lkt", "ln-AO", "ln-CF", "ln-CG", "ln", "lo", "lrc-IQ", "lrc", "lt", "lu", "luo", "luy", "lv", "mai", "mas-TZ", "mas", "mer", "mfe", "mg", "mgh", "mgo", "mi", "mk", "ml", "mn", "mni-Beng", "mni", "mr", "ms-BN", "ms-ID", "ms-SG", "ms", "mt", "mua", "my", "mzn", "naq", "nb-SJ", "nb", "nd", "nds-NL", "nds", "ne-IN", "ne", "nl-AW", "nl-BE", "nl-BQ", "nl-CW", "nl-SR", "nl-SX", "nl", "nmg", "nn", "nnh", "no", "nus", "nyn", "om-KE", "om", "or", "os-RU", "os", "pa-Arab", "pa-Guru", "pa", "pcm", "pl", "ps-PK", "ps", "pt-AO", "pt-CH", "pt-CV", "pt-GQ", "pt-GW", "pt-LU", "pt-MO", "pt-MZ", "pt-PT", "pt-ST", "pt-TL", "pt", "qu-BO", "qu-EC", "qu", "rm", "rn", "ro-MD", "ro", "rof", "ru-BY", "ru-KG", "ru-KZ", "ru-MD", "ru-UA", "ru", "rw", "rwk", "sa", "sah", "saq", "sat-Olck", "sat", "sbp", "sd-Arab", "sd-Deva", "sd", "se-FI", "se-SE", "se", "seh", "ses", "sg", "shi-Latn", "shi-Tfng", "shi", "si", "sk", "sl", "smn", "sn", "so-DJ", "so-ET", "so-KE", "so", "sq-MK", "sq-XK", "sq", "sr-Cyrl-BA", "sr-Cyrl-ME", "sr-Cyrl-XK", "sr-Cyrl", "sr-Latn-BA", "sr-Latn-ME", "sr-Latn-XK", "sr-Latn", "sr", "su-Latn", "su", "sv-AX", "sv-FI", "sv", "sw-CD", "sw-KE", "sw-UG", "sw", "ta-LK", "ta-MY", "ta-SG", "ta", "te", "teo-KE", "teo", "tg", "th", "ti-ER", "ti", "tk", "to", "tr-CY", "tr", "tt", "twq", "tzm", "ug", "uk", "ur-IN", "ur", "uz-Arab", "uz-Cyrl", "uz-Latn", "uz", "vai-Latn", "vai-Vaii", "vai", "vi", "vun", "wae", "wo", "xh", "xog", "yav", "yi", "yo-BJ", "yo", "yue-Hans", "yue-Hant", "yue", "zgh", "zh-Hans-HK", "zh-Hans-MO", "zh-Hans-SG", "zh-Hans", "zh-Hant-HK", "zh-Hant-MO", "zh-Hant", "zh", "zu"];
|
|
1574
|
+
|
|
1572
1575
|
// bazel-out/darwin-fastbuild/bin/packages/intl-numberformat/lib/should-polyfill.js
|
|
1573
1576
|
function onlySupportsEn() {
|
|
1574
1577
|
return !Intl.NumberFormat.polyfilled && !Intl.NumberFormat.supportedLocalesOf(["es"]).length;
|
|
@@ -1597,7 +1600,12 @@
|
|
|
1597
1600
|
return Intl.NumberFormat.supportedLocalesOf(locales).length === locales.length;
|
|
1598
1601
|
}
|
|
1599
1602
|
function shouldPolyfill(locale) {
|
|
1600
|
-
|
|
1603
|
+
if (locale === void 0) {
|
|
1604
|
+
locale = "en";
|
|
1605
|
+
}
|
|
1606
|
+
if (typeof Intl === "undefined" || !("NumberFormat" in Intl) || !supportsES2020() || onlySupportsEn() || !supportedLocalesOf2(locale)) {
|
|
1607
|
+
return locale ? (0, import_intl_localematcher3.match)([locale], supportedLocales, "en") : void 0;
|
|
1608
|
+
}
|
|
1601
1609
|
}
|
|
1602
1610
|
|
|
1603
1611
|
// bazel-out/darwin-fastbuild/bin/packages/intl-numberformat/lib/polyfill.js
|
package/polyfill.js
CHANGED
|
@@ -4,11 +4,11 @@ var core_1 = require("./src/core");
|
|
|
4
4
|
var to_locale_string_1 = require("./src/to_locale_string");
|
|
5
5
|
var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
|
|
6
6
|
var should_polyfill_1 = require("./should-polyfill");
|
|
7
|
-
if (should_polyfill_1.shouldPolyfill()) {
|
|
8
|
-
ecma402_abstract_1.defineProperty(Intl, 'NumberFormat', { value: core_1.NumberFormat });
|
|
9
|
-
ecma402_abstract_1.defineProperty(Number.prototype, 'toLocaleString', {
|
|
7
|
+
if ((0, should_polyfill_1.shouldPolyfill)()) {
|
|
8
|
+
(0, ecma402_abstract_1.defineProperty)(Intl, 'NumberFormat', { value: core_1.NumberFormat });
|
|
9
|
+
(0, ecma402_abstract_1.defineProperty)(Number.prototype, 'toLocaleString', {
|
|
10
10
|
value: function toLocaleString(locales, options) {
|
|
11
|
-
return to_locale_string_1.toLocaleString(this, locales, options);
|
|
11
|
+
return (0, to_locale_string_1.toLocaleString)(this, locales, options);
|
|
12
12
|
},
|
|
13
13
|
});
|
|
14
14
|
}
|
package/should-polyfill.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function shouldPolyfill(locale?: string |
|
|
1
|
+
export declare function shouldPolyfill(locale?: string): string | undefined;
|
|
2
2
|
//# sourceMappingURL=should-polyfill.d.ts.map
|
package/should-polyfill.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"should-polyfill.d.ts","sourceRoot":"","sources":["../../../../../packages/intl-numberformat/should-polyfill.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"should-polyfill.d.ts","sourceRoot":"","sources":["../../../../../packages/intl-numberformat/should-polyfill.ts"],"names":[],"mappings":"AAgDA,wBAAgB,cAAc,CAAC,MAAM,SAAO,sBAU3C"}
|
package/should-polyfill.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.shouldPolyfill = void 0;
|
|
4
|
+
var intl_localematcher_1 = require("@formatjs/intl-localematcher");
|
|
5
|
+
var supported_locales_1 = require("./supported-locales");
|
|
4
6
|
/**
|
|
5
7
|
* Check if this is old Node that only supports en
|
|
6
8
|
* @returns
|
|
@@ -43,10 +45,13 @@ function supportedLocalesOf(locale) {
|
|
|
43
45
|
return Intl.NumberFormat.supportedLocalesOf(locales).length === locales.length;
|
|
44
46
|
}
|
|
45
47
|
function shouldPolyfill(locale) {
|
|
46
|
-
|
|
48
|
+
if (locale === void 0) { locale = 'en'; }
|
|
49
|
+
if (typeof Intl === 'undefined' ||
|
|
47
50
|
!('NumberFormat' in Intl) ||
|
|
48
51
|
!supportsES2020() ||
|
|
49
52
|
onlySupportsEn() ||
|
|
50
|
-
!supportedLocalesOf(locale))
|
|
53
|
+
!supportedLocalesOf(locale)) {
|
|
54
|
+
return locale ? (0, intl_localematcher_1.match)([locale], supported_locales_1.supportedLocales, 'en') : undefined;
|
|
55
|
+
}
|
|
51
56
|
}
|
|
52
57
|
exports.shouldPolyfill = shouldPolyfill;
|
package/src/core.js
CHANGED
|
@@ -6,7 +6,7 @@ var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
|
|
|
6
6
|
var currency_digits_generated_1 = require("./currency-digits.generated");
|
|
7
7
|
var numbering_systems_generated_1 = require("./numbering-systems.generated");
|
|
8
8
|
// eslint-disable-next-line import/no-cycle
|
|
9
|
-
var get_internal_slots_1 = tslib_1.__importDefault(require("./get_internal_slots"));
|
|
9
|
+
var get_internal_slots_1 = (0, tslib_1.__importDefault)(require("./get_internal_slots"));
|
|
10
10
|
var RESOLVED_OPTIONS_KEYS = [
|
|
11
11
|
'locale',
|
|
12
12
|
'numberingSystem',
|
|
@@ -31,10 +31,10 @@ var RESOLVED_OPTIONS_KEYS = [
|
|
|
31
31
|
*/
|
|
32
32
|
exports.NumberFormat = function (locales, options) {
|
|
33
33
|
// Cannot use `new.target` bc of IE11 & TS transpiles it to something else
|
|
34
|
-
if (!this || !ecma402_abstract_1.OrdinaryHasInstance(exports.NumberFormat, this)) {
|
|
34
|
+
if (!this || !(0, ecma402_abstract_1.OrdinaryHasInstance)(exports.NumberFormat, this)) {
|
|
35
35
|
return new exports.NumberFormat(locales, options);
|
|
36
36
|
}
|
|
37
|
-
ecma402_abstract_1.InitializeNumberFormat(this, locales, options, {
|
|
37
|
+
(0, ecma402_abstract_1.InitializeNumberFormat)(this, locales, options, {
|
|
38
38
|
getInternalSlots: get_internal_slots_1.default,
|
|
39
39
|
localeData: exports.NumberFormat.localeData,
|
|
40
40
|
availableLocales: exports.NumberFormat.availableLocales,
|
|
@@ -42,10 +42,10 @@ exports.NumberFormat = function (locales, options) {
|
|
|
42
42
|
currencyDigitsData: currency_digits_generated_1.currencyDigitsData,
|
|
43
43
|
numberingSystemNames: numbering_systems_generated_1.numberingSystemNames,
|
|
44
44
|
});
|
|
45
|
-
var internalSlots = get_internal_slots_1.default(this);
|
|
45
|
+
var internalSlots = (0, get_internal_slots_1.default)(this);
|
|
46
46
|
var dataLocale = internalSlots.dataLocale;
|
|
47
47
|
var dataLocaleData = exports.NumberFormat.localeData[dataLocale];
|
|
48
|
-
ecma402_abstract_1.invariant(dataLocaleData !== undefined, "Cannot load locale-dependent data for "
|
|
48
|
+
(0, ecma402_abstract_1.invariant)(dataLocaleData !== undefined, "Cannot load locale-dependent data for ".concat(dataLocale, "."));
|
|
49
49
|
internalSlots.pl = new Intl.PluralRules(dataLocale, {
|
|
50
50
|
minimumFractionDigits: internalSlots.minimumFractionDigits,
|
|
51
51
|
maximumFractionDigits: internalSlots.maximumFractionDigits,
|
|
@@ -56,7 +56,7 @@ exports.NumberFormat = function (locales, options) {
|
|
|
56
56
|
return this;
|
|
57
57
|
};
|
|
58
58
|
function formatToParts(x) {
|
|
59
|
-
return ecma402_abstract_1.FormatNumericToParts(this, toNumeric(x), {
|
|
59
|
+
return (0, ecma402_abstract_1.FormatNumericToParts)(this, toNumeric(x), {
|
|
60
60
|
getInternalSlots: get_internal_slots_1.default,
|
|
61
61
|
});
|
|
62
62
|
}
|
|
@@ -72,15 +72,15 @@ catch (e) {
|
|
|
72
72
|
// In older browser (e.g Chrome 36 like polyfill.io)
|
|
73
73
|
// TypeError: Cannot redefine property: name
|
|
74
74
|
}
|
|
75
|
-
ecma402_abstract_1.defineProperty(exports.NumberFormat.prototype, 'formatToParts', {
|
|
75
|
+
(0, ecma402_abstract_1.defineProperty)(exports.NumberFormat.prototype, 'formatToParts', {
|
|
76
76
|
value: formatToParts,
|
|
77
77
|
});
|
|
78
|
-
ecma402_abstract_1.defineProperty(exports.NumberFormat.prototype, 'resolvedOptions', {
|
|
78
|
+
(0, ecma402_abstract_1.defineProperty)(exports.NumberFormat.prototype, 'resolvedOptions', {
|
|
79
79
|
value: function resolvedOptions() {
|
|
80
|
-
if (typeof this !== 'object' || !ecma402_abstract_1.OrdinaryHasInstance(exports.NumberFormat, this)) {
|
|
80
|
+
if (typeof this !== 'object' || !(0, ecma402_abstract_1.OrdinaryHasInstance)(exports.NumberFormat, this)) {
|
|
81
81
|
throw TypeError('Method Intl.NumberFormat.prototype.resolvedOptions called on incompatible receiver');
|
|
82
82
|
}
|
|
83
|
-
var internalSlots = get_internal_slots_1.default(this);
|
|
83
|
+
var internalSlots = (0, get_internal_slots_1.default)(this);
|
|
84
84
|
var ro = {};
|
|
85
85
|
for (var _i = 0, RESOLVED_OPTIONS_KEYS_1 = RESOLVED_OPTIONS_KEYS; _i < RESOLVED_OPTIONS_KEYS_1.length; _i++) {
|
|
86
86
|
var key = RESOLVED_OPTIONS_KEYS_1[_i];
|
|
@@ -96,10 +96,10 @@ var formatDescriptor = {
|
|
|
96
96
|
enumerable: false,
|
|
97
97
|
configurable: true,
|
|
98
98
|
get: function () {
|
|
99
|
-
if (typeof this !== 'object' || !ecma402_abstract_1.OrdinaryHasInstance(exports.NumberFormat, this)) {
|
|
99
|
+
if (typeof this !== 'object' || !(0, ecma402_abstract_1.OrdinaryHasInstance)(exports.NumberFormat, this)) {
|
|
100
100
|
throw TypeError('Intl.NumberFormat format property accessor called on incompatible receiver');
|
|
101
101
|
}
|
|
102
|
-
var internalSlots = get_internal_slots_1.default(this);
|
|
102
|
+
var internalSlots = (0, get_internal_slots_1.default)(this);
|
|
103
103
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
104
104
|
var numberFormat = this;
|
|
105
105
|
var boundFormat = internalSlots.boundFormat;
|
|
@@ -146,9 +146,9 @@ catch (e) {
|
|
|
146
146
|
}
|
|
147
147
|
Object.defineProperty(exports.NumberFormat.prototype, 'format', formatDescriptor);
|
|
148
148
|
// Static properties
|
|
149
|
-
ecma402_abstract_1.defineProperty(exports.NumberFormat, 'supportedLocalesOf', {
|
|
149
|
+
(0, ecma402_abstract_1.defineProperty)(exports.NumberFormat, 'supportedLocalesOf', {
|
|
150
150
|
value: function supportedLocalesOf(locales, options) {
|
|
151
|
-
return ecma402_abstract_1.SupportedLocales(exports.NumberFormat.availableLocales, ecma402_abstract_1.CanonicalizeLocaleList(locales), options);
|
|
151
|
+
return (0, ecma402_abstract_1.SupportedLocales)(exports.NumberFormat.availableLocales, (0, ecma402_abstract_1.CanonicalizeLocaleList)(locales), options);
|
|
152
152
|
},
|
|
153
153
|
});
|
|
154
154
|
exports.NumberFormat.__addLocaleData = function __addLocaleData() {
|
|
@@ -173,7 +173,7 @@ exports.NumberFormat.__addLocaleData = function __addLocaleData() {
|
|
|
173
173
|
exports.NumberFormat.__addUnitData = function __addUnitData(locale, unitsData) {
|
|
174
174
|
var _a = exports.NumberFormat.localeData, _b = locale, existingData = _a[_b];
|
|
175
175
|
if (!existingData) {
|
|
176
|
-
throw new Error("Locale data for \""
|
|
176
|
+
throw new Error("Locale data for \"".concat(locale, "\" has not been loaded in NumberFormat. \nPlease __addLocaleData before adding additional unit data"));
|
|
177
177
|
}
|
|
178
178
|
for (var unit in unitsData.simple) {
|
|
179
179
|
existingData.units.simple[unit] = unitsData.simple[unit];
|
|
@@ -193,7 +193,7 @@ function toNumeric(val) {
|
|
|
193
193
|
if (typeof val === 'bigint') {
|
|
194
194
|
return val;
|
|
195
195
|
}
|
|
196
|
-
return ecma402_abstract_1.ToNumber(val);
|
|
196
|
+
return (0, ecma402_abstract_1.ToNumber)(val);
|
|
197
197
|
}
|
|
198
198
|
try {
|
|
199
199
|
// IE11 does not have Symbol
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supported-locales.d.ts","sourceRoot":"","sources":["../../../../../packages/intl-numberformat/supported-locales.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,gBAAgB,EAAE,MAAM,EAA+nI,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.supportedLocales = void 0;
|
|
4
|
+
// This file is generated from supported-locales-gen.ts
|
|
5
|
+
exports.supportedLocales = ["af-NA", "af", "agq", "ak", "am", "ar-AE", "ar-BH", "ar-DJ", "ar-DZ", "ar-EG", "ar-EH", "ar-ER", "ar-IL", "ar-IQ", "ar-JO", "ar-KM", "ar-KW", "ar-LB", "ar-LY", "ar-MA", "ar-MR", "ar-OM", "ar-PS", "ar-QA", "ar-SA", "ar-SD", "ar-SO", "ar-SS", "ar-SY", "ar-TD", "ar-TN", "ar-YE", "ar", "as", "asa", "ast", "az-Cyrl", "az-Latn", "az", "bas", "be", "bem", "bez", "bg", "bm", "bn-IN", "bn", "bo-IN", "bo", "br", "brx", "bs-Cyrl", "bs-Latn", "bs", "ca-AD", "ca-ES-VALENCIA", "ca-FR", "ca-IT", "ca", "ccp-IN", "ccp", "ce", "ceb", "cgg", "chr", "ckb-IR", "ckb", "cs", "cy", "da-GL", "da", "dav", "de-AT", "de-BE", "de-CH", "de-IT", "de-LI", "de-LU", "de", "dje", "doi", "dsb", "dua", "dyo", "dz", "ebu", "ee-TG", "ee", "el-CY", "el", "en-001", "en-150", "en-AE", "en-AG", "en-AI", "en-AS", "en-AT", "en-AU", "en-BB", "en-BE", "en-BI", "en-BM", "en-BS", "en-BW", "en-BZ", "en-CA", "en-CC", "en-CH", "en-CK", "en-CM", "en-CX", "en-CY", "en-DE", "en-DG", "en-DK", "en-DM", "en-ER", "en-FI", "en-FJ", "en-FK", "en-FM", "en-GB", "en-GD", "en-GG", "en-GH", "en-GI", "en-GM", "en-GU", "en-GY", "en-HK", "en-IE", "en-IL", "en-IM", "en-IN", "en-IO", "en-JE", "en-JM", "en-KE", "en-KI", "en-KN", "en-KY", "en-LC", "en-LR", "en-LS", "en-MG", "en-MH", "en-MO", "en-MP", "en-MS", "en-MT", "en-MU", "en-MW", "en-MY", "en-NA", "en-NF", "en-NG", "en-NL", "en-NR", "en-NU", "en-NZ", "en-PG", "en-PH", "en-PK", "en-PN", "en-PR", "en-PW", "en-RW", "en-SB", "en-SC", "en-SD", "en-SE", "en-SG", "en-SH", "en-SI", "en-SL", "en-SS", "en-SX", "en-SZ", "en-TC", "en-TK", "en-TO", "en-TT", "en-TV", "en-TZ", "en-UG", "en-UM", "en-US-POSIX", "en-VC", "en-VG", "en-VI", "en-VU", "en-WS", "en-ZA", "en-ZM", "en-ZW", "en", "eo", "es-419", "es-AR", "es-BO", "es-BR", "es-BZ", "es-CL", "es-CO", "es-CR", "es-CU", "es-DO", "es-EA", "es-EC", "es-GQ", "es-GT", "es-HN", "es-IC", "es-MX", "es-NI", "es-PA", "es-PE", "es-PH", "es-PR", "es-PY", "es-SV", "es-US", "es-UY", "es-VE", "es", "et", "eu", "ewo", "fa-AF", "fa", "ff-Adlm-BF", "ff-Adlm-CM", "ff-Adlm-GH", "ff-Adlm-GM", "ff-Adlm-GW", "ff-Adlm-LR", "ff-Adlm-MR", "ff-Adlm-NE", "ff-Adlm-NG", "ff-Adlm-SL", "ff-Adlm-SN", "ff-Adlm", "ff-Latn-BF", "ff-Latn-CM", "ff-Latn-GH", "ff-Latn-GM", "ff-Latn-GN", "ff-Latn-GW", "ff-Latn-LR", "ff-Latn-MR", "ff-Latn-NE", "ff-Latn-NG", "ff-Latn-SL", "ff-Latn", "ff", "fi", "fil", "fo-DK", "fo", "fr-BE", "fr-BF", "fr-BI", "fr-BJ", "fr-BL", "fr-CA", "fr-CD", "fr-CF", "fr-CG", "fr-CH", "fr-CI", "fr-CM", "fr-DJ", "fr-DZ", "fr-GA", "fr-GF", "fr-GN", "fr-GP", "fr-GQ", "fr-HT", "fr-KM", "fr-LU", "fr-MA", "fr-MC", "fr-MF", "fr-MG", "fr-ML", "fr-MQ", "fr-MR", "fr-MU", "fr-NC", "fr-NE", "fr-PF", "fr-PM", "fr-RE", "fr-RW", "fr-SC", "fr-SN", "fr-SY", "fr-TD", "fr-TG", "fr-TN", "fr-VU", "fr-WF", "fr-YT", "fr", "fur", "fy", "ga-GB", "ga", "gd", "gl", "gsw-FR", "gsw-LI", "gsw", "gu", "guz", "gv", "ha-GH", "ha-NE", "ha", "haw", "he", "hi", "hr-BA", "hr", "hsb", "hu", "hy", "ia", "id", "ig", "ii", "is", "it-CH", "it-SM", "it-VA", "it", "ja", "jgo", "jmc", "jv", "ka", "kab", "kam", "kde", "kea", "khq", "ki", "kk", "kkj", "kl", "kln", "km", "kn", "ko-KP", "ko", "kok", "ks-Arab", "ks", "ksb", "ksf", "ksh", "ku", "kw", "ky", "lag", "lb", "lg", "lkt", "ln-AO", "ln-CF", "ln-CG", "ln", "lo", "lrc-IQ", "lrc", "lt", "lu", "luo", "luy", "lv", "mai", "mas-TZ", "mas", "mer", "mfe", "mg", "mgh", "mgo", "mi", "mk", "ml", "mn", "mni-Beng", "mni", "mr", "ms-BN", "ms-ID", "ms-SG", "ms", "mt", "mua", "my", "mzn", "naq", "nb-SJ", "nb", "nd", "nds-NL", "nds", "ne-IN", "ne", "nl-AW", "nl-BE", "nl-BQ", "nl-CW", "nl-SR", "nl-SX", "nl", "nmg", "nn", "nnh", "no", "nus", "nyn", "om-KE", "om", "or", "os-RU", "os", "pa-Arab", "pa-Guru", "pa", "pcm", "pl", "ps-PK", "ps", "pt-AO", "pt-CH", "pt-CV", "pt-GQ", "pt-GW", "pt-LU", "pt-MO", "pt-MZ", "pt-PT", "pt-ST", "pt-TL", "pt", "qu-BO", "qu-EC", "qu", "rm", "rn", "ro-MD", "ro", "rof", "ru-BY", "ru-KG", "ru-KZ", "ru-MD", "ru-UA", "ru", "rw", "rwk", "sa", "sah", "saq", "sat-Olck", "sat", "sbp", "sd-Arab", "sd-Deva", "sd", "se-FI", "se-SE", "se", "seh", "ses", "sg", "shi-Latn", "shi-Tfng", "shi", "si", "sk", "sl", "smn", "sn", "so-DJ", "so-ET", "so-KE", "so", "sq-MK", "sq-XK", "sq", "sr-Cyrl-BA", "sr-Cyrl-ME", "sr-Cyrl-XK", "sr-Cyrl", "sr-Latn-BA", "sr-Latn-ME", "sr-Latn-XK", "sr-Latn", "sr", "su-Latn", "su", "sv-AX", "sv-FI", "sv", "sw-CD", "sw-KE", "sw-UG", "sw", "ta-LK", "ta-MY", "ta-SG", "ta", "te", "teo-KE", "teo", "tg", "th", "ti-ER", "ti", "tk", "to", "tr-CY", "tr", "tt", "twq", "tzm", "ug", "uk", "ur-IN", "ur", "uz-Arab", "uz-Cyrl", "uz-Latn", "uz", "vai-Latn", "vai-Vaii", "vai", "vi", "vun", "wae", "wo", "xh", "xog", "yav", "yi", "yo-BJ", "yo", "yue-Hans", "yue-Hant", "yue", "zgh", "zh-Hans-HK", "zh-Hans-MO", "zh-Hans-SG", "zh-Hans", "zh-Hant-HK", "zh-Hant-MO", "zh-Hant", "zh", "zu"];
|