@formatjs/intl-listformat 5.0.10 → 5.0.14
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/LICENSE.md +1 -1
- package/index.d.ts +25 -25
- package/index.d.ts.map +1 -1
- package/index.js +1 -1
- package/lib/index.d.ts +25 -25
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- package/package.json +2 -2
- package/polyfill.iife.js +15 -1
- package/polyfill-locales.js +0 -1135
package/LICENSE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2021 FormatJS
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
6
|
|
package/index.d.ts
CHANGED
|
@@ -8,45 +8,45 @@ export interface IntlListFormatOptions {
|
|
|
8
8
|
*/
|
|
9
9
|
localeMatcher?: 'best fit' | 'lookup';
|
|
10
10
|
/**
|
|
11
|
-
* The format of output message.
|
|
12
|
-
*
|
|
13
|
-
* -
|
|
14
|
-
*
|
|
15
|
-
*
|
|
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
16
|
*/
|
|
17
17
|
type?: 'conjunction' | 'disjunction' | 'unit';
|
|
18
18
|
/**
|
|
19
|
-
* The length of the
|
|
20
|
-
*
|
|
21
|
-
* - "
|
|
22
|
-
* -
|
|
23
|
-
*
|
|
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.
|
|
24
25
|
*/
|
|
25
26
|
style?: 'long' | 'short' | 'narrow';
|
|
26
27
|
}
|
|
27
28
|
export interface ResolvedIntlListFormatOptions {
|
|
28
29
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* the key-value pairs that were requested and are
|
|
33
|
-
* supported for this locale are included in locale.
|
|
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.
|
|
34
33
|
*/
|
|
35
34
|
locale: string;
|
|
36
35
|
/**
|
|
37
|
-
* The format of output message.
|
|
38
|
-
*
|
|
39
|
-
* -
|
|
40
|
-
*
|
|
41
|
-
*
|
|
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").
|
|
42
41
|
*/
|
|
43
42
|
type: 'conjunction' | 'disjunction' | 'unit';
|
|
44
43
|
/**
|
|
45
|
-
* The length of the
|
|
46
|
-
*
|
|
47
|
-
* - "
|
|
48
|
-
* -
|
|
49
|
-
*
|
|
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
50
|
*/
|
|
51
51
|
style: 'long' | 'short' | 'narrow';
|
|
52
52
|
}
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/intl-listformat/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,qBAAqB,EAKrB,qBAAqB,EAKrB,WAAW,EAGZ,MAAM,4BAA4B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/intl-listformat/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,qBAAqB,EAKrB,qBAAqB,EAKrB,WAAW,EAGZ,MAAM,4BAA4B,CAAA;AAEnC,MAAM,WAAW,qBAAqB;IACpC;;;;;OAKG;IACH,aAAa,CAAC,EAAE,UAAU,GAAG,QAAQ,CAAA;IACrC;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,aAAa,GAAG,aAAa,GAAG,MAAM,CAAA;IAC7C;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAA;CACpC;AAED,MAAM,WAAW,6BAA6B;IAC5C;;;;OAIG;IACH,MAAM,EAAE,MAAM,CAAA;IACd;;;;;;OAMG;IACH,IAAI,EAAE,aAAa,GAAG,aAAa,GAAG,MAAM,CAAA;IAC5C;;;;;;;OAOG;IACH,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAA;CACnC;AAED,oBAAY,IAAI,GAAG,WAAW,GAAG,WAAW,CAAA;AAE5C,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,SAAS,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;CACd;AA6GD,MAAM,CAAC,OAAO,OAAO,UAAU;gBACjB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,qBAAqB;IAiFxE,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM;IAgBlC,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE;IAiBzC,eAAe,IAAI,6BAA6B;WASlC,kBAAkB,CAC9B,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,EAC1B,OAAO,CAAC,EAAE,IAAI,CAAC,qBAAqB,EAAE,eAAe,CAAC;WAU1C,eAAe,CAAC,GAAG,IAAI,EAAE,qBAAqB,EAAE;IAa9D,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,GAAG,SAAS,CAAC,CAAK;IACzE,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAoB;IACnD,OAAO,CAAC,MAAM,CAAC,eAAe,CAAK;IACnC,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAG/B,OAAO,CAAC,MAAM,CAAC,qBAAqB,CAAK;IACzC,OAAc,UAAU,UAAO;IAC/B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,qBAAqB,CAG1C;CACJ"}
|
package/index.js
CHANGED
|
@@ -95,7 +95,7 @@ var ListFormat = /** @class */ (function () {
|
|
|
95
95
|
ecma402_abstract_1.setInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'initializedListFormat', true);
|
|
96
96
|
var requestedLocales = ecma402_abstract_1.CanonicalizeLocaleList(locales);
|
|
97
97
|
var opt = Object.create(null);
|
|
98
|
-
var opts =
|
|
98
|
+
var opts = ecma402_abstract_1.GetOptionsObject(options);
|
|
99
99
|
var matcher = ecma402_abstract_1.GetOption(opts, 'localeMatcher', 'string', ['best fit', 'lookup'], 'best fit');
|
|
100
100
|
opt.localeMatcher = matcher;
|
|
101
101
|
var localeData = ListFormat.localeData;
|
package/lib/index.d.ts
CHANGED
|
@@ -8,45 +8,45 @@ export interface IntlListFormatOptions {
|
|
|
8
8
|
*/
|
|
9
9
|
localeMatcher?: 'best fit' | 'lookup';
|
|
10
10
|
/**
|
|
11
|
-
* The format of output message.
|
|
12
|
-
*
|
|
13
|
-
* -
|
|
14
|
-
*
|
|
15
|
-
*
|
|
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
16
|
*/
|
|
17
17
|
type?: 'conjunction' | 'disjunction' | 'unit';
|
|
18
18
|
/**
|
|
19
|
-
* The length of the
|
|
20
|
-
*
|
|
21
|
-
* - "
|
|
22
|
-
* -
|
|
23
|
-
*
|
|
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.
|
|
24
25
|
*/
|
|
25
26
|
style?: 'long' | 'short' | 'narrow';
|
|
26
27
|
}
|
|
27
28
|
export interface ResolvedIntlListFormatOptions {
|
|
28
29
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* the key-value pairs that were requested and are
|
|
33
|
-
* supported for this locale are included in locale.
|
|
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.
|
|
34
33
|
*/
|
|
35
34
|
locale: string;
|
|
36
35
|
/**
|
|
37
|
-
* The format of output message.
|
|
38
|
-
*
|
|
39
|
-
* -
|
|
40
|
-
*
|
|
41
|
-
*
|
|
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").
|
|
42
41
|
*/
|
|
43
42
|
type: 'conjunction' | 'disjunction' | 'unit';
|
|
44
43
|
/**
|
|
45
|
-
* The length of the
|
|
46
|
-
*
|
|
47
|
-
* - "
|
|
48
|
-
* -
|
|
49
|
-
*
|
|
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
50
|
*/
|
|
51
51
|
style: 'long' | 'short' | 'narrow';
|
|
52
52
|
}
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/intl-listformat/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,qBAAqB,EAKrB,qBAAqB,EAKrB,WAAW,EAGZ,MAAM,4BAA4B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/intl-listformat/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,qBAAqB,EAKrB,qBAAqB,EAKrB,WAAW,EAGZ,MAAM,4BAA4B,CAAA;AAEnC,MAAM,WAAW,qBAAqB;IACpC;;;;;OAKG;IACH,aAAa,CAAC,EAAE,UAAU,GAAG,QAAQ,CAAA;IACrC;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,aAAa,GAAG,aAAa,GAAG,MAAM,CAAA;IAC7C;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAA;CACpC;AAED,MAAM,WAAW,6BAA6B;IAC5C;;;;OAIG;IACH,MAAM,EAAE,MAAM,CAAA;IACd;;;;;;OAMG;IACH,IAAI,EAAE,aAAa,GAAG,aAAa,GAAG,MAAM,CAAA;IAC5C;;;;;;;OAOG;IACH,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAA;CACnC;AAED,oBAAY,IAAI,GAAG,WAAW,GAAG,WAAW,CAAA;AAE5C,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,SAAS,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;CACd;AA6GD,MAAM,CAAC,OAAO,OAAO,UAAU;gBACjB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,qBAAqB;IAiFxE,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM;IAgBlC,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE;IAiBzC,eAAe,IAAI,6BAA6B;WASlC,kBAAkB,CAC9B,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,EAC1B,OAAO,CAAC,EAAE,IAAI,CAAC,qBAAqB,EAAE,eAAe,CAAC;WAU1C,eAAe,CAAC,GAAG,IAAI,EAAE,qBAAqB,EAAE;IAa9D,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,GAAG,SAAS,CAAC,CAAK;IACzE,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAoB;IACnD,OAAO,CAAC,MAAM,CAAC,eAAe,CAAK;IACnC,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAG/B,OAAO,CAAC,MAAM,CAAC,qBAAqB,CAAK;IACzC,OAAc,UAAU,UAAO;IAC/B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,qBAAqB,CAG1C;CACJ"}
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __assign } from "tslib";
|
|
2
|
-
import { GetOption, setInternalSlot, SupportedLocales, ResolveLocale, getInternalSlot, PartitionPattern, invariant, isLiteralPart,
|
|
2
|
+
import { GetOption, setInternalSlot, SupportedLocales, ResolveLocale, getInternalSlot, PartitionPattern, invariant, isLiteralPart, GetOptionsObject, CanonicalizeLocaleList, } from '@formatjs/ecma402-abstract';
|
|
3
3
|
function validateInstance(instance, method) {
|
|
4
4
|
if (!(instance instanceof ListFormat)) {
|
|
5
5
|
throw new TypeError("Method Intl.ListFormat.prototype." + method + " called on incompatible receiver " + String(instance));
|
|
@@ -93,7 +93,7 @@ var ListFormat = /** @class */ (function () {
|
|
|
93
93
|
setInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'initializedListFormat', true);
|
|
94
94
|
var requestedLocales = CanonicalizeLocaleList(locales);
|
|
95
95
|
var opt = Object.create(null);
|
|
96
|
-
var opts =
|
|
96
|
+
var opts = GetOptionsObject(options);
|
|
97
97
|
var matcher = GetOption(opts, 'localeMatcher', 'string', ['best fit', 'lookup'], 'best fit');
|
|
98
98
|
opt.localeMatcher = matcher;
|
|
99
99
|
var localeData = ListFormat.localeData;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formatjs/intl-listformat",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.14",
|
|
4
4
|
"description": "Formats JS list in a i18n-safe way",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"intl",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"url": "git@github.com:formatjs/formatjs.git"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@formatjs/ecma402-abstract": "1.6.
|
|
22
|
+
"@formatjs/ecma402-abstract": "1.6.5",
|
|
23
23
|
"tslib": "^2.1.0"
|
|
24
24
|
},
|
|
25
25
|
"main": "index.js",
|
package/polyfill.iife.js
CHANGED
|
@@ -150,6 +150,9 @@
|
|
|
150
150
|
|
|
151
151
|
// bazel-out/k8-fastbuild/bin/packages/ecma402-abstract/lib/GetOption.js
|
|
152
152
|
function GetOption(opts, prop, type, values, fallback) {
|
|
153
|
+
if (typeof opts !== "object") {
|
|
154
|
+
throw new TypeError("Options must be an object");
|
|
155
|
+
}
|
|
153
156
|
var value = opts[prop];
|
|
154
157
|
if (value !== void 0) {
|
|
155
158
|
if (type !== "boolean" && type !== "string") {
|
|
@@ -349,6 +352,17 @@
|
|
|
349
352
|
return result;
|
|
350
353
|
}
|
|
351
354
|
|
|
355
|
+
// bazel-out/k8-fastbuild/bin/packages/ecma402-abstract/lib/GetOptionsObject.js
|
|
356
|
+
function GetOptionsObject(options) {
|
|
357
|
+
if (typeof options === "undefined") {
|
|
358
|
+
return Object.create(null);
|
|
359
|
+
}
|
|
360
|
+
if (typeof options === "object") {
|
|
361
|
+
return options;
|
|
362
|
+
}
|
|
363
|
+
throw new TypeError("Options must be an object");
|
|
364
|
+
}
|
|
365
|
+
|
|
352
366
|
// bazel-out/k8-fastbuild/bin/packages/ecma402-abstract/lib/IsSanctionedSimpleUnitIdentifier.js
|
|
353
367
|
var SANCTIONED_UNITS = [
|
|
354
368
|
"angle-degree",
|
|
@@ -527,7 +541,7 @@
|
|
|
527
541
|
setInternalSlot(ListFormat2.__INTERNAL_SLOT_MAP__, this, "initializedListFormat", true);
|
|
528
542
|
var requestedLocales = CanonicalizeLocaleList(locales);
|
|
529
543
|
var opt = Object.create(null);
|
|
530
|
-
var opts =
|
|
544
|
+
var opts = GetOptionsObject(options);
|
|
531
545
|
var matcher = GetOption(opts, "localeMatcher", "string", ["best fit", "lookup"], "best fit");
|
|
532
546
|
opt.localeMatcher = matcher;
|
|
533
547
|
var localeData = ListFormat2.localeData;
|