@formatjs/intl-listformat 7.7.11 → 7.7.13
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 +2 -2
- package/index.js +15 -11
- package/lib/index.d.ts +2 -2
- package/lib/index.js +15 -11
- package/package.json +5 -5
- package/polyfill.iife.js +16 -11
package/index.d.ts
CHANGED
|
@@ -57,8 +57,8 @@ export interface ElementPart<T = string> {
|
|
|
57
57
|
}
|
|
58
58
|
export default class ListFormat {
|
|
59
59
|
constructor(locales?: string | string[], options?: IntlListFormatOptions);
|
|
60
|
-
format(elements: string
|
|
61
|
-
formatToParts(elements: string
|
|
60
|
+
format(elements: Iterable<string>): string;
|
|
61
|
+
formatToParts(elements: Iterable<string>): Part[];
|
|
62
62
|
resolvedOptions(): ResolvedIntlListFormatOptions;
|
|
63
63
|
static supportedLocalesOf(locales: string | string[], options?: Pick<IntlListFormatOptions, 'localeMatcher'>): string[];
|
|
64
64
|
static __addLocaleData(...data: ListPatternLocaleData[]): void;
|
package/index.js
CHANGED
|
@@ -10,21 +10,25 @@ function validateInstance(instance, method) {
|
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* https://tc39.es/proposal-intl-list-format/#sec-createstringlistfromiterable
|
|
13
|
-
* @param
|
|
13
|
+
* @param iterable list
|
|
14
14
|
*/
|
|
15
|
-
function stringListFromIterable(
|
|
16
|
-
if (
|
|
15
|
+
function stringListFromIterable(iterable) {
|
|
16
|
+
if (typeof iterable !== 'object')
|
|
17
17
|
return [];
|
|
18
|
-
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
var elements = [];
|
|
19
|
+
var iterator = iterable[Symbol.iterator]();
|
|
20
|
+
var result;
|
|
21
|
+
while (true) {
|
|
22
|
+
result = iterator.next();
|
|
23
|
+
if (result.done)
|
|
24
|
+
break;
|
|
25
|
+
if (typeof result.value !== 'string') {
|
|
26
|
+
var nextValue = result.value;
|
|
27
|
+
throw new TypeError("Iterable yielded ".concat(nextValue, " which is not a string"));
|
|
24
28
|
}
|
|
25
|
-
|
|
29
|
+
elements.push(result.value);
|
|
26
30
|
}
|
|
27
|
-
return
|
|
31
|
+
return elements;
|
|
28
32
|
}
|
|
29
33
|
function createPartsFromList(internalSlotMap, lf, list) {
|
|
30
34
|
var size = list.length;
|
package/lib/index.d.ts
CHANGED
|
@@ -57,8 +57,8 @@ export interface ElementPart<T = string> {
|
|
|
57
57
|
}
|
|
58
58
|
export default class ListFormat {
|
|
59
59
|
constructor(locales?: string | string[], options?: IntlListFormatOptions);
|
|
60
|
-
format(elements: string
|
|
61
|
-
formatToParts(elements: string
|
|
60
|
+
format(elements: Iterable<string>): string;
|
|
61
|
+
formatToParts(elements: Iterable<string>): Part[];
|
|
62
62
|
resolvedOptions(): ResolvedIntlListFormatOptions;
|
|
63
63
|
static supportedLocalesOf(locales: string | string[], options?: Pick<IntlListFormatOptions, 'localeMatcher'>): string[];
|
|
64
64
|
static __addLocaleData(...data: ListPatternLocaleData[]): void;
|
package/lib/index.js
CHANGED
|
@@ -8,21 +8,25 @@ function validateInstance(instance, method) {
|
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* https://tc39.es/proposal-intl-list-format/#sec-createstringlistfromiterable
|
|
11
|
-
* @param
|
|
11
|
+
* @param iterable list
|
|
12
12
|
*/
|
|
13
|
-
function stringListFromIterable(
|
|
14
|
-
if (
|
|
13
|
+
function stringListFromIterable(iterable) {
|
|
14
|
+
if (typeof iterable !== 'object')
|
|
15
15
|
return [];
|
|
16
|
-
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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"));
|
|
22
26
|
}
|
|
23
|
-
|
|
27
|
+
elements.push(result.value);
|
|
24
28
|
}
|
|
25
|
-
return
|
|
29
|
+
return elements;
|
|
26
30
|
}
|
|
27
31
|
function createPartsFromList(internalSlotMap, lf, list) {
|
|
28
32
|
var size = list.length;
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formatjs/intl-listformat",
|
|
3
3
|
"description": "Formats JS list in a i18n-safe way",
|
|
4
|
-
"version": "7.7.
|
|
4
|
+
"version": "7.7.13",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Long Ho <holevietlong@gmail.com>",
|
|
7
7
|
"types": "index.d.ts",
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"tslib": "^2.8.0",
|
|
10
|
-
"@formatjs/ecma402-abstract": "2.3.
|
|
11
|
-
"@formatjs/intl-localematcher": "0.6.
|
|
10
|
+
"@formatjs/ecma402-abstract": "2.3.6",
|
|
11
|
+
"@formatjs/intl-localematcher": "0.6.2"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
|
-
"@formatjs/intl-getcanonicallocales": "2.5.
|
|
15
|
-
"@formatjs/intl-locale": "4.2.
|
|
14
|
+
"@formatjs/intl-getcanonicallocales": "2.5.6",
|
|
15
|
+
"@formatjs/intl-locale": "4.2.13"
|
|
16
16
|
},
|
|
17
17
|
"bugs": "https://github.com/formatjs/formatjs/issues",
|
|
18
18
|
"gitHead": "a7842673d8ad205171ad7c8cb8bb2f318b427c0c",
|
package/polyfill.iife.js
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
return Intl.getCanonicalLocales(locales);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
// node_modules/.aspect_rules_js/decimal.js@10.
|
|
28
|
+
// node_modules/.aspect_rules_js/decimal.js@10.6.0/node_modules/decimal.js/decimal.mjs
|
|
29
29
|
var EXP_LIMIT = 9e15;
|
|
30
30
|
var MAX_DIGITS = 1e9;
|
|
31
31
|
var NUMERALS = "0123456789abcdef";
|
|
@@ -7157,18 +7157,23 @@
|
|
|
7157
7157
|
);
|
|
7158
7158
|
}
|
|
7159
7159
|
}
|
|
7160
|
-
function stringListFromIterable(
|
|
7161
|
-
if (
|
|
7160
|
+
function stringListFromIterable(iterable) {
|
|
7161
|
+
if (typeof iterable !== "object")
|
|
7162
7162
|
return [];
|
|
7163
|
-
|
|
7164
|
-
const
|
|
7165
|
-
|
|
7166
|
-
|
|
7167
|
-
|
|
7163
|
+
const elements = [];
|
|
7164
|
+
const iterator = iterable[Symbol.iterator]();
|
|
7165
|
+
let result;
|
|
7166
|
+
while (true) {
|
|
7167
|
+
result = iterator.next();
|
|
7168
|
+
if (result.done)
|
|
7169
|
+
break;
|
|
7170
|
+
if (typeof result.value !== "string") {
|
|
7171
|
+
const nextValue = result.value;
|
|
7172
|
+
throw new TypeError(`Iterable yielded ${nextValue} which is not a string`);
|
|
7168
7173
|
}
|
|
7169
|
-
|
|
7174
|
+
elements.push(result.value);
|
|
7170
7175
|
}
|
|
7171
|
-
return
|
|
7176
|
+
return elements;
|
|
7172
7177
|
}
|
|
7173
7178
|
function createPartsFromList(internalSlotMap, lf, list) {
|
|
7174
7179
|
const size = list.length;
|
|
@@ -7427,7 +7432,7 @@
|
|
|
7427
7432
|
|
|
7428
7433
|
decimal.js/decimal.mjs:
|
|
7429
7434
|
(*!
|
|
7430
|
-
* decimal.js v10.
|
|
7435
|
+
* decimal.js v10.6.0
|
|
7431
7436
|
* An arbitrary-precision Decimal type for JavaScript.
|
|
7432
7437
|
* https://github.com/MikeMcl/decimal.js
|
|
7433
7438
|
* Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
|