@formatjs/intl-listformat 7.7.12 → 8.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/index.js +32 -34
- package/package.json +13 -6
- package/polyfill-force.js +2 -5
- package/polyfill.iife.js +35 -36
- package/polyfill.js +4 -7
- package/should-polyfill.js +4 -7
- package/supported-locales.generated.js +1 -4
- package/lib/index.d.ts +0 -72
- package/lib/index.js +0 -216
- package/lib/polyfill-force.d.ts +0 -1
- package/lib/polyfill-force.js +0 -7
- package/lib/polyfill.d.ts +0 -1
- package/lib/polyfill.js +0 -10
- package/lib/should-polyfill.d.ts +0 -1
- package/lib/should-polyfill.js +0 -16
- package/lib/supported-locales.generated.d.ts +0 -1
- package/lib/supported-locales.generated.js +0 -1
package/index.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
|
|
5
|
-
var intl_localematcher_1 = require("@formatjs/intl-localematcher");
|
|
1
|
+
import { __assign } from "tslib";
|
|
2
|
+
import { CanonicalizeLocaleList, getInternalSlot, GetOption, GetOptionsObject, invariant, isLiteralPart, PartitionPattern, setInternalSlot, SupportedLocales, } from '@formatjs/ecma402-abstract';
|
|
3
|
+
import { ResolveLocale } from '@formatjs/intl-localematcher';
|
|
6
4
|
function validateInstance(instance, method) {
|
|
7
5
|
if (!(instance instanceof ListFormat)) {
|
|
8
6
|
throw new TypeError("Method Intl.ListFormat.prototype.".concat(method, " called on incompatible receiver ").concat(String(instance)));
|
|
@@ -36,7 +34,7 @@ function createPartsFromList(internalSlotMap, lf, list) {
|
|
|
36
34
|
return [];
|
|
37
35
|
}
|
|
38
36
|
if (size === 2) {
|
|
39
|
-
var pattern =
|
|
37
|
+
var pattern = getInternalSlot(internalSlotMap, lf, 'templatePair');
|
|
40
38
|
var first = { type: 'element', value: list[0] };
|
|
41
39
|
var second = { type: 'element', value: list[1] };
|
|
42
40
|
return deconstructPattern(pattern, { '0': first, '1': second });
|
|
@@ -50,13 +48,13 @@ function createPartsFromList(internalSlotMap, lf, list) {
|
|
|
50
48
|
while (i >= 0) {
|
|
51
49
|
var pattern = void 0;
|
|
52
50
|
if (i === 0) {
|
|
53
|
-
pattern =
|
|
51
|
+
pattern = getInternalSlot(internalSlotMap, lf, 'templateStart');
|
|
54
52
|
}
|
|
55
53
|
else if (i < size - 2) {
|
|
56
|
-
pattern =
|
|
54
|
+
pattern = getInternalSlot(internalSlotMap, lf, 'templateMiddle');
|
|
57
55
|
}
|
|
58
56
|
else {
|
|
59
|
-
pattern =
|
|
57
|
+
pattern = getInternalSlot(internalSlotMap, lf, 'templateEnd');
|
|
60
58
|
}
|
|
61
59
|
var head = { type: 'element', value: list[i] };
|
|
62
60
|
parts = deconstructPattern(pattern, { '0': head, '1': parts });
|
|
@@ -65,19 +63,19 @@ function createPartsFromList(internalSlotMap, lf, list) {
|
|
|
65
63
|
return parts;
|
|
66
64
|
}
|
|
67
65
|
function deconstructPattern(pattern, placeables) {
|
|
68
|
-
var patternParts =
|
|
66
|
+
var patternParts = PartitionPattern(pattern);
|
|
69
67
|
var result = [];
|
|
70
68
|
for (var _i = 0, patternParts_1 = patternParts; _i < patternParts_1.length; _i++) {
|
|
71
69
|
var patternPart = patternParts_1[_i];
|
|
72
70
|
var part = patternPart.type;
|
|
73
|
-
if (
|
|
71
|
+
if (isLiteralPart(patternPart)) {
|
|
74
72
|
result.push({
|
|
75
73
|
type: 'literal',
|
|
76
74
|
value: patternPart.value,
|
|
77
75
|
});
|
|
78
76
|
}
|
|
79
77
|
else {
|
|
80
|
-
|
|
78
|
+
invariant(part in placeables, "".concat(part, " is missing from placables"));
|
|
81
79
|
var subst = placeables[part];
|
|
82
80
|
if (Array.isArray(subst)) {
|
|
83
81
|
result.push.apply(result, subst);
|
|
@@ -97,28 +95,28 @@ var ListFormat = /** @class */ (function () {
|
|
|
97
95
|
if (!newTarget) {
|
|
98
96
|
throw new TypeError("Intl.ListFormat must be called with 'new'");
|
|
99
97
|
}
|
|
100
|
-
|
|
101
|
-
var requestedLocales =
|
|
98
|
+
setInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'initializedListFormat', true);
|
|
99
|
+
var requestedLocales = CanonicalizeLocaleList(locales);
|
|
102
100
|
var opt = Object.create(null);
|
|
103
|
-
var opts =
|
|
104
|
-
var matcher =
|
|
101
|
+
var opts = GetOptionsObject(options);
|
|
102
|
+
var matcher = GetOption(opts, 'localeMatcher', 'string', ['best fit', 'lookup'], 'best fit');
|
|
105
103
|
opt.localeMatcher = matcher;
|
|
106
104
|
var localeData = ListFormat.localeData;
|
|
107
|
-
var r =
|
|
108
|
-
|
|
109
|
-
var type =
|
|
110
|
-
|
|
111
|
-
var style =
|
|
112
|
-
|
|
105
|
+
var r = ResolveLocale(ListFormat.availableLocales, requestedLocales, opt, ListFormat.relevantExtensionKeys, localeData, ListFormat.getDefaultLocale);
|
|
106
|
+
setInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'locale', r.locale);
|
|
107
|
+
var type = GetOption(opts, 'type', 'string', ['conjunction', 'disjunction', 'unit'], 'conjunction');
|
|
108
|
+
setInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'type', type);
|
|
109
|
+
var style = GetOption(opts, 'style', 'string', ['long', 'short', 'narrow'], 'long');
|
|
110
|
+
setInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'style', style);
|
|
113
111
|
var dataLocale = r.dataLocale;
|
|
114
112
|
var dataLocaleData = localeData[dataLocale];
|
|
115
|
-
|
|
113
|
+
invariant(!!dataLocaleData, "Missing locale data for ".concat(dataLocale));
|
|
116
114
|
var dataLocaleTypes = dataLocaleData[type];
|
|
117
115
|
var templates = dataLocaleTypes[style];
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
116
|
+
setInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'templatePair', templates.pair);
|
|
117
|
+
setInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'templateStart', templates.start);
|
|
118
|
+
setInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'templateMiddle', templates.middle);
|
|
119
|
+
setInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'templateEnd', templates.end);
|
|
122
120
|
}
|
|
123
121
|
ListFormat.prototype.format = function (elements) {
|
|
124
122
|
validateInstance(this, 'format');
|
|
@@ -142,21 +140,21 @@ var ListFormat = /** @class */ (function () {
|
|
|
142
140
|
var result = [];
|
|
143
141
|
for (var _i = 0, parts_2 = parts; _i < parts_2.length; _i++) {
|
|
144
142
|
var part = parts_2[_i];
|
|
145
|
-
result.push(
|
|
143
|
+
result.push(__assign({}, part));
|
|
146
144
|
}
|
|
147
145
|
return result;
|
|
148
146
|
};
|
|
149
147
|
ListFormat.prototype.resolvedOptions = function () {
|
|
150
148
|
validateInstance(this, 'resolvedOptions');
|
|
151
149
|
return {
|
|
152
|
-
locale:
|
|
153
|
-
type:
|
|
154
|
-
style:
|
|
150
|
+
locale: getInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'locale'),
|
|
151
|
+
type: getInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'type'),
|
|
152
|
+
style: getInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'style'),
|
|
155
153
|
};
|
|
156
154
|
};
|
|
157
155
|
ListFormat.supportedLocalesOf = function (locales, options) {
|
|
158
156
|
// test262/test/intl402/ListFormat/constructor/supportedLocalesOf/result-type.js
|
|
159
|
-
return
|
|
157
|
+
return SupportedLocales(ListFormat.availableLocales, CanonicalizeLocaleList(locales), options);
|
|
160
158
|
};
|
|
161
159
|
ListFormat.__addLocaleData = function () {
|
|
162
160
|
var data = [];
|
|
@@ -187,7 +185,7 @@ var ListFormat = /** @class */ (function () {
|
|
|
187
185
|
ListFormat.__INTERNAL_SLOT_MAP__ = new WeakMap();
|
|
188
186
|
return ListFormat;
|
|
189
187
|
}());
|
|
190
|
-
|
|
188
|
+
export default ListFormat;
|
|
191
189
|
try {
|
|
192
190
|
// IE11 does not have Symbol
|
|
193
191
|
if (typeof Symbol !== 'undefined') {
|
|
@@ -213,6 +211,6 @@ try {
|
|
|
213
211
|
configurable: true,
|
|
214
212
|
});
|
|
215
213
|
}
|
|
216
|
-
catch (
|
|
214
|
+
catch (_a) {
|
|
217
215
|
// Meta fix so we're test262-compliant, not important
|
|
218
216
|
}
|
package/package.json
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formatjs/intl-listformat",
|
|
3
3
|
"description": "Formats JS list in a i18n-safe way",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "8.0.0",
|
|
5
5
|
"author": "Long Ho <holevietlong@gmail.com>",
|
|
6
6
|
"bugs": "https://github.com/formatjs/formatjs/issues",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@formatjs/ecma402-abstract": "
|
|
9
|
-
"@formatjs/intl-localematcher": "0.
|
|
8
|
+
"@formatjs/ecma402-abstract": "3.0.0",
|
|
9
|
+
"@formatjs/intl-localematcher": "0.7.0",
|
|
10
10
|
"tslib": "^2.8.0"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@formatjs/intl-getcanonicallocales": "
|
|
14
|
-
"@formatjs/intl-locale": "
|
|
13
|
+
"@formatjs/intl-getcanonicallocales": "3.0.0",
|
|
14
|
+
"@formatjs/intl-locale": "5.0.0"
|
|
15
|
+
},
|
|
16
|
+
"exports": {
|
|
17
|
+
".": "./index.js",
|
|
18
|
+
"./polyfill.js": "./polyfill.js",
|
|
19
|
+
"./polyfill-force.js": "./polyfill-force.js",
|
|
20
|
+
"./should-polyfill.js": "./should-polyfill.js",
|
|
21
|
+
"./locale-data/*": "./locale-data/*"
|
|
15
22
|
},
|
|
16
23
|
"gitHead": "a7842673d8ad205171ad7c8cb8bb2f318b427c0c",
|
|
17
24
|
"homepage": "https://github.com/formatjs/formatjs",
|
|
@@ -24,7 +31,7 @@
|
|
|
24
31
|
"listformat"
|
|
25
32
|
],
|
|
26
33
|
"license": "MIT",
|
|
27
|
-
"main": "index.js",
|
|
28
34
|
"repository": "git@github.com:formatjs/formatjs.git",
|
|
35
|
+
"type": "module",
|
|
29
36
|
"types": "index.d.ts"
|
|
30
37
|
}
|
package/polyfill-force.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var tslib_1 = require("tslib");
|
|
4
|
-
var _1 = tslib_1.__importDefault(require("./"));
|
|
1
|
+
import ListFormat from './index.js';
|
|
5
2
|
Object.defineProperty(Intl, 'ListFormat', {
|
|
6
|
-
value:
|
|
3
|
+
value: ListFormat,
|
|
7
4
|
writable: true,
|
|
8
5
|
enumerable: false,
|
|
9
6
|
configurable: true,
|
package/polyfill.iife.js
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
return value;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/
|
|
23
|
+
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/CanonicalizeLocaleList.js
|
|
24
24
|
function CanonicalizeLocaleList(locales) {
|
|
25
25
|
return Intl.getCanonicalLocales(locales);
|
|
26
26
|
}
|
|
@@ -2385,12 +2385,11 @@
|
|
|
2385
2385
|
var Decimal = P.constructor = clone(DEFAULTS);
|
|
2386
2386
|
LN10 = new Decimal(LN10);
|
|
2387
2387
|
PI = new Decimal(PI);
|
|
2388
|
-
var decimal_default = Decimal;
|
|
2389
2388
|
|
|
2390
|
-
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/
|
|
2391
|
-
var TEN = new
|
|
2392
|
-
var ZERO = new
|
|
2393
|
-
var NEGATIVE_ZERO = new
|
|
2389
|
+
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/constants.js
|
|
2390
|
+
var TEN = new Decimal(10);
|
|
2391
|
+
var ZERO = new Decimal(0);
|
|
2392
|
+
var NEGATIVE_ZERO = new Decimal(-0);
|
|
2394
2393
|
|
|
2395
2394
|
// node_modules/.aspect_rules_js/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs
|
|
2396
2395
|
var extendStatics = function(d, b) {
|
|
@@ -2424,7 +2423,7 @@
|
|
|
2424
2423
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
2425
2424
|
}
|
|
2426
2425
|
|
|
2427
|
-
// node_modules/.aspect_rules_js/@formatjs+fast-memoize@0.0.0/node_modules/@formatjs/fast-memoize/
|
|
2426
|
+
// node_modules/.aspect_rules_js/@formatjs+fast-memoize@0.0.0/node_modules/@formatjs/fast-memoize/index.js
|
|
2428
2427
|
function memoize(fn, options) {
|
|
2429
2428
|
var cache = options && options.cache ? options.cache : cacheDefault;
|
|
2430
2429
|
var serializer = options && options.serializer ? options.serializer : serializerDefault;
|
|
@@ -2497,7 +2496,7 @@
|
|
|
2497
2496
|
monadic: strategyMonadic
|
|
2498
2497
|
};
|
|
2499
2498
|
|
|
2500
|
-
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/
|
|
2499
|
+
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/utils.js
|
|
2501
2500
|
function setInternalSlot(map, pl, field, value) {
|
|
2502
2501
|
if (!map.get(pl)) {
|
|
2503
2502
|
map.set(pl, /* @__PURE__ */ Object.create(null));
|
|
@@ -2584,7 +2583,7 @@
|
|
|
2584
2583
|
strategy: strategies.variadic
|
|
2585
2584
|
});
|
|
2586
2585
|
|
|
2587
|
-
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/
|
|
2586
|
+
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/262.js
|
|
2588
2587
|
function ToString(o) {
|
|
2589
2588
|
if (typeof o === "symbol") {
|
|
2590
2589
|
throw TypeError("Cannot convert a Symbol value to a string");
|
|
@@ -2603,7 +2602,7 @@
|
|
|
2603
2602
|
var MS_PER_MINUTE = MS_PER_SECOND * SECONDS_PER_MINUTE;
|
|
2604
2603
|
var MS_PER_HOUR = MS_PER_MINUTE * MINUTES_PER_HOUR;
|
|
2605
2604
|
|
|
2606
|
-
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/
|
|
2605
|
+
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/GetOption.js
|
|
2607
2606
|
function GetOption(opts, prop, type, values, fallback) {
|
|
2608
2607
|
if (typeof opts !== "object") {
|
|
2609
2608
|
throw new TypeError("Options must be an object");
|
|
@@ -2629,7 +2628,7 @@
|
|
|
2629
2628
|
return fallback;
|
|
2630
2629
|
}
|
|
2631
2630
|
|
|
2632
|
-
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/
|
|
2631
|
+
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/GetOptionsObject.js
|
|
2633
2632
|
function GetOptionsObject(options) {
|
|
2634
2633
|
if (typeof options === "undefined") {
|
|
2635
2634
|
return /* @__PURE__ */ Object.create(null);
|
|
@@ -2640,7 +2639,7 @@
|
|
|
2640
2639
|
throw new TypeError("Options must be an object");
|
|
2641
2640
|
}
|
|
2642
2641
|
|
|
2643
|
-
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/
|
|
2642
|
+
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/IsSanctionedSimpleUnitIdentifier.js
|
|
2644
2643
|
var SANCTIONED_UNITS = [
|
|
2645
2644
|
"angle-degree",
|
|
2646
2645
|
"area-acre",
|
|
@@ -2691,29 +2690,29 @@
|
|
|
2691
2690
|
}
|
|
2692
2691
|
var SIMPLE_UNITS = SANCTIONED_UNITS.map(removeUnitNamespace);
|
|
2693
2692
|
|
|
2694
|
-
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/
|
|
2695
|
-
|
|
2693
|
+
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/NumberFormat/ComputeExponentForMagnitude.js
|
|
2694
|
+
Decimal.set({
|
|
2696
2695
|
toExpPos: 100
|
|
2697
2696
|
});
|
|
2698
2697
|
|
|
2699
|
-
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/
|
|
2700
|
-
|
|
2698
|
+
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/NumberFormat/ToRawFixed.js
|
|
2699
|
+
Decimal.set({
|
|
2701
2700
|
toExpPos: 100
|
|
2702
2701
|
});
|
|
2703
2702
|
|
|
2704
|
-
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/
|
|
2703
|
+
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/regex.generated.js
|
|
2705
2704
|
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]/;
|
|
2706
2705
|
|
|
2707
|
-
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/
|
|
2706
|
+
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/NumberFormat/format_to_parts.js
|
|
2708
2707
|
var CARET_S_UNICODE_REGEX = new RegExp("^".concat(S_UNICODE_REGEX.source));
|
|
2709
2708
|
var S_DOLLAR_UNICODE_REGEX = new RegExp("".concat(S_UNICODE_REGEX.source, "$"));
|
|
2710
2709
|
|
|
2711
|
-
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/
|
|
2710
|
+
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/abstract/CanonicalizeLocaleList.js
|
|
2712
2711
|
function CanonicalizeLocaleList2(locales) {
|
|
2713
2712
|
return Intl.getCanonicalLocales(locales);
|
|
2714
2713
|
}
|
|
2715
2714
|
|
|
2716
|
-
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/
|
|
2715
|
+
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/abstract/languageMatching.js
|
|
2717
2716
|
var data = {
|
|
2718
2717
|
supplemental: {
|
|
2719
2718
|
languageMatching: {
|
|
@@ -5335,7 +5334,7 @@
|
|
|
5335
5334
|
}
|
|
5336
5335
|
};
|
|
5337
5336
|
|
|
5338
|
-
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/
|
|
5337
|
+
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/abstract/regions.generated.js
|
|
5339
5338
|
var regions = {
|
|
5340
5339
|
"001": [
|
|
5341
5340
|
"001",
|
|
@@ -6670,7 +6669,7 @@
|
|
|
6670
6669
|
]
|
|
6671
6670
|
};
|
|
6672
6671
|
|
|
6673
|
-
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/
|
|
6672
|
+
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/abstract/utils.js
|
|
6674
6673
|
var UNICODE_EXTENSION_SEQUENCE_REGEX = /-u(?:-[0-9a-z]{2,8})+/gi;
|
|
6675
6674
|
function invariant2(condition, message, Err) {
|
|
6676
6675
|
if (Err === void 0) {
|
|
@@ -6824,7 +6823,7 @@
|
|
|
6824
6823
|
return result;
|
|
6825
6824
|
}
|
|
6826
6825
|
|
|
6827
|
-
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/
|
|
6826
|
+
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/abstract/BestFitMatcher.js
|
|
6828
6827
|
function BestFitMatcher(availableLocales, requestedLocales, getDefaultLocale) {
|
|
6829
6828
|
var foundLocale;
|
|
6830
6829
|
var extension;
|
|
@@ -6849,7 +6848,7 @@
|
|
|
6849
6848
|
};
|
|
6850
6849
|
}
|
|
6851
6850
|
|
|
6852
|
-
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/
|
|
6851
|
+
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/abstract/CanonicalizeUValue.js
|
|
6853
6852
|
function CanonicalizeUValue(ukey, uvalue) {
|
|
6854
6853
|
var lowerValue = uvalue.toLowerCase();
|
|
6855
6854
|
invariant2(ukey !== void 0, "ukey must be defined");
|
|
@@ -6857,12 +6856,12 @@
|
|
|
6857
6856
|
return canonicalized;
|
|
6858
6857
|
}
|
|
6859
6858
|
|
|
6860
|
-
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/
|
|
6859
|
+
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/abstract/CanonicalizeUnicodeLocaleId.js
|
|
6861
6860
|
function CanonicalizeUnicodeLocaleId(locale) {
|
|
6862
6861
|
return Intl.getCanonicalLocales(locale)[0];
|
|
6863
6862
|
}
|
|
6864
6863
|
|
|
6865
|
-
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/
|
|
6864
|
+
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/abstract/InsertUnicodeExtensionAndCanonicalize.js
|
|
6866
6865
|
function InsertUnicodeExtensionAndCanonicalize(locale, attributes, keywords) {
|
|
6867
6866
|
invariant2(locale.indexOf("-u-") === -1, "Expected locale to not have a Unicode locale extension");
|
|
6868
6867
|
var extension = "-u";
|
|
@@ -6893,7 +6892,7 @@
|
|
|
6893
6892
|
return CanonicalizeUnicodeLocaleId(newLocale);
|
|
6894
6893
|
}
|
|
6895
6894
|
|
|
6896
|
-
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/
|
|
6895
|
+
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/abstract/BestAvailableLocale.js
|
|
6897
6896
|
function BestAvailableLocale(availableLocales, locale) {
|
|
6898
6897
|
var candidate = locale;
|
|
6899
6898
|
while (true) {
|
|
@@ -6911,7 +6910,7 @@
|
|
|
6911
6910
|
}
|
|
6912
6911
|
}
|
|
6913
6912
|
|
|
6914
|
-
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/
|
|
6913
|
+
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/abstract/LookupMatcher.js
|
|
6915
6914
|
function LookupMatcher(availableLocales, requestedLocales, getDefaultLocale) {
|
|
6916
6915
|
var result = { locale: "" };
|
|
6917
6916
|
for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
|
|
@@ -6930,7 +6929,7 @@
|
|
|
6930
6929
|
return result;
|
|
6931
6930
|
}
|
|
6932
6931
|
|
|
6933
|
-
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/
|
|
6932
|
+
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/abstract/UnicodeExtensionComponents.js
|
|
6934
6933
|
function UnicodeExtensionComponents(extension) {
|
|
6935
6934
|
invariant2(extension === extension.toLowerCase(), "Expected extension to be lowercase");
|
|
6936
6935
|
invariant2(extension.slice(0, 3) === "-u-", "Expected extension to be a Unicode locale extension");
|
|
@@ -6971,7 +6970,7 @@
|
|
|
6971
6970
|
return { attributes, keywords };
|
|
6972
6971
|
}
|
|
6973
6972
|
|
|
6974
|
-
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/
|
|
6973
|
+
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/abstract/ResolveLocale.js
|
|
6975
6974
|
function ResolveLocale(availableLocales, requestedLocales, options, relevantExtensionKeys, localeData, getDefaultLocale) {
|
|
6976
6975
|
var _a;
|
|
6977
6976
|
var matcher = options.localeMatcher;
|
|
@@ -7057,7 +7056,7 @@
|
|
|
7057
7056
|
return result;
|
|
7058
7057
|
}
|
|
7059
7058
|
|
|
7060
|
-
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/
|
|
7059
|
+
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/abstract/LookupSupportedLocales.js
|
|
7061
7060
|
function LookupSupportedLocales(availableLocales, requestedLocales) {
|
|
7062
7061
|
var subset = [];
|
|
7063
7062
|
for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
|
|
@@ -7071,7 +7070,7 @@
|
|
|
7071
7070
|
return subset;
|
|
7072
7071
|
}
|
|
7073
7072
|
|
|
7074
|
-
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/
|
|
7073
|
+
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/index.js
|
|
7075
7074
|
function match(requestedLocales, availableLocales, defaultLocale, opts) {
|
|
7076
7075
|
return ResolveLocale(availableLocales, CanonicalizeLocaleList2(requestedLocales), {
|
|
7077
7076
|
localeMatcher: (opts === null || opts === void 0 ? void 0 : opts.algorithm) || "best fit"
|
|
@@ -7080,7 +7079,7 @@
|
|
|
7080
7079
|
}).locale;
|
|
7081
7080
|
}
|
|
7082
7081
|
|
|
7083
|
-
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/
|
|
7082
|
+
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/PartitionPattern.js
|
|
7084
7083
|
function PartitionPattern(pattern) {
|
|
7085
7084
|
var result = [];
|
|
7086
7085
|
var beginIndex = pattern.indexOf("{");
|
|
@@ -7112,7 +7111,7 @@
|
|
|
7112
7111
|
return result;
|
|
7113
7112
|
}
|
|
7114
7113
|
|
|
7115
|
-
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/
|
|
7114
|
+
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/SupportedLocales.js
|
|
7116
7115
|
function SupportedLocales(availableLocales, requestedLocales, options) {
|
|
7117
7116
|
var matcher = "best fit";
|
|
7118
7117
|
if (options !== void 0) {
|
|
@@ -7125,7 +7124,7 @@
|
|
|
7125
7124
|
return LookupSupportedLocales(Array.from(availableLocales), requestedLocales);
|
|
7126
7125
|
}
|
|
7127
7126
|
|
|
7128
|
-
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/
|
|
7127
|
+
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/data.js
|
|
7129
7128
|
var MissingLocaleDataError = (
|
|
7130
7129
|
/** @class */
|
|
7131
7130
|
function(_super) {
|
|
@@ -7139,7 +7138,7 @@
|
|
|
7139
7138
|
}(Error)
|
|
7140
7139
|
);
|
|
7141
7140
|
|
|
7142
|
-
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/
|
|
7141
|
+
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/types/date-time.js
|
|
7143
7142
|
var RangePatternType;
|
|
7144
7143
|
(function(RangePatternType2) {
|
|
7145
7144
|
RangePatternType2["startRange"] = "startRange";
|
package/polyfill.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var _1 = tslib_1.__importDefault(require("./"));
|
|
5
|
-
var should_polyfill_1 = require("./should-polyfill");
|
|
6
|
-
if ((0, should_polyfill_1.shouldPolyfill)()) {
|
|
1
|
+
import ListFormat from './index.js';
|
|
2
|
+
import { shouldPolyfill } from './should-polyfill.js';
|
|
3
|
+
if (shouldPolyfill()) {
|
|
7
4
|
Object.defineProperty(Intl, 'ListFormat', {
|
|
8
|
-
value:
|
|
5
|
+
value: ListFormat,
|
|
9
6
|
writable: true,
|
|
10
7
|
enumerable: false,
|
|
11
8
|
configurable: true,
|
package/should-polyfill.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.shouldPolyfill = shouldPolyfill;
|
|
4
|
-
var intl_localematcher_1 = require("@formatjs/intl-localematcher");
|
|
5
|
-
var supported_locales_generated_1 = require("./supported-locales.generated");
|
|
1
|
+
import { match } from '@formatjs/intl-localematcher';
|
|
2
|
+
import { supportedLocales } from './supported-locales.generated.js';
|
|
6
3
|
function supportedLocalesOf(locale) {
|
|
7
4
|
if (!locale) {
|
|
8
5
|
return true;
|
|
@@ -11,9 +8,9 @@ function supportedLocalesOf(locale) {
|
|
|
11
8
|
return (Intl.ListFormat.supportedLocalesOf(locales).length ===
|
|
12
9
|
locales.length);
|
|
13
10
|
}
|
|
14
|
-
function shouldPolyfill(locale) {
|
|
11
|
+
export function shouldPolyfill(locale) {
|
|
15
12
|
if (locale === void 0) { locale = 'en'; }
|
|
16
13
|
if (!('ListFormat' in Intl) || !supportedLocalesOf(locale)) {
|
|
17
|
-
return locale ?
|
|
14
|
+
return locale ? match([locale], supportedLocales, 'en') : undefined;
|
|
18
15
|
}
|
|
19
16
|
}
|
|
@@ -1,4 +1 @@
|
|
|
1
|
-
"
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.supportedLocales = void 0;
|
|
4
|
-
exports.supportedLocales = ["af", "af-NA", "agq", "ak", "am", "ar", "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", "as", "asa", "ast", "az", "az-Cyrl", "az-Latn", "bas", "be", "be-tarask", "bem", "bez", "bg", "bm", "bn", "bn-IN", "bo", "bo-IN", "br", "brx", "bs", "bs-Cyrl", "bs-Latn", "ca", "ca-AD", "ca-ES-valencia", "ca-FR", "ca-IT", "ccp", "ccp-IN", "ce", "ceb", "cgg", "chr", "ckb", "ckb-IR", "cs", "cy", "da", "da-GL", "dav", "de", "de-AT", "de-BE", "de-CH", "de-IT", "de-LI", "de-LU", "dje", "doi", "dsb", "dua", "dyo", "dz", "ebu", "ee", "ee-TG", "el", "el-CY", "en", "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-VC", "en-VG", "en-VI", "en-VU", "en-WS", "en-ZA", "en-ZM", "en-ZW", "eo", "es", "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", "et", "eu", "ewo", "fa", "fa-AF", "ff", "ff-Adlm", "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-Latn", "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", "fi", "fil", "fo", "fo-DK", "fr", "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", "fur", "fy", "ga", "ga-GB", "gd", "gl", "gsw", "gsw-FR", "gsw-LI", "gu", "guz", "gv", "ha", "ha-GH", "ha-NE", "haw", "he", "hi", "hr", "hr-BA", "hsb", "hu", "hy", "ia", "id", "ig", "ii", "is", "it", "it-CH", "it-SM", "it-VA", "ja", "jgo", "jmc", "jv", "ka", "kab", "kam", "kde", "kea", "kgp", "khq", "ki", "kk", "kkj", "kl", "kln", "km", "kn", "ko", "ko-KP", "kok", "ks", "ks-Arab", "ksb", "ksf", "ksh", "ku", "kw", "ky", "lag", "lb", "lg", "lkt", "ln", "ln-AO", "ln-CF", "ln-CG", "lo", "lrc", "lrc-IQ", "lt", "lu", "luo", "luy", "lv", "mai", "mas", "mas-TZ", "mer", "mfe", "mg", "mgh", "mgo", "mi", "mk", "ml", "mn", "mni", "mni-Beng", "mr", "ms", "ms-BN", "ms-ID", "ms-SG", "mt", "mua", "my", "mzn", "naq", "nb", "nb-SJ", "nd", "nds", "nds-NL", "ne", "ne-IN", "nl", "nl-AW", "nl-BE", "nl-BQ", "nl-CW", "nl-SR", "nl-SX", "nmg", "nn", "nnh", "no", "nus", "nyn", "om", "om-KE", "or", "os", "os-RU", "pa", "pa-Arab", "pa-Guru", "pcm", "pl", "ps", "ps-PK", "pt", "pt-AO", "pt-CH", "pt-CV", "pt-GQ", "pt-GW", "pt-LU", "pt-MO", "pt-MZ", "pt-PT", "pt-ST", "pt-TL", "qu", "qu-BO", "qu-EC", "rm", "rn", "ro", "ro-MD", "rof", "ru", "ru-BY", "ru-KG", "ru-KZ", "ru-MD", "ru-UA", "rw", "rwk", "sa", "sah", "saq", "sat", "sat-Olck", "sbp", "sc", "sd", "sd-Arab", "sd-Deva", "se", "se-FI", "se-SE", "seh", "ses", "sg", "shi", "shi-Latn", "shi-Tfng", "si", "sk", "sl", "smn", "sn", "so", "so-DJ", "so-ET", "so-KE", "sq", "sq-MK", "sq-XK", "sr", "sr-Cyrl", "sr-Cyrl-BA", "sr-Cyrl-ME", "sr-Cyrl-XK", "sr-Latn", "sr-Latn-BA", "sr-Latn-ME", "sr-Latn-XK", "su", "su-Latn", "sv", "sv-AX", "sv-FI", "sw", "sw-CD", "sw-KE", "sw-UG", "ta", "ta-LK", "ta-MY", "ta-SG", "te", "teo", "teo-KE", "tg", "th", "ti", "ti-ER", "tk", "to", "tr", "tr-CY", "tt", "twq", "tzm", "ug", "uk", "und", "ur", "ur-IN", "uz", "uz-Arab", "uz-Cyrl", "uz-Latn", "vai", "vai-Latn", "vai-Vaii", "vi", "vun", "wae", "wo", "xh", "xog", "yav", "yi", "yo", "yo-BJ", "yrl", "yrl-CO", "yrl-VE", "yue", "yue-Hans", "yue-Hant", "zgh", "zh", "zh-Hans", "zh-Hans-HK", "zh-Hans-MO", "zh-Hans-SG", "zh-Hant", "zh-Hant-HK", "zh-Hant-MO", "zu"];
|
|
1
|
+
export var supportedLocales = ["af", "af-NA", "agq", "ak", "am", "ar", "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", "as", "asa", "ast", "az", "az-Cyrl", "az-Latn", "bas", "be", "be-tarask", "bem", "bez", "bg", "bm", "bn", "bn-IN", "bo", "bo-IN", "br", "brx", "bs", "bs-Cyrl", "bs-Latn", "ca", "ca-AD", "ca-ES-valencia", "ca-FR", "ca-IT", "ccp", "ccp-IN", "ce", "ceb", "cgg", "chr", "ckb", "ckb-IR", "cs", "cy", "da", "da-GL", "dav", "de", "de-AT", "de-BE", "de-CH", "de-IT", "de-LI", "de-LU", "dje", "doi", "dsb", "dua", "dyo", "dz", "ebu", "ee", "ee-TG", "el", "el-CY", "en", "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-VC", "en-VG", "en-VI", "en-VU", "en-WS", "en-ZA", "en-ZM", "en-ZW", "eo", "es", "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", "et", "eu", "ewo", "fa", "fa-AF", "ff", "ff-Adlm", "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-Latn", "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", "fi", "fil", "fo", "fo-DK", "fr", "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", "fur", "fy", "ga", "ga-GB", "gd", "gl", "gsw", "gsw-FR", "gsw-LI", "gu", "guz", "gv", "ha", "ha-GH", "ha-NE", "haw", "he", "hi", "hr", "hr-BA", "hsb", "hu", "hy", "ia", "id", "ig", "ii", "is", "it", "it-CH", "it-SM", "it-VA", "ja", "jgo", "jmc", "jv", "ka", "kab", "kam", "kde", "kea", "kgp", "khq", "ki", "kk", "kkj", "kl", "kln", "km", "kn", "ko", "ko-KP", "kok", "ks", "ks-Arab", "ksb", "ksf", "ksh", "ku", "kw", "ky", "lag", "lb", "lg", "lkt", "ln", "ln-AO", "ln-CF", "ln-CG", "lo", "lrc", "lrc-IQ", "lt", "lu", "luo", "luy", "lv", "mai", "mas", "mas-TZ", "mer", "mfe", "mg", "mgh", "mgo", "mi", "mk", "ml", "mn", "mni", "mni-Beng", "mr", "ms", "ms-BN", "ms-ID", "ms-SG", "mt", "mua", "my", "mzn", "naq", "nb", "nb-SJ", "nd", "nds", "nds-NL", "ne", "ne-IN", "nl", "nl-AW", "nl-BE", "nl-BQ", "nl-CW", "nl-SR", "nl-SX", "nmg", "nn", "nnh", "no", "nus", "nyn", "om", "om-KE", "or", "os", "os-RU", "pa", "pa-Arab", "pa-Guru", "pcm", "pl", "ps", "ps-PK", "pt", "pt-AO", "pt-CH", "pt-CV", "pt-GQ", "pt-GW", "pt-LU", "pt-MO", "pt-MZ", "pt-PT", "pt-ST", "pt-TL", "qu", "qu-BO", "qu-EC", "rm", "rn", "ro", "ro-MD", "rof", "ru", "ru-BY", "ru-KG", "ru-KZ", "ru-MD", "ru-UA", "rw", "rwk", "sa", "sah", "saq", "sat", "sat-Olck", "sbp", "sc", "sd", "sd-Arab", "sd-Deva", "se", "se-FI", "se-SE", "seh", "ses", "sg", "shi", "shi-Latn", "shi-Tfng", "si", "sk", "sl", "smn", "sn", "so", "so-DJ", "so-ET", "so-KE", "sq", "sq-MK", "sq-XK", "sr", "sr-Cyrl", "sr-Cyrl-BA", "sr-Cyrl-ME", "sr-Cyrl-XK", "sr-Latn", "sr-Latn-BA", "sr-Latn-ME", "sr-Latn-XK", "su", "su-Latn", "sv", "sv-AX", "sv-FI", "sw", "sw-CD", "sw-KE", "sw-UG", "ta", "ta-LK", "ta-MY", "ta-SG", "te", "teo", "teo-KE", "tg", "th", "ti", "ti-ER", "tk", "to", "tr", "tr-CY", "tt", "twq", "tzm", "ug", "uk", "und", "ur", "ur-IN", "uz", "uz-Arab", "uz-Cyrl", "uz-Latn", "vai", "vai-Latn", "vai-Vaii", "vi", "vun", "wae", "wo", "xh", "xog", "yav", "yi", "yo", "yo-BJ", "yrl", "yrl-CO", "yrl-VE", "yue", "yue-Hans", "yue-Hant", "zgh", "zh", "zh-Hans", "zh-Hans-HK", "zh-Hans-MO", "zh-Hans-SG", "zh-Hant", "zh-Hant-HK", "zh-Hant-MO", "zu"];
|
package/lib/index.d.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { ListPatternFieldsData, ListPatternLocaleData, LiteralPart } from '@formatjs/ecma402-abstract';
|
|
2
|
-
export interface IntlListFormatOptions {
|
|
3
|
-
/**
|
|
4
|
-
* The locale matching algorithm to use.
|
|
5
|
-
* Possible values are "lookup" and "best fit"; the default is "best fit".
|
|
6
|
-
* For information about this option, see
|
|
7
|
-
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation.
|
|
8
|
-
*/
|
|
9
|
-
localeMatcher?: 'best fit' | 'lookup';
|
|
10
|
-
/**
|
|
11
|
-
* The format of output message.
|
|
12
|
-
* Possible values are :
|
|
13
|
-
* - "conjunction" that stands for "and"-based lists (default, e.g., "A, B, and C")
|
|
14
|
-
* - "disjunction" that stands for "or"-based lists (e.g., "A, B, or C").
|
|
15
|
-
* - "unit" stands for lists of values with units (e.g., "5 pounds, 12 ounces").
|
|
16
|
-
*/
|
|
17
|
-
type?: 'conjunction' | 'disjunction' | 'unit';
|
|
18
|
-
/**
|
|
19
|
-
* The length of the formatted message.
|
|
20
|
-
* Possible values are:
|
|
21
|
-
* - "long" (default, e.g., "A, B, and C");
|
|
22
|
-
* - "short" (e.g., "A, B, C"), or
|
|
23
|
-
* - "narrow" (e.g., "A B C").
|
|
24
|
-
* When style is "short" or "narrow", "unit" is the only allowed value for the type option.
|
|
25
|
-
*/
|
|
26
|
-
style?: 'long' | 'short' | 'narrow';
|
|
27
|
-
}
|
|
28
|
-
export interface ResolvedIntlListFormatOptions {
|
|
29
|
-
/**
|
|
30
|
-
* A string with a BCP 47 language tag, or an array of such strings.
|
|
31
|
-
* For the general form and interpretation of the locales argument,
|
|
32
|
-
* see the [Intl](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locale_identification_and_negotiation) page.
|
|
33
|
-
*/
|
|
34
|
-
locale: string;
|
|
35
|
-
/**
|
|
36
|
-
* The format of output message.
|
|
37
|
-
* Possible values are :
|
|
38
|
-
* - "conjunction" that stands for "and"-based lists (default, e.g., "A, B, and C")
|
|
39
|
-
* - "disjunction" that stands for "or"-based lists (e.g., "A, B, or C").
|
|
40
|
-
* - "unit" stands for lists of values with units (e.g., "5 pounds, 12 ounces").
|
|
41
|
-
*/
|
|
42
|
-
type: 'conjunction' | 'disjunction' | 'unit';
|
|
43
|
-
/**
|
|
44
|
-
* The length of the formatted message.
|
|
45
|
-
* Possible values are:
|
|
46
|
-
* - "long" (default, e.g., "A, B, and C");
|
|
47
|
-
* - "short" (e.g., "A, B, C"), or
|
|
48
|
-
* - "narrow" (e.g., "A B C").
|
|
49
|
-
* When style is "short" or "narrow", "unit" is the only allowed value for the type option.
|
|
50
|
-
*/
|
|
51
|
-
style: 'long' | 'short' | 'narrow';
|
|
52
|
-
}
|
|
53
|
-
export type Part<T = string> = LiteralPart | ElementPart | ElementPart<T>;
|
|
54
|
-
export interface ElementPart<T = string> {
|
|
55
|
-
type: 'element';
|
|
56
|
-
value: T;
|
|
57
|
-
}
|
|
58
|
-
export default class ListFormat {
|
|
59
|
-
constructor(locales?: string | string[], options?: IntlListFormatOptions);
|
|
60
|
-
format(elements: Iterable<string>): string;
|
|
61
|
-
formatToParts(elements: Iterable<string>): Part[];
|
|
62
|
-
resolvedOptions(): ResolvedIntlListFormatOptions;
|
|
63
|
-
static supportedLocalesOf(locales: string | string[], options?: Pick<IntlListFormatOptions, 'localeMatcher'>): string[];
|
|
64
|
-
static __addLocaleData(...data: ListPatternLocaleData[]): void;
|
|
65
|
-
static localeData: Record<string, ListPatternFieldsData | undefined>;
|
|
66
|
-
private static availableLocales;
|
|
67
|
-
private static __defaultLocale;
|
|
68
|
-
private static getDefaultLocale;
|
|
69
|
-
private static relevantExtensionKeys;
|
|
70
|
-
static polyfilled: boolean;
|
|
71
|
-
private static readonly __INTERNAL_SLOT_MAP__;
|
|
72
|
-
}
|
package/lib/index.js
DELETED
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
|
-
import { CanonicalizeLocaleList, getInternalSlot, GetOption, GetOptionsObject, invariant, isLiteralPart, PartitionPattern, setInternalSlot, SupportedLocales, } from '@formatjs/ecma402-abstract';
|
|
3
|
-
import { ResolveLocale } from '@formatjs/intl-localematcher';
|
|
4
|
-
function validateInstance(instance, method) {
|
|
5
|
-
if (!(instance instanceof ListFormat)) {
|
|
6
|
-
throw new TypeError("Method Intl.ListFormat.prototype.".concat(method, " called on incompatible receiver ").concat(String(instance)));
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* https://tc39.es/proposal-intl-list-format/#sec-createstringlistfromiterable
|
|
11
|
-
* @param iterable list
|
|
12
|
-
*/
|
|
13
|
-
function stringListFromIterable(iterable) {
|
|
14
|
-
if (typeof iterable !== 'object')
|
|
15
|
-
return [];
|
|
16
|
-
var elements = [];
|
|
17
|
-
var iterator = iterable[Symbol.iterator]();
|
|
18
|
-
var result;
|
|
19
|
-
while (true) {
|
|
20
|
-
result = iterator.next();
|
|
21
|
-
if (result.done)
|
|
22
|
-
break;
|
|
23
|
-
if (typeof result.value !== 'string') {
|
|
24
|
-
var nextValue = result.value;
|
|
25
|
-
throw new TypeError("Iterable yielded ".concat(nextValue, " which is not a string"));
|
|
26
|
-
}
|
|
27
|
-
elements.push(result.value);
|
|
28
|
-
}
|
|
29
|
-
return elements;
|
|
30
|
-
}
|
|
31
|
-
function createPartsFromList(internalSlotMap, lf, list) {
|
|
32
|
-
var size = list.length;
|
|
33
|
-
if (size === 0) {
|
|
34
|
-
return [];
|
|
35
|
-
}
|
|
36
|
-
if (size === 2) {
|
|
37
|
-
var pattern = getInternalSlot(internalSlotMap, lf, 'templatePair');
|
|
38
|
-
var first = { type: 'element', value: list[0] };
|
|
39
|
-
var second = { type: 'element', value: list[1] };
|
|
40
|
-
return deconstructPattern(pattern, { '0': first, '1': second });
|
|
41
|
-
}
|
|
42
|
-
var last = {
|
|
43
|
-
type: 'element',
|
|
44
|
-
value: list[size - 1],
|
|
45
|
-
};
|
|
46
|
-
var parts = last;
|
|
47
|
-
var i = size - 2;
|
|
48
|
-
while (i >= 0) {
|
|
49
|
-
var pattern = void 0;
|
|
50
|
-
if (i === 0) {
|
|
51
|
-
pattern = getInternalSlot(internalSlotMap, lf, 'templateStart');
|
|
52
|
-
}
|
|
53
|
-
else if (i < size - 2) {
|
|
54
|
-
pattern = getInternalSlot(internalSlotMap, lf, 'templateMiddle');
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
pattern = getInternalSlot(internalSlotMap, lf, 'templateEnd');
|
|
58
|
-
}
|
|
59
|
-
var head = { type: 'element', value: list[i] };
|
|
60
|
-
parts = deconstructPattern(pattern, { '0': head, '1': parts });
|
|
61
|
-
i--;
|
|
62
|
-
}
|
|
63
|
-
return parts;
|
|
64
|
-
}
|
|
65
|
-
function deconstructPattern(pattern, placeables) {
|
|
66
|
-
var patternParts = PartitionPattern(pattern);
|
|
67
|
-
var result = [];
|
|
68
|
-
for (var _i = 0, patternParts_1 = patternParts; _i < patternParts_1.length; _i++) {
|
|
69
|
-
var patternPart = patternParts_1[_i];
|
|
70
|
-
var part = patternPart.type;
|
|
71
|
-
if (isLiteralPart(patternPart)) {
|
|
72
|
-
result.push({
|
|
73
|
-
type: 'literal',
|
|
74
|
-
value: patternPart.value,
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
invariant(part in placeables, "".concat(part, " is missing from placables"));
|
|
79
|
-
var subst = placeables[part];
|
|
80
|
-
if (Array.isArray(subst)) {
|
|
81
|
-
result.push.apply(result, subst);
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
result.push(subst);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return result;
|
|
89
|
-
}
|
|
90
|
-
var ListFormat = /** @class */ (function () {
|
|
91
|
-
function ListFormat(locales, options) {
|
|
92
|
-
// test262/test/intl402/ListFormat/constructor/constructor/newtarget-undefined.js
|
|
93
|
-
// Cannot use `new.target` bc of IE11 & TS transpiles it to something else
|
|
94
|
-
var newTarget = this && this instanceof ListFormat ? this.constructor : void 0;
|
|
95
|
-
if (!newTarget) {
|
|
96
|
-
throw new TypeError("Intl.ListFormat must be called with 'new'");
|
|
97
|
-
}
|
|
98
|
-
setInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'initializedListFormat', true);
|
|
99
|
-
var requestedLocales = CanonicalizeLocaleList(locales);
|
|
100
|
-
var opt = Object.create(null);
|
|
101
|
-
var opts = GetOptionsObject(options);
|
|
102
|
-
var matcher = GetOption(opts, 'localeMatcher', 'string', ['best fit', 'lookup'], 'best fit');
|
|
103
|
-
opt.localeMatcher = matcher;
|
|
104
|
-
var localeData = ListFormat.localeData;
|
|
105
|
-
var r = ResolveLocale(ListFormat.availableLocales, requestedLocales, opt, ListFormat.relevantExtensionKeys, localeData, ListFormat.getDefaultLocale);
|
|
106
|
-
setInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'locale', r.locale);
|
|
107
|
-
var type = GetOption(opts, 'type', 'string', ['conjunction', 'disjunction', 'unit'], 'conjunction');
|
|
108
|
-
setInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'type', type);
|
|
109
|
-
var style = GetOption(opts, 'style', 'string', ['long', 'short', 'narrow'], 'long');
|
|
110
|
-
setInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'style', style);
|
|
111
|
-
var dataLocale = r.dataLocale;
|
|
112
|
-
var dataLocaleData = localeData[dataLocale];
|
|
113
|
-
invariant(!!dataLocaleData, "Missing locale data for ".concat(dataLocale));
|
|
114
|
-
var dataLocaleTypes = dataLocaleData[type];
|
|
115
|
-
var templates = dataLocaleTypes[style];
|
|
116
|
-
setInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'templatePair', templates.pair);
|
|
117
|
-
setInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'templateStart', templates.start);
|
|
118
|
-
setInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'templateMiddle', templates.middle);
|
|
119
|
-
setInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'templateEnd', templates.end);
|
|
120
|
-
}
|
|
121
|
-
ListFormat.prototype.format = function (elements) {
|
|
122
|
-
validateInstance(this, 'format');
|
|
123
|
-
var result = '';
|
|
124
|
-
var parts = createPartsFromList(ListFormat.__INTERNAL_SLOT_MAP__, this, stringListFromIterable(elements));
|
|
125
|
-
if (!Array.isArray(parts)) {
|
|
126
|
-
return parts.value;
|
|
127
|
-
}
|
|
128
|
-
for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {
|
|
129
|
-
var p = parts_1[_i];
|
|
130
|
-
result += p.value;
|
|
131
|
-
}
|
|
132
|
-
return result;
|
|
133
|
-
};
|
|
134
|
-
ListFormat.prototype.formatToParts = function (elements) {
|
|
135
|
-
validateInstance(this, 'format');
|
|
136
|
-
var parts = createPartsFromList(ListFormat.__INTERNAL_SLOT_MAP__, this, stringListFromIterable(elements));
|
|
137
|
-
if (!Array.isArray(parts)) {
|
|
138
|
-
return [parts];
|
|
139
|
-
}
|
|
140
|
-
var result = [];
|
|
141
|
-
for (var _i = 0, parts_2 = parts; _i < parts_2.length; _i++) {
|
|
142
|
-
var part = parts_2[_i];
|
|
143
|
-
result.push(__assign({}, part));
|
|
144
|
-
}
|
|
145
|
-
return result;
|
|
146
|
-
};
|
|
147
|
-
ListFormat.prototype.resolvedOptions = function () {
|
|
148
|
-
validateInstance(this, 'resolvedOptions');
|
|
149
|
-
return {
|
|
150
|
-
locale: getInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'locale'),
|
|
151
|
-
type: getInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'type'),
|
|
152
|
-
style: getInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'style'),
|
|
153
|
-
};
|
|
154
|
-
};
|
|
155
|
-
ListFormat.supportedLocalesOf = function (locales, options) {
|
|
156
|
-
// test262/test/intl402/ListFormat/constructor/supportedLocalesOf/result-type.js
|
|
157
|
-
return SupportedLocales(ListFormat.availableLocales, CanonicalizeLocaleList(locales), options);
|
|
158
|
-
};
|
|
159
|
-
ListFormat.__addLocaleData = function () {
|
|
160
|
-
var data = [];
|
|
161
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
162
|
-
data[_i] = arguments[_i];
|
|
163
|
-
}
|
|
164
|
-
for (var _a = 0, data_1 = data; _a < data_1.length; _a++) {
|
|
165
|
-
var _b = data_1[_a], d = _b.data, locale = _b.locale;
|
|
166
|
-
var minimizedLocale = new Intl.Locale(locale)
|
|
167
|
-
.minimize()
|
|
168
|
-
.toString();
|
|
169
|
-
ListFormat.localeData[locale] = ListFormat.localeData[minimizedLocale] = d;
|
|
170
|
-
ListFormat.availableLocales.add(minimizedLocale);
|
|
171
|
-
ListFormat.availableLocales.add(locale);
|
|
172
|
-
if (!ListFormat.__defaultLocale) {
|
|
173
|
-
ListFormat.__defaultLocale = minimizedLocale;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
ListFormat.getDefaultLocale = function () {
|
|
178
|
-
return ListFormat.__defaultLocale;
|
|
179
|
-
};
|
|
180
|
-
ListFormat.localeData = {};
|
|
181
|
-
ListFormat.availableLocales = new Set();
|
|
182
|
-
ListFormat.__defaultLocale = '';
|
|
183
|
-
ListFormat.relevantExtensionKeys = [];
|
|
184
|
-
ListFormat.polyfilled = true;
|
|
185
|
-
ListFormat.__INTERNAL_SLOT_MAP__ = new WeakMap();
|
|
186
|
-
return ListFormat;
|
|
187
|
-
}());
|
|
188
|
-
export default ListFormat;
|
|
189
|
-
try {
|
|
190
|
-
// IE11 does not have Symbol
|
|
191
|
-
if (typeof Symbol !== 'undefined') {
|
|
192
|
-
Object.defineProperty(ListFormat.prototype, Symbol.toStringTag, {
|
|
193
|
-
value: 'Intl.ListFormat',
|
|
194
|
-
writable: false,
|
|
195
|
-
enumerable: false,
|
|
196
|
-
configurable: true,
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
// https://github.com/tc39/test262/blob/master/test/intl402/ListFormat/constructor/length.js
|
|
200
|
-
Object.defineProperty(ListFormat.prototype.constructor, 'length', {
|
|
201
|
-
value: 0,
|
|
202
|
-
writable: false,
|
|
203
|
-
enumerable: false,
|
|
204
|
-
configurable: true,
|
|
205
|
-
});
|
|
206
|
-
// https://github.com/tc39/test262/blob/master/test/intl402/ListFormat/constructor/supportedLocalesOf/length.js
|
|
207
|
-
Object.defineProperty(ListFormat.supportedLocalesOf, 'length', {
|
|
208
|
-
value: 1,
|
|
209
|
-
writable: false,
|
|
210
|
-
enumerable: false,
|
|
211
|
-
configurable: true,
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
catch (e) {
|
|
215
|
-
// Meta fix so we're test262-compliant, not important
|
|
216
|
-
}
|
package/lib/polyfill-force.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/polyfill-force.js
DELETED
package/lib/polyfill.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/polyfill.js
DELETED
package/lib/should-polyfill.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function shouldPolyfill(locale?: string): string | undefined;
|
package/lib/should-polyfill.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { match } from '@formatjs/intl-localematcher';
|
|
2
|
-
import { supportedLocales } from './supported-locales.generated';
|
|
3
|
-
function supportedLocalesOf(locale) {
|
|
4
|
-
if (!locale) {
|
|
5
|
-
return true;
|
|
6
|
-
}
|
|
7
|
-
var locales = Array.isArray(locale) ? locale : [locale];
|
|
8
|
-
return (Intl.ListFormat.supportedLocalesOf(locales).length ===
|
|
9
|
-
locales.length);
|
|
10
|
-
}
|
|
11
|
-
export function shouldPolyfill(locale) {
|
|
12
|
-
if (locale === void 0) { locale = 'en'; }
|
|
13
|
-
if (!('ListFormat' in Intl) || !supportedLocalesOf(locale)) {
|
|
14
|
-
return locale ? match([locale], supportedLocales, 'en') : undefined;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const supportedLocales: string[];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export var supportedLocales = ["af", "af-NA", "agq", "ak", "am", "ar", "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", "as", "asa", "ast", "az", "az-Cyrl", "az-Latn", "bas", "be", "be-tarask", "bem", "bez", "bg", "bm", "bn", "bn-IN", "bo", "bo-IN", "br", "brx", "bs", "bs-Cyrl", "bs-Latn", "ca", "ca-AD", "ca-ES-valencia", "ca-FR", "ca-IT", "ccp", "ccp-IN", "ce", "ceb", "cgg", "chr", "ckb", "ckb-IR", "cs", "cy", "da", "da-GL", "dav", "de", "de-AT", "de-BE", "de-CH", "de-IT", "de-LI", "de-LU", "dje", "doi", "dsb", "dua", "dyo", "dz", "ebu", "ee", "ee-TG", "el", "el-CY", "en", "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-VC", "en-VG", "en-VI", "en-VU", "en-WS", "en-ZA", "en-ZM", "en-ZW", "eo", "es", "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", "et", "eu", "ewo", "fa", "fa-AF", "ff", "ff-Adlm", "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-Latn", "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", "fi", "fil", "fo", "fo-DK", "fr", "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", "fur", "fy", "ga", "ga-GB", "gd", "gl", "gsw", "gsw-FR", "gsw-LI", "gu", "guz", "gv", "ha", "ha-GH", "ha-NE", "haw", "he", "hi", "hr", "hr-BA", "hsb", "hu", "hy", "ia", "id", "ig", "ii", "is", "it", "it-CH", "it-SM", "it-VA", "ja", "jgo", "jmc", "jv", "ka", "kab", "kam", "kde", "kea", "kgp", "khq", "ki", "kk", "kkj", "kl", "kln", "km", "kn", "ko", "ko-KP", "kok", "ks", "ks-Arab", "ksb", "ksf", "ksh", "ku", "kw", "ky", "lag", "lb", "lg", "lkt", "ln", "ln-AO", "ln-CF", "ln-CG", "lo", "lrc", "lrc-IQ", "lt", "lu", "luo", "luy", "lv", "mai", "mas", "mas-TZ", "mer", "mfe", "mg", "mgh", "mgo", "mi", "mk", "ml", "mn", "mni", "mni-Beng", "mr", "ms", "ms-BN", "ms-ID", "ms-SG", "mt", "mua", "my", "mzn", "naq", "nb", "nb-SJ", "nd", "nds", "nds-NL", "ne", "ne-IN", "nl", "nl-AW", "nl-BE", "nl-BQ", "nl-CW", "nl-SR", "nl-SX", "nmg", "nn", "nnh", "no", "nus", "nyn", "om", "om-KE", "or", "os", "os-RU", "pa", "pa-Arab", "pa-Guru", "pcm", "pl", "ps", "ps-PK", "pt", "pt-AO", "pt-CH", "pt-CV", "pt-GQ", "pt-GW", "pt-LU", "pt-MO", "pt-MZ", "pt-PT", "pt-ST", "pt-TL", "qu", "qu-BO", "qu-EC", "rm", "rn", "ro", "ro-MD", "rof", "ru", "ru-BY", "ru-KG", "ru-KZ", "ru-MD", "ru-UA", "rw", "rwk", "sa", "sah", "saq", "sat", "sat-Olck", "sbp", "sc", "sd", "sd-Arab", "sd-Deva", "se", "se-FI", "se-SE", "seh", "ses", "sg", "shi", "shi-Latn", "shi-Tfng", "si", "sk", "sl", "smn", "sn", "so", "so-DJ", "so-ET", "so-KE", "sq", "sq-MK", "sq-XK", "sr", "sr-Cyrl", "sr-Cyrl-BA", "sr-Cyrl-ME", "sr-Cyrl-XK", "sr-Latn", "sr-Latn-BA", "sr-Latn-ME", "sr-Latn-XK", "su", "su-Latn", "sv", "sv-AX", "sv-FI", "sw", "sw-CD", "sw-KE", "sw-UG", "ta", "ta-LK", "ta-MY", "ta-SG", "te", "teo", "teo-KE", "tg", "th", "ti", "ti-ER", "tk", "to", "tr", "tr-CY", "tt", "twq", "tzm", "ug", "uk", "und", "ur", "ur-IN", "uz", "uz-Arab", "uz-Cyrl", "uz-Latn", "vai", "vai-Latn", "vai-Vaii", "vi", "vun", "wae", "wo", "xh", "xog", "yav", "yi", "yo", "yo-BJ", "yrl", "yrl-CO", "yrl-VE", "yue", "yue-Hans", "yue-Hant", "zgh", "zh", "zh-Hans", "zh-Hans-HK", "zh-Hans-MO", "zh-Hans-SG", "zh-Hant", "zh-Hant-HK", "zh-Hant-MO", "zu"];
|