@formatjs/intl-numberformat 7.4.0 → 7.4.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/package.json +3 -3
- package/polyfill.iife.js +28 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formatjs/intl-numberformat",
|
|
3
|
-
"version": "7.4.
|
|
3
|
+
"version": "7.4.1",
|
|
4
4
|
"description": "Ponyfill for ES2020 Intl.NumberFormat",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"polyfill",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"url": "git+https://github.com/formatjs/formatjs.git"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@formatjs/ecma402-abstract": "1.11.
|
|
26
|
-
"@formatjs/intl-localematcher": "0.2.
|
|
25
|
+
"@formatjs/ecma402-abstract": "1.11.2",
|
|
26
|
+
"@formatjs/intl-localematcher": "0.2.23",
|
|
27
27
|
"tslib": "^2.1.0"
|
|
28
28
|
},
|
|
29
29
|
"bugs": {
|
package/polyfill.iife.js
CHANGED
|
@@ -30,6 +30,19 @@
|
|
|
30
30
|
}, enumerable: true } : { value: module, enumerable: true })), module);
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
+
// bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/CanonicalizeLocaleList.js
|
|
34
|
+
var require_CanonicalizeLocaleList = __commonJS({
|
|
35
|
+
"bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/CanonicalizeLocaleList.js": function(exports) {
|
|
36
|
+
"use strict";
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
exports.CanonicalizeLocaleList = void 0;
|
|
39
|
+
function CanonicalizeLocaleList2(locales) {
|
|
40
|
+
return Intl.getCanonicalLocales(locales);
|
|
41
|
+
}
|
|
42
|
+
exports.CanonicalizeLocaleList = CanonicalizeLocaleList2;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
33
46
|
// bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/utils.js
|
|
34
47
|
var require_utils = __commonJS({
|
|
35
48
|
"bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/utils.js": function(exports) {
|
|
@@ -114,14 +127,16 @@
|
|
|
114
127
|
var utils_1 = require_utils();
|
|
115
128
|
function BestFitMatcher(availableLocales, requestedLocales, getDefaultLocale) {
|
|
116
129
|
var minimizedAvailableLocaleMap = {};
|
|
117
|
-
availableLocales.forEach(function(l2) {
|
|
118
|
-
return minimizedAvailableLocaleMap[l2] = l2;
|
|
119
|
-
});
|
|
120
130
|
var minimizedAvailableLocales = /* @__PURE__ */ new Set();
|
|
121
131
|
availableLocales.forEach(function(locale2) {
|
|
122
132
|
var minimizedLocale = new Intl.Locale(locale2).minimize().toString();
|
|
133
|
+
var canonicalizedLocale = Intl.getCanonicalLocales(locale2)[0] || locale2;
|
|
123
134
|
minimizedAvailableLocaleMap[minimizedLocale] = locale2;
|
|
135
|
+
minimizedAvailableLocaleMap[locale2] = locale2;
|
|
136
|
+
minimizedAvailableLocaleMap[canonicalizedLocale] = locale2;
|
|
124
137
|
minimizedAvailableLocales.add(minimizedLocale);
|
|
138
|
+
minimizedAvailableLocales.add(locale2);
|
|
139
|
+
minimizedAvailableLocales.add(canonicalizedLocale);
|
|
125
140
|
});
|
|
126
141
|
var foundLocale;
|
|
127
142
|
for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
|
|
@@ -147,8 +162,11 @@
|
|
|
147
162
|
}
|
|
148
163
|
foundLocale = (0, BestAvailableLocale_1.BestAvailableLocale)(minimizedAvailableLocales, maximizedRequestedLocale);
|
|
149
164
|
}
|
|
165
|
+
if (!foundLocale) {
|
|
166
|
+
return { locale: getDefaultLocale() };
|
|
167
|
+
}
|
|
150
168
|
return {
|
|
151
|
-
locale:
|
|
169
|
+
locale: minimizedAvailableLocaleMap[foundLocale] || foundLocale
|
|
152
170
|
};
|
|
153
171
|
}
|
|
154
172
|
exports.BestFitMatcher = BestFitMatcher;
|
|
@@ -309,13 +327,14 @@
|
|
|
309
327
|
"use strict";
|
|
310
328
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
311
329
|
exports.ResolveLocale = exports.LookupSupportedLocales = exports.match = void 0;
|
|
330
|
+
var CanonicalizeLocaleList_1 = require_CanonicalizeLocaleList();
|
|
312
331
|
var ResolveLocale_1 = require_ResolveLocale();
|
|
313
332
|
function match2(requestedLocales, availableLocales, defaultLocale, opts) {
|
|
314
333
|
var locales = availableLocales.reduce(function(all, l) {
|
|
315
334
|
all.add(l);
|
|
316
335
|
return all;
|
|
317
336
|
}, /* @__PURE__ */ new Set());
|
|
318
|
-
return (0, ResolveLocale_1.ResolveLocale)(locales, requestedLocales, {
|
|
337
|
+
return (0, ResolveLocale_1.ResolveLocale)(locales, (0, CanonicalizeLocaleList_1.CanonicalizeLocaleList)(requestedLocales), {
|
|
319
338
|
localeMatcher: (opts === null || opts === void 0 ? void 0 : opts.algorithm) || "best fit"
|
|
320
339
|
}, [], {}, function() {
|
|
321
340
|
return defaultLocale;
|
|
@@ -413,7 +432,7 @@
|
|
|
413
432
|
// bazel-out/darwin-fastbuild/bin/packages/ecma402-abstract/lib/CoerceOptionsToObject.js
|
|
414
433
|
function CoerceOptionsToObject(options) {
|
|
415
434
|
if (typeof options === "undefined") {
|
|
416
|
-
return Object.create(null);
|
|
435
|
+
return /* @__PURE__ */ Object.create(null);
|
|
417
436
|
}
|
|
418
437
|
return ToObject(options);
|
|
419
438
|
}
|
|
@@ -1181,7 +1200,7 @@
|
|
|
1181
1200
|
// bazel-out/darwin-fastbuild/bin/packages/ecma402-abstract/lib/NumberFormat/SetNumberFormatUnitOptions.js
|
|
1182
1201
|
function SetNumberFormatUnitOptions(nf, options, _a) {
|
|
1183
1202
|
if (options === void 0) {
|
|
1184
|
-
options = Object.create(null);
|
|
1203
|
+
options = /* @__PURE__ */ Object.create(null);
|
|
1185
1204
|
}
|
|
1186
1205
|
var getInternalSlots2 = _a.getInternalSlots;
|
|
1187
1206
|
var internalSlots = getInternalSlots2(nf);
|
|
@@ -1250,7 +1269,7 @@
|
|
|
1250
1269
|
var getInternalSlots2 = _a.getInternalSlots, localeData = _a.localeData, availableLocales = _a.availableLocales, numberingSystemNames2 = _a.numberingSystemNames, getDefaultLocale = _a.getDefaultLocale, currencyDigitsData2 = _a.currencyDigitsData;
|
|
1251
1270
|
var requestedLocales = CanonicalizeLocaleList(locales);
|
|
1252
1271
|
var options = CoerceOptionsToObject(opts);
|
|
1253
|
-
var opt = Object.create(null);
|
|
1272
|
+
var opt = /* @__PURE__ */ Object.create(null);
|
|
1254
1273
|
var matcher = GetOption(options, "localeMatcher", "string", ["lookup", "best fit"], "best fit");
|
|
1255
1274
|
opt.localeMatcher = matcher;
|
|
1256
1275
|
var numberingSystem = GetOption(options, "numberingSystem", "string", void 0, void 0);
|
|
@@ -1318,7 +1337,7 @@
|
|
|
1318
1337
|
function getInternalSlots(x) {
|
|
1319
1338
|
var internalSlots = internalSlotMap.get(x);
|
|
1320
1339
|
if (!internalSlots) {
|
|
1321
|
-
internalSlots = Object.create(null);
|
|
1340
|
+
internalSlots = /* @__PURE__ */ Object.create(null);
|
|
1322
1341
|
internalSlotMap.set(x, internalSlots);
|
|
1323
1342
|
}
|
|
1324
1343
|
return internalSlots;
|