@formatjs/intl-numberformat 9.1.0 → 9.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 +1 -1
- package/index.js +1 -1
- package/package.json +6 -6
- package/polyfill-force.js +7 -9
- package/polyfill.iife.js +3289 -3426
- package/polyfill.js +8 -10
- package/should-polyfill.js +56 -66
- package/src/core.d.ts +4 -3
- package/src/core.js +175 -215
- package/src/currency-digits.generated.js +76 -76
- package/src/get_internal_slots.d.ts +2 -1
- package/src/get_internal_slots.js +8 -7
- package/src/numbering-systems.generated.js +99 -1
- package/src/to_locale_string.d.ts +4 -4
- package/src/to_locale_string.js +7 -6
- package/src/types.d.ts +18 -17
- package/src/types.js +1 -1
- package/supported-locales.generated.js +573 -1
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-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|
|
48
|
+
PYG: 0,
|
|
49
|
+
RSD: 0,
|
|
50
|
+
RWF: 0,
|
|
51
|
+
SEK: 2,
|
|
52
|
+
SLE: 2,
|
|
53
|
+
SLL: 0,
|
|
54
|
+
SOS: 0,
|
|
55
|
+
STD: 0,
|
|
56
|
+
SYP: 0,
|
|
57
|
+
TMM: 0,
|
|
58
|
+
TND: 3,
|
|
59
|
+
TRL: 0,
|
|
60
|
+
TWD: 2,
|
|
61
|
+
TZS: 2,
|
|
62
|
+
UGX: 0,
|
|
63
|
+
UYI: 0,
|
|
64
|
+
UYW: 4,
|
|
65
|
+
UZS: 2,
|
|
66
|
+
VEF: 2,
|
|
67
|
+
VND: 0,
|
|
68
|
+
VUV: 0,
|
|
69
|
+
XAD: 2,
|
|
70
|
+
XAF: 0,
|
|
71
|
+
XAU: 2,
|
|
72
|
+
XOF: 0,
|
|
73
|
+
XPF: 0,
|
|
74
|
+
YER: 0,
|
|
75
|
+
ZMK: 0,
|
|
76
|
+
ZWD: 0
|
|
77
77
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
// Type-only circular import
|
|
2
|
-
|
|
2
|
+
import "@formatjs/ecma402-abstract";
|
|
3
|
+
const internalSlotMap = new WeakMap();
|
|
3
4
|
export default function getInternalSlots(x) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
let internalSlots = internalSlotMap.get(x);
|
|
6
|
+
if (!internalSlots) {
|
|
7
|
+
internalSlots = Object.create(null);
|
|
8
|
+
internalSlotMap.set(x, internalSlots);
|
|
9
|
+
}
|
|
10
|
+
return internalSlots;
|
|
10
11
|
}
|
|
@@ -1 +1,99 @@
|
|
|
1
|
-
export
|
|
1
|
+
export const numberingSystemNames = [
|
|
2
|
+
"adlm",
|
|
3
|
+
"ahom",
|
|
4
|
+
"arab",
|
|
5
|
+
"arabext",
|
|
6
|
+
"armn",
|
|
7
|
+
"armnlow",
|
|
8
|
+
"bali",
|
|
9
|
+
"beng",
|
|
10
|
+
"bhks",
|
|
11
|
+
"brah",
|
|
12
|
+
"cakm",
|
|
13
|
+
"cham",
|
|
14
|
+
"cyrl",
|
|
15
|
+
"deva",
|
|
16
|
+
"diak",
|
|
17
|
+
"ethi",
|
|
18
|
+
"fullwide",
|
|
19
|
+
"gara",
|
|
20
|
+
"geor",
|
|
21
|
+
"gong",
|
|
22
|
+
"gonm",
|
|
23
|
+
"grek",
|
|
24
|
+
"greklow",
|
|
25
|
+
"gujr",
|
|
26
|
+
"gukh",
|
|
27
|
+
"guru",
|
|
28
|
+
"hanidays",
|
|
29
|
+
"hanidec",
|
|
30
|
+
"hans",
|
|
31
|
+
"hansfin",
|
|
32
|
+
"hant",
|
|
33
|
+
"hantfin",
|
|
34
|
+
"hebr",
|
|
35
|
+
"hmng",
|
|
36
|
+
"hmnp",
|
|
37
|
+
"java",
|
|
38
|
+
"jpan",
|
|
39
|
+
"jpanfin",
|
|
40
|
+
"jpanyear",
|
|
41
|
+
"kali",
|
|
42
|
+
"kawi",
|
|
43
|
+
"khmr",
|
|
44
|
+
"knda",
|
|
45
|
+
"krai",
|
|
46
|
+
"lana",
|
|
47
|
+
"lanatham",
|
|
48
|
+
"laoo",
|
|
49
|
+
"latn",
|
|
50
|
+
"lepc",
|
|
51
|
+
"limb",
|
|
52
|
+
"mathbold",
|
|
53
|
+
"mathdbl",
|
|
54
|
+
"mathmono",
|
|
55
|
+
"mathsanb",
|
|
56
|
+
"mathsans",
|
|
57
|
+
"mlym",
|
|
58
|
+
"modi",
|
|
59
|
+
"mong",
|
|
60
|
+
"mroo",
|
|
61
|
+
"mtei",
|
|
62
|
+
"mymr",
|
|
63
|
+
"mymrepka",
|
|
64
|
+
"mymrpao",
|
|
65
|
+
"mymrshan",
|
|
66
|
+
"mymrtlng",
|
|
67
|
+
"nagm",
|
|
68
|
+
"newa",
|
|
69
|
+
"nkoo",
|
|
70
|
+
"olck",
|
|
71
|
+
"onao",
|
|
72
|
+
"orya",
|
|
73
|
+
"osma",
|
|
74
|
+
"outlined",
|
|
75
|
+
"rohg",
|
|
76
|
+
"roman",
|
|
77
|
+
"romanlow",
|
|
78
|
+
"saur",
|
|
79
|
+
"segment",
|
|
80
|
+
"shrd",
|
|
81
|
+
"sind",
|
|
82
|
+
"sinh",
|
|
83
|
+
"sora",
|
|
84
|
+
"sund",
|
|
85
|
+
"sunu",
|
|
86
|
+
"takr",
|
|
87
|
+
"talu",
|
|
88
|
+
"taml",
|
|
89
|
+
"tamldec",
|
|
90
|
+
"telu",
|
|
91
|
+
"thai",
|
|
92
|
+
"tibt",
|
|
93
|
+
"tirh",
|
|
94
|
+
"tnsa",
|
|
95
|
+
"tols",
|
|
96
|
+
"vaii",
|
|
97
|
+
"wara",
|
|
98
|
+
"wcho"
|
|
99
|
+
];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { NumberFormatOptions } from
|
|
1
|
+
import { type NumberFormatOptions } from "@formatjs/ecma402-abstract";
|
|
2
2
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
* Number.prototype.toLocaleString ponyfill
|
|
4
|
+
* https://tc39.es/ecma402/#sup-number.prototype.tolocalestring
|
|
5
|
+
*/
|
|
6
6
|
export declare function toLocaleString(x: number, locales?: string | string[], options?: NumberFormatOptions): string;
|
package/src/to_locale_string.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
// eslint-disable-next-line import/no-cycle
|
|
2
|
-
import { NumberFormat } from
|
|
2
|
+
import { NumberFormat } from "./core.js";
|
|
3
|
+
import "@formatjs/ecma402-abstract";
|
|
3
4
|
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
* Number.prototype.toLocaleString ponyfill
|
|
6
|
+
* https://tc39.es/ecma402/#sup-number.prototype.tolocalestring
|
|
7
|
+
*/
|
|
7
8
|
export function toLocaleString(x, locales, options) {
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
const numberFormat = new NumberFormat(locales, options);
|
|
10
|
+
return numberFormat.format(x);
|
|
10
11
|
}
|
package/src/types.d.ts
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { NumberFormatLocaleInternalData, NumberFormatOptions, NumberFormatPart, NumberRangeToParts, RawNumberLocaleData, ResolvedNumberFormatOptions } from
|
|
2
|
-
import Decimal from
|
|
1
|
+
import { type NumberFormatLocaleInternalData, type NumberFormatOptions, type NumberFormatPart, type NumberRangeToParts, type RawNumberLocaleData, type ResolvedNumberFormatOptions } from "@formatjs/ecma402-abstract";
|
|
2
|
+
import type Decimal from "decimal.js";
|
|
3
|
+
// Public --------------------------------------------------------------------------------------------------------------
|
|
3
4
|
export interface NumberFormat {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
resolvedOptions(): ResolvedNumberFormatOptions;
|
|
6
|
+
formatToParts(x: number | bigint | Decimal | string): NumberFormatPart[];
|
|
7
|
+
format(x: number | bigint | Decimal | string): string;
|
|
8
|
+
formatRange(start: number | bigint | Decimal | string, end: number | bigint | Decimal | string): string;
|
|
9
|
+
formatRangeToParts(start: number | bigint | Decimal | string, end: number | bigint | Decimal | string): NumberRangeToParts[];
|
|
9
10
|
}
|
|
10
11
|
export interface NumberFormatConstructor {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
new (locales?: string | string[], options?: NumberFormatOptions): NumberFormat;
|
|
13
|
+
(locales?: string | string[], options?: NumberFormatOptions): NumberFormat;
|
|
14
|
+
__addLocaleData(...data: RawNumberLocaleData[]): void;
|
|
15
|
+
__addUnitData(locale: string, unitsData: RawNumberLocaleData["data"]["units"]): void;
|
|
16
|
+
supportedLocalesOf(locales: string | string[], options?: Pick<NumberFormatOptions, "localeMatcher">): string[];
|
|
17
|
+
getDefaultLocale(): string;
|
|
18
|
+
__defaultLocale: string;
|
|
19
|
+
localeData: Record<string, NumberFormatLocaleInternalData | undefined>;
|
|
20
|
+
availableLocales: Set<string>;
|
|
21
|
+
polyfilled: boolean;
|
|
21
22
|
}
|
package/src/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import "@formatjs/ecma402-abstract";
|