@formatjs/intl-listformat 7.7.10 → 7.7.12
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 +19 -24
- package/polyfill.iife.js +48 -31
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,35 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formatjs/intl-listformat",
|
|
3
|
-
"version": "7.7.10",
|
|
4
3
|
"description": "Formats JS list in a i18n-safe way",
|
|
5
|
-
"
|
|
6
|
-
"intl",
|
|
7
|
-
"i18n",
|
|
8
|
-
"list",
|
|
9
|
-
"format",
|
|
10
|
-
"formatjs",
|
|
11
|
-
"listformat"
|
|
12
|
-
],
|
|
4
|
+
"version": "7.7.12",
|
|
13
5
|
"author": "Long Ho <holevietlong@gmail.com>",
|
|
14
|
-
"bugs":
|
|
15
|
-
"url": "https://github.com/formatjs/formatjs/issues"
|
|
16
|
-
},
|
|
17
|
-
"repository": {
|
|
18
|
-
"type": "git",
|
|
19
|
-
"url": "git@github.com:formatjs/formatjs.git"
|
|
20
|
-
},
|
|
6
|
+
"bugs": "https://github.com/formatjs/formatjs/issues",
|
|
21
7
|
"dependencies": {
|
|
22
|
-
"
|
|
23
|
-
"@formatjs/
|
|
24
|
-
"
|
|
8
|
+
"@formatjs/ecma402-abstract": "2.3.5",
|
|
9
|
+
"@formatjs/intl-localematcher": "0.6.2",
|
|
10
|
+
"tslib": "^2.8.0"
|
|
25
11
|
},
|
|
26
12
|
"devDependencies": {
|
|
27
|
-
"@formatjs/intl-getcanonicallocales": "2.5.
|
|
28
|
-
"@formatjs/intl-locale": "4.2.
|
|
13
|
+
"@formatjs/intl-getcanonicallocales": "2.5.6",
|
|
14
|
+
"@formatjs/intl-locale": "4.2.12"
|
|
29
15
|
},
|
|
30
|
-
"
|
|
31
|
-
"types": "index.d.ts",
|
|
16
|
+
"gitHead": "a7842673d8ad205171ad7c8cb8bb2f318b427c0c",
|
|
32
17
|
"homepage": "https://github.com/formatjs/formatjs",
|
|
18
|
+
"keywords": [
|
|
19
|
+
"format",
|
|
20
|
+
"formatjs",
|
|
21
|
+
"i18n",
|
|
22
|
+
"intl",
|
|
23
|
+
"list",
|
|
24
|
+
"listformat"
|
|
25
|
+
],
|
|
33
26
|
"license": "MIT",
|
|
34
|
-
"
|
|
27
|
+
"main": "index.js",
|
|
28
|
+
"repository": "git@github.com:formatjs/formatjs.git",
|
|
29
|
+
"types": "index.d.ts"
|
|
35
30
|
}
|
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";
|
|
@@ -317,7 +317,7 @@
|
|
|
317
317
|
return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm);
|
|
318
318
|
};
|
|
319
319
|
P.inverseCosine = P.acos = function() {
|
|
320
|
-
var
|
|
320
|
+
var x = this, Ctor = x.constructor, k = x.abs().cmp(1), pr = Ctor.precision, rm = Ctor.rounding;
|
|
321
321
|
if (k !== -1) {
|
|
322
322
|
return k === 0 ? x.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0) : new Ctor(NaN);
|
|
323
323
|
}
|
|
@@ -325,11 +325,10 @@
|
|
|
325
325
|
return getPi(Ctor, pr + 4, rm).times(0.5);
|
|
326
326
|
Ctor.precision = pr + 6;
|
|
327
327
|
Ctor.rounding = 1;
|
|
328
|
-
x = x.
|
|
329
|
-
halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
|
|
328
|
+
x = new Ctor(1).minus(x).div(x.plus(1)).sqrt().atan();
|
|
330
329
|
Ctor.precision = pr;
|
|
331
330
|
Ctor.rounding = rm;
|
|
332
|
-
return
|
|
331
|
+
return x.times(2);
|
|
333
332
|
};
|
|
334
333
|
P.inverseHyperbolicCosine = P.acosh = function() {
|
|
335
334
|
var pr, rm, x = this, Ctor = x.constructor;
|
|
@@ -1541,14 +1540,16 @@
|
|
|
1541
1540
|
function isOdd(n) {
|
|
1542
1541
|
return n.d[n.d.length - 1] & 1;
|
|
1543
1542
|
}
|
|
1544
|
-
function maxOrMin(Ctor, args,
|
|
1545
|
-
var y, x = new Ctor(args[0]), i = 0;
|
|
1543
|
+
function maxOrMin(Ctor, args, n) {
|
|
1544
|
+
var k, y, x = new Ctor(args[0]), i = 0;
|
|
1546
1545
|
for (; ++i < args.length; ) {
|
|
1547
1546
|
y = new Ctor(args[i]);
|
|
1548
1547
|
if (!y.s) {
|
|
1549
1548
|
x = y;
|
|
1550
1549
|
break;
|
|
1551
|
-
}
|
|
1550
|
+
}
|
|
1551
|
+
k = x.cmp(y);
|
|
1552
|
+
if (k === n || k === 0 && x.s === n) {
|
|
1552
1553
|
x = y;
|
|
1553
1554
|
}
|
|
1554
1555
|
}
|
|
@@ -2130,7 +2131,8 @@
|
|
|
2130
2131
|
x.d = [v];
|
|
2131
2132
|
}
|
|
2132
2133
|
return;
|
|
2133
|
-
}
|
|
2134
|
+
}
|
|
2135
|
+
if (v * 0 !== 0) {
|
|
2134
2136
|
if (!v)
|
|
2135
2137
|
x.s = NaN;
|
|
2136
2138
|
x.e = NaN;
|
|
@@ -2138,18 +2140,28 @@
|
|
|
2138
2140
|
return;
|
|
2139
2141
|
}
|
|
2140
2142
|
return parseDecimal(x, v.toString());
|
|
2141
|
-
} else if (t !== "string") {
|
|
2142
|
-
throw Error(invalidArgument + v);
|
|
2143
2143
|
}
|
|
2144
|
-
if (
|
|
2145
|
-
|
|
2146
|
-
x.s = -1;
|
|
2147
|
-
} else {
|
|
2148
|
-
if (i2 === 43)
|
|
2144
|
+
if (t === "string") {
|
|
2145
|
+
if ((i2 = v.charCodeAt(0)) === 45) {
|
|
2149
2146
|
v = v.slice(1);
|
|
2150
|
-
|
|
2147
|
+
x.s = -1;
|
|
2148
|
+
} else {
|
|
2149
|
+
if (i2 === 43)
|
|
2150
|
+
v = v.slice(1);
|
|
2151
|
+
x.s = 1;
|
|
2152
|
+
}
|
|
2153
|
+
return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);
|
|
2151
2154
|
}
|
|
2152
|
-
|
|
2155
|
+
if (t === "bigint") {
|
|
2156
|
+
if (v < 0) {
|
|
2157
|
+
v = -v;
|
|
2158
|
+
x.s = -1;
|
|
2159
|
+
} else {
|
|
2160
|
+
x.s = 1;
|
|
2161
|
+
}
|
|
2162
|
+
return parseDecimal(x, v.toString());
|
|
2163
|
+
}
|
|
2164
|
+
throw Error(invalidArgument + v);
|
|
2153
2165
|
}
|
|
2154
2166
|
Decimal2.prototype = P;
|
|
2155
2167
|
Decimal2.ROUND_UP = 0;
|
|
@@ -2259,10 +2271,10 @@
|
|
|
2259
2271
|
return new this(x).log(10);
|
|
2260
2272
|
}
|
|
2261
2273
|
function max() {
|
|
2262
|
-
return maxOrMin(this, arguments,
|
|
2274
|
+
return maxOrMin(this, arguments, -1);
|
|
2263
2275
|
}
|
|
2264
2276
|
function min() {
|
|
2265
|
-
return maxOrMin(this, arguments,
|
|
2277
|
+
return maxOrMin(this, arguments, 1);
|
|
2266
2278
|
}
|
|
2267
2279
|
function mod(x, y) {
|
|
2268
2280
|
return new this(x).mod(y);
|
|
@@ -7145,18 +7157,23 @@
|
|
|
7145
7157
|
);
|
|
7146
7158
|
}
|
|
7147
7159
|
}
|
|
7148
|
-
function stringListFromIterable(
|
|
7149
|
-
if (
|
|
7160
|
+
function stringListFromIterable(iterable) {
|
|
7161
|
+
if (typeof iterable !== "object")
|
|
7150
7162
|
return [];
|
|
7151
|
-
|
|
7152
|
-
const
|
|
7153
|
-
|
|
7154
|
-
|
|
7155
|
-
|
|
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`);
|
|
7156
7173
|
}
|
|
7157
|
-
|
|
7174
|
+
elements.push(result.value);
|
|
7158
7175
|
}
|
|
7159
|
-
return
|
|
7176
|
+
return elements;
|
|
7160
7177
|
}
|
|
7161
7178
|
function createPartsFromList(internalSlotMap, lf, list) {
|
|
7162
7179
|
const size = list.length;
|
|
@@ -7415,10 +7432,10 @@
|
|
|
7415
7432
|
|
|
7416
7433
|
decimal.js/decimal.mjs:
|
|
7417
7434
|
(*!
|
|
7418
|
-
* decimal.js v10.
|
|
7435
|
+
* decimal.js v10.6.0
|
|
7419
7436
|
* An arbitrary-precision Decimal type for JavaScript.
|
|
7420
7437
|
* https://github.com/MikeMcl/decimal.js
|
|
7421
|
-
* Copyright (c)
|
|
7438
|
+
* Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
|
|
7422
7439
|
* MIT Licence
|
|
7423
7440
|
*)
|
|
7424
7441
|
*/
|