@formatjs/intl-listformat 8.1.1 → 8.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +63 -63
- package/index.js +207 -206
- package/package.json +5 -5
- package/polyfill-force.js +6 -6
- package/polyfill.iife.js +2307 -3070
- package/polyfill.js +8 -8
- package/should-polyfill.js +11 -13
- package/supported-locales.generated.js +572 -572
package/index.d.ts
CHANGED
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
import { ListPatternFieldsData, ListPatternLocaleData, LiteralPart } from
|
|
1
|
+
import { type ListPatternFieldsData, type ListPatternLocaleData, type LiteralPart } from "@formatjs/ecma402-abstract";
|
|
2
2
|
export interface IntlListFormatOptions {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
27
|
}
|
|
28
28
|
export interface ResolvedIntlListFormatOptions {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
52
|
}
|
|
53
53
|
export type Part<T = string> = LiteralPart | ElementPart | ElementPart<T>;
|
|
54
54
|
export interface ElementPart<T = string> {
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
type: "element";
|
|
56
|
+
value: T;
|
|
57
57
|
}
|
|
58
58
|
export default class ListFormat {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
72
|
}
|
package/index.js
CHANGED
|
@@ -1,216 +1,217 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { ResolveLocale } from '@formatjs/intl-localematcher';
|
|
1
|
+
import { CanonicalizeLocaleList, getInternalSlot, GetOption, GetOptionsObject, invariant, isLiteralPart, PartitionPattern, setInternalSlot, SupportedLocales } from "@formatjs/ecma402-abstract";
|
|
2
|
+
import { ResolveLocale } from "@formatjs/intl-localematcher";
|
|
4
3
|
function validateInstance(instance, method) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
if (!(instance instanceof ListFormat)) {
|
|
5
|
+
throw new TypeError(`Method Intl.ListFormat.prototype.${method} called on incompatible receiver ${String(instance)}`);
|
|
6
|
+
}
|
|
8
7
|
}
|
|
9
8
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
* https://tc39.es/proposal-intl-list-format/#sec-createstringlistfromiterable
|
|
10
|
+
* @param iterable list
|
|
11
|
+
*/
|
|
13
12
|
function stringListFromIterable(iterable) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
return elements;
|
|
13
|
+
if (typeof iterable !== "object") return [];
|
|
14
|
+
const elements = [];
|
|
15
|
+
const iterator = iterable[Symbol.iterator]();
|
|
16
|
+
let result;
|
|
17
|
+
while (true) {
|
|
18
|
+
result = iterator.next();
|
|
19
|
+
if (result.done) break;
|
|
20
|
+
if (typeof result.value !== "string") {
|
|
21
|
+
const nextValue = result.value;
|
|
22
|
+
throw new TypeError(`Iterable yielded ${nextValue} which is not a string`);
|
|
23
|
+
}
|
|
24
|
+
elements.push(result.value);
|
|
25
|
+
}
|
|
26
|
+
return elements;
|
|
30
27
|
}
|
|
31
28
|
function createPartsFromList(internalSlotMap, lf, list) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
29
|
+
const size = list.length;
|
|
30
|
+
if (size === 0) {
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
if (size === 2) {
|
|
34
|
+
const pattern = getInternalSlot(internalSlotMap, lf, "templatePair");
|
|
35
|
+
const first = {
|
|
36
|
+
type: "element",
|
|
37
|
+
value: list[0]
|
|
38
|
+
};
|
|
39
|
+
const second = {
|
|
40
|
+
type: "element",
|
|
41
|
+
value: list[1]
|
|
42
|
+
};
|
|
43
|
+
return deconstructPattern(pattern, {
|
|
44
|
+
"0": first,
|
|
45
|
+
"1": second
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
const last = {
|
|
49
|
+
type: "element",
|
|
50
|
+
value: list[size - 1]
|
|
51
|
+
};
|
|
52
|
+
let parts = last;
|
|
53
|
+
let i = size - 2;
|
|
54
|
+
while (i >= 0) {
|
|
55
|
+
let pattern;
|
|
56
|
+
if (i === 0) {
|
|
57
|
+
pattern = getInternalSlot(internalSlotMap, lf, "templateStart");
|
|
58
|
+
} else if (i < size - 2) {
|
|
59
|
+
pattern = getInternalSlot(internalSlotMap, lf, "templateMiddle");
|
|
60
|
+
} else {
|
|
61
|
+
pattern = getInternalSlot(internalSlotMap, lf, "templateEnd");
|
|
62
|
+
}
|
|
63
|
+
const head = {
|
|
64
|
+
type: "element",
|
|
65
|
+
value: list[i]
|
|
66
|
+
};
|
|
67
|
+
parts = deconstructPattern(pattern, {
|
|
68
|
+
"0": head,
|
|
69
|
+
"1": parts
|
|
70
|
+
});
|
|
71
|
+
i--;
|
|
72
|
+
}
|
|
73
|
+
return parts;
|
|
64
74
|
}
|
|
65
75
|
function deconstructPattern(pattern, placeables) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return result;
|
|
76
|
+
const patternParts = PartitionPattern(pattern);
|
|
77
|
+
const result = [];
|
|
78
|
+
for (const patternPart of patternParts) {
|
|
79
|
+
const { type: part } = patternPart;
|
|
80
|
+
if (isLiteralPart(patternPart)) {
|
|
81
|
+
result.push({
|
|
82
|
+
type: "literal",
|
|
83
|
+
value: patternPart.value
|
|
84
|
+
});
|
|
85
|
+
} else {
|
|
86
|
+
invariant(part in placeables, `${part} is missing from placables`);
|
|
87
|
+
const subst = placeables[part];
|
|
88
|
+
if (Array.isArray(subst)) {
|
|
89
|
+
result.push(...subst);
|
|
90
|
+
} else {
|
|
91
|
+
result.push(subst);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return result;
|
|
89
96
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
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 (_a) {
|
|
215
|
-
// Meta fix so we're test262-compliant, not important
|
|
97
|
+
export default class ListFormat {
|
|
98
|
+
constructor(locales, options) {
|
|
99
|
+
// test262/test/intl402/ListFormat/constructor/constructor/newtarget-undefined.js
|
|
100
|
+
// Cannot use `new.target` bc of IE11 & TS transpiles it to something else
|
|
101
|
+
const newTarget = this && this instanceof ListFormat ? this.constructor : void 0;
|
|
102
|
+
if (!newTarget) {
|
|
103
|
+
throw new TypeError("Intl.ListFormat must be called with 'new'");
|
|
104
|
+
}
|
|
105
|
+
setInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, "initializedListFormat", true);
|
|
106
|
+
const requestedLocales = CanonicalizeLocaleList(locales);
|
|
107
|
+
const opt = Object.create(null);
|
|
108
|
+
const opts = GetOptionsObject(options);
|
|
109
|
+
const matcher = GetOption(opts, "localeMatcher", "string", ["best fit", "lookup"], "best fit");
|
|
110
|
+
opt.localeMatcher = matcher;
|
|
111
|
+
const { localeData } = ListFormat;
|
|
112
|
+
const r = ResolveLocale(ListFormat.availableLocales, requestedLocales, opt, ListFormat.relevantExtensionKeys, localeData, ListFormat.getDefaultLocale);
|
|
113
|
+
setInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, "locale", r.locale);
|
|
114
|
+
const type = GetOption(opts, "type", "string", [
|
|
115
|
+
"conjunction",
|
|
116
|
+
"disjunction",
|
|
117
|
+
"unit"
|
|
118
|
+
], "conjunction");
|
|
119
|
+
setInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, "type", type);
|
|
120
|
+
const style = GetOption(opts, "style", "string", [
|
|
121
|
+
"long",
|
|
122
|
+
"short",
|
|
123
|
+
"narrow"
|
|
124
|
+
], "long");
|
|
125
|
+
setInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, "style", style);
|
|
126
|
+
const { dataLocale } = r;
|
|
127
|
+
const dataLocaleData = localeData[dataLocale];
|
|
128
|
+
invariant(!!dataLocaleData, `Missing locale data for ${dataLocale}`);
|
|
129
|
+
const dataLocaleTypes = dataLocaleData[type];
|
|
130
|
+
const templates = dataLocaleTypes[style];
|
|
131
|
+
setInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, "templatePair", templates.pair);
|
|
132
|
+
setInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, "templateStart", templates.start);
|
|
133
|
+
setInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, "templateMiddle", templates.middle);
|
|
134
|
+
setInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, "templateEnd", templates.end);
|
|
135
|
+
}
|
|
136
|
+
format(elements) {
|
|
137
|
+
validateInstance(this, "format");
|
|
138
|
+
let result = "";
|
|
139
|
+
const parts = createPartsFromList(ListFormat.__INTERNAL_SLOT_MAP__, this, stringListFromIterable(elements));
|
|
140
|
+
if (!Array.isArray(parts)) {
|
|
141
|
+
return parts.value;
|
|
142
|
+
}
|
|
143
|
+
for (const p of parts) {
|
|
144
|
+
result += p.value;
|
|
145
|
+
}
|
|
146
|
+
return result;
|
|
147
|
+
}
|
|
148
|
+
formatToParts(elements) {
|
|
149
|
+
validateInstance(this, "format");
|
|
150
|
+
const parts = createPartsFromList(ListFormat.__INTERNAL_SLOT_MAP__, this, stringListFromIterable(elements));
|
|
151
|
+
if (!Array.isArray(parts)) {
|
|
152
|
+
return [parts];
|
|
153
|
+
}
|
|
154
|
+
const result = [];
|
|
155
|
+
for (const part of parts) {
|
|
156
|
+
result.push({ ...part });
|
|
157
|
+
}
|
|
158
|
+
return result;
|
|
159
|
+
}
|
|
160
|
+
resolvedOptions() {
|
|
161
|
+
validateInstance(this, "resolvedOptions");
|
|
162
|
+
return {
|
|
163
|
+
locale: getInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, "locale"),
|
|
164
|
+
type: getInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, "type"),
|
|
165
|
+
style: getInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, "style")
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
static supportedLocalesOf(locales, options) {
|
|
169
|
+
// test262/test/intl402/ListFormat/constructor/supportedLocalesOf/result-type.js
|
|
170
|
+
return SupportedLocales(ListFormat.availableLocales, CanonicalizeLocaleList(locales), options);
|
|
171
|
+
}
|
|
172
|
+
static __addLocaleData(...data) {
|
|
173
|
+
for (const { data: d, locale } of data) {
|
|
174
|
+
const minimizedLocale = new Intl.Locale(locale).minimize().toString();
|
|
175
|
+
ListFormat.localeData[locale] = ListFormat.localeData[minimizedLocale] = d;
|
|
176
|
+
ListFormat.availableLocales.add(minimizedLocale);
|
|
177
|
+
ListFormat.availableLocales.add(locale);
|
|
178
|
+
if (!ListFormat.__defaultLocale) {
|
|
179
|
+
ListFormat.__defaultLocale = minimizedLocale;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
static localeData = {};
|
|
184
|
+
static availableLocales = new Set();
|
|
185
|
+
static __defaultLocale = "";
|
|
186
|
+
static getDefaultLocale() {
|
|
187
|
+
return ListFormat.__defaultLocale;
|
|
188
|
+
}
|
|
189
|
+
static relevantExtensionKeys = [];
|
|
190
|
+
static polyfilled = true;
|
|
191
|
+
static __INTERNAL_SLOT_MAP__ = new WeakMap();
|
|
216
192
|
}
|
|
193
|
+
try {
|
|
194
|
+
// IE11 does not have Symbol
|
|
195
|
+
if (typeof Symbol !== "undefined") {
|
|
196
|
+
Object.defineProperty(ListFormat.prototype, Symbol.toStringTag, {
|
|
197
|
+
value: "Intl.ListFormat",
|
|
198
|
+
writable: false,
|
|
199
|
+
enumerable: false,
|
|
200
|
+
configurable: true
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
// https://github.com/tc39/test262/blob/master/test/intl402/ListFormat/constructor/length.js
|
|
204
|
+
Object.defineProperty(ListFormat.prototype.constructor, "length", {
|
|
205
|
+
value: 0,
|
|
206
|
+
writable: false,
|
|
207
|
+
enumerable: false,
|
|
208
|
+
configurable: true
|
|
209
|
+
});
|
|
210
|
+
// https://github.com/tc39/test262/blob/master/test/intl402/ListFormat/constructor/supportedLocalesOf/length.js
|
|
211
|
+
Object.defineProperty(ListFormat.supportedLocalesOf, "length", {
|
|
212
|
+
value: 1,
|
|
213
|
+
writable: false,
|
|
214
|
+
enumerable: false,
|
|
215
|
+
configurable: true
|
|
216
|
+
});
|
|
217
|
+
} catch {}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formatjs/intl-listformat",
|
|
3
3
|
"description": "Formats JS list in a i18n-safe way",
|
|
4
|
-
"version": "8.1.
|
|
4
|
+
"version": "8.1.2",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Long Ho <holevietlong@gmail.com>",
|
|
7
7
|
"type": "module",
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"tslib": "^2.8.0",
|
|
18
|
-
"@formatjs/intl-localematcher": "0.7.
|
|
19
|
-
"@formatjs/ecma402-abstract": "3.0.
|
|
18
|
+
"@formatjs/intl-localematcher": "0.7.5",
|
|
19
|
+
"@formatjs/ecma402-abstract": "3.0.8"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@formatjs/intl-getcanonicallocales": "3.1.
|
|
23
|
-
"@formatjs/intl-locale": "5.1.
|
|
22
|
+
"@formatjs/intl-getcanonicallocales": "3.1.2",
|
|
23
|
+
"@formatjs/intl-locale": "5.1.2"
|
|
24
24
|
},
|
|
25
25
|
"bugs": "https://github.com/formatjs/formatjs/issues",
|
|
26
26
|
"gitHead": "a7842673d8ad205171ad7c8cb8bb2f318b427c0c",
|
package/polyfill-force.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import ListFormat from
|
|
2
|
-
Object.defineProperty(Intl,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import ListFormat from "./index.js";
|
|
2
|
+
Object.defineProperty(Intl, "ListFormat", {
|
|
3
|
+
value: ListFormat,
|
|
4
|
+
writable: true,
|
|
5
|
+
enumerable: false,
|
|
6
|
+
configurable: true
|
|
7
7
|
});
|