@formatjs/ecma402-abstract 1.11.9 → 1.11.10
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/262.d.ts +92 -0
- package/262.d.ts.map +1 -0
- package/262.js +362 -0
- package/CanonicalizeLocaleList.d.ts +6 -0
- package/CanonicalizeLocaleList.d.ts.map +1 -0
- package/CanonicalizeLocaleList.js +12 -0
- package/CanonicalizeTimeZoneName.d.ts +9 -0
- package/CanonicalizeTimeZoneName.d.ts.map +1 -0
- package/CanonicalizeTimeZoneName.js +21 -0
- package/CoerceOptionsToObject.d.ts +7 -0
- package/CoerceOptionsToObject.d.ts.map +1 -0
- package/CoerceOptionsToObject.js +16 -0
- package/DefaultNumberOption.d.ts +9 -0
- package/DefaultNumberOption.d.ts.map +1 -0
- package/DefaultNumberOption.js +14 -0
- package/GetNumberOption.d.ts +10 -0
- package/GetNumberOption.d.ts.map +1 -0
- package/GetNumberOption.js +18 -0
- package/GetOption.d.ts +10 -0
- package/GetOption.d.ts.map +1 -0
- package/GetOption.js +35 -0
- package/GetOptionsObject.d.ts +7 -0
- package/GetOptionsObject.d.ts.map +1 -0
- package/GetOptionsObject.js +18 -0
- package/IsSanctionedSimpleUnitIdentifier.d.ts +14 -0
- package/IsSanctionedSimpleUnitIdentifier.d.ts.map +1 -0
- package/IsSanctionedSimpleUnitIdentifier.js +68 -0
- package/IsValidTimeZoneName.d.ts +10 -0
- package/IsValidTimeZoneName.d.ts.map +1 -0
- package/IsValidTimeZoneName.js +23 -0
- package/IsWellFormedCurrencyCode.d.ts +5 -0
- package/IsWellFormedCurrencyCode.d.ts.map +1 -0
- package/IsWellFormedCurrencyCode.js +25 -0
- package/IsWellFormedUnitIdentifier.d.ts +6 -0
- package/IsWellFormedUnitIdentifier.d.ts.map +1 -0
- package/IsWellFormedUnitIdentifier.js +32 -0
- package/NumberFormat/ComputeExponent.d.ts +12 -0
- package/NumberFormat/ComputeExponent.d.ts.map +1 -0
- package/NumberFormat/ComputeExponent.js +43 -0
- package/NumberFormat/ComputeExponentForMagnitude.d.ts +10 -0
- package/NumberFormat/ComputeExponentForMagnitude.d.ts.map +1 -0
- package/NumberFormat/ComputeExponentForMagnitude.js +64 -0
- package/NumberFormat/CurrencyDigits.d.ts +7 -0
- package/NumberFormat/CurrencyDigits.d.ts.map +1 -0
- package/NumberFormat/CurrencyDigits.js +14 -0
- package/NumberFormat/FormatNumericToParts.d.ts +5 -0
- package/NumberFormat/FormatNumericToParts.d.ts.map +1 -0
- package/NumberFormat/FormatNumericToParts.js +18 -0
- package/NumberFormat/FormatNumericToString.d.ts +9 -0
- package/NumberFormat/FormatNumericToString.d.ts.map +1 -0
- package/NumberFormat/FormatNumericToString.js +45 -0
- package/NumberFormat/InitializeNumberFormat.d.ts +13 -0
- package/NumberFormat/InitializeNumberFormat.d.ts.map +1 -0
- package/NumberFormat/InitializeNumberFormat.js +68 -0
- package/NumberFormat/PartitionNumberPattern.d.ts +8 -0
- package/NumberFormat/PartitionNumberPattern.d.ts.map +1 -0
- package/NumberFormat/PartitionNumberPattern.js +80 -0
- package/NumberFormat/SetNumberFormatDigitOptions.d.ts +6 -0
- package/NumberFormat/SetNumberFormatDigitOptions.d.ts.map +1 -0
- package/NumberFormat/SetNumberFormatDigitOptions.js +40 -0
- package/NumberFormat/SetNumberFormatUnitOptions.d.ts +8 -0
- package/NumberFormat/SetNumberFormatUnitOptions.d.ts.map +1 -0
- package/NumberFormat/SetNumberFormatUnitOptions.js +43 -0
- package/NumberFormat/ToRawFixed.d.ts +10 -0
- package/NumberFormat/ToRawFixed.d.ts.map +1 -0
- package/NumberFormat/ToRawFixed.js +55 -0
- package/NumberFormat/ToRawPrecision.d.ts +3 -0
- package/NumberFormat/ToRawPrecision.d.ts.map +1 -0
- package/NumberFormat/ToRawPrecision.js +78 -0
- package/NumberFormat/digit-mapping.generated.d.ts +2 -0
- package/NumberFormat/digit-mapping.generated.d.ts.map +1 -0
- package/NumberFormat/digit-mapping.generated.js +4 -0
- package/NumberFormat/format_to_parts.d.ts +22 -0
- package/NumberFormat/format_to_parts.d.ts.map +1 -0
- package/NumberFormat/format_to_parts.js +424 -0
- package/PartitionPattern.d.ts +9 -0
- package/PartitionPattern.d.ts.map +1 -0
- package/PartitionPattern.js +39 -0
- package/SupportedLocales.d.ts +10 -0
- package/SupportedLocales.d.ts.map +1 -0
- package/SupportedLocales.js +24 -0
- package/data.d.ts +6 -0
- package/data.d.ts.map +1 -0
- package/data.js +17 -0
- package/index.d.ts +37 -0
- package/index.d.ts.map +1 -0
- package/index.js +48 -0
- package/lib/262.d.ts +92 -0
- package/lib/262.d.ts.map +1 -0
- package/lib/262.js +336 -0
- package/lib/CanonicalizeLocaleList.d.ts +6 -0
- package/lib/CanonicalizeLocaleList.d.ts.map +1 -0
- package/lib/CanonicalizeLocaleList.js +8 -0
- package/lib/CanonicalizeTimeZoneName.d.ts +9 -0
- package/lib/CanonicalizeTimeZoneName.d.ts.map +1 -0
- package/lib/CanonicalizeTimeZoneName.js +17 -0
- package/lib/CoerceOptionsToObject.d.ts +7 -0
- package/lib/CoerceOptionsToObject.d.ts.map +1 -0
- package/lib/CoerceOptionsToObject.js +12 -0
- package/lib/DefaultNumberOption.d.ts +9 -0
- package/lib/DefaultNumberOption.d.ts.map +1 -0
- package/lib/DefaultNumberOption.js +10 -0
- package/lib/GetNumberOption.d.ts +10 -0
- package/lib/GetNumberOption.d.ts.map +1 -0
- package/lib/GetNumberOption.js +14 -0
- package/lib/GetOption.d.ts +10 -0
- package/lib/GetOption.d.ts.map +1 -0
- package/lib/GetOption.js +31 -0
- package/lib/GetOptionsObject.d.ts +7 -0
- package/lib/GetOptionsObject.d.ts.map +1 -0
- package/lib/GetOptionsObject.js +14 -0
- package/lib/IsSanctionedSimpleUnitIdentifier.d.ts +14 -0
- package/lib/IsSanctionedSimpleUnitIdentifier.d.ts.map +1 -0
- package/lib/IsSanctionedSimpleUnitIdentifier.js +63 -0
- package/lib/IsValidTimeZoneName.d.ts +10 -0
- package/lib/IsValidTimeZoneName.d.ts.map +1 -0
- package/lib/IsValidTimeZoneName.js +19 -0
- package/lib/IsWellFormedCurrencyCode.d.ts +5 -0
- package/lib/IsWellFormedCurrencyCode.d.ts.map +1 -0
- package/lib/IsWellFormedCurrencyCode.js +21 -0
- package/lib/IsWellFormedUnitIdentifier.d.ts +6 -0
- package/lib/IsWellFormedUnitIdentifier.d.ts.map +1 -0
- package/lib/IsWellFormedUnitIdentifier.js +28 -0
- package/lib/NumberFormat/ComputeExponent.d.ts +12 -0
- package/lib/NumberFormat/ComputeExponent.d.ts.map +1 -0
- package/lib/NumberFormat/ComputeExponent.js +39 -0
- package/lib/NumberFormat/ComputeExponentForMagnitude.d.ts +10 -0
- package/lib/NumberFormat/ComputeExponentForMagnitude.d.ts.map +1 -0
- package/lib/NumberFormat/ComputeExponentForMagnitude.js +60 -0
- package/lib/NumberFormat/CurrencyDigits.d.ts +7 -0
- package/lib/NumberFormat/CurrencyDigits.d.ts.map +1 -0
- package/lib/NumberFormat/CurrencyDigits.js +10 -0
- package/lib/NumberFormat/FormatNumericToParts.d.ts +5 -0
- package/lib/NumberFormat/FormatNumericToParts.d.ts.map +1 -0
- package/lib/NumberFormat/FormatNumericToParts.js +14 -0
- package/lib/NumberFormat/FormatNumericToString.d.ts +9 -0
- package/lib/NumberFormat/FormatNumericToString.d.ts.map +1 -0
- package/lib/NumberFormat/FormatNumericToString.js +41 -0
- package/lib/NumberFormat/InitializeNumberFormat.d.ts +13 -0
- package/lib/NumberFormat/InitializeNumberFormat.d.ts.map +1 -0
- package/lib/NumberFormat/InitializeNumberFormat.js +64 -0
- package/lib/NumberFormat/PartitionNumberPattern.d.ts +8 -0
- package/lib/NumberFormat/PartitionNumberPattern.d.ts.map +1 -0
- package/lib/NumberFormat/PartitionNumberPattern.js +75 -0
- package/lib/NumberFormat/SetNumberFormatDigitOptions.d.ts +6 -0
- package/lib/NumberFormat/SetNumberFormatDigitOptions.d.ts.map +1 -0
- package/lib/NumberFormat/SetNumberFormatDigitOptions.js +36 -0
- package/lib/NumberFormat/SetNumberFormatUnitOptions.d.ts +8 -0
- package/lib/NumberFormat/SetNumberFormatUnitOptions.d.ts.map +1 -0
- package/lib/NumberFormat/SetNumberFormatUnitOptions.js +39 -0
- package/lib/NumberFormat/ToRawFixed.d.ts +10 -0
- package/lib/NumberFormat/ToRawFixed.d.ts.map +1 -0
- package/lib/NumberFormat/ToRawFixed.js +51 -0
- package/lib/NumberFormat/ToRawPrecision.d.ts +3 -0
- package/lib/NumberFormat/ToRawPrecision.d.ts.map +1 -0
- package/lib/NumberFormat/ToRawPrecision.js +74 -0
- package/lib/NumberFormat/digit-mapping.generated.d.ts +2 -0
- package/lib/NumberFormat/digit-mapping.generated.d.ts.map +1 -0
- package/lib/NumberFormat/digit-mapping.generated.js +1 -0
- package/lib/NumberFormat/format_to_parts.d.ts +22 -0
- package/lib/NumberFormat/format_to_parts.d.ts.map +1 -0
- package/lib/NumberFormat/format_to_parts.js +421 -0
- package/lib/PartitionPattern.d.ts +9 -0
- package/lib/PartitionPattern.d.ts.map +1 -0
- package/lib/PartitionPattern.js +35 -0
- package/lib/SupportedLocales.d.ts +10 -0
- package/lib/SupportedLocales.d.ts.map +1 -0
- package/lib/SupportedLocales.js +20 -0
- package/lib/data.d.ts +6 -0
- package/lib/data.d.ts.map +1 -0
- package/lib/data.js +13 -0
- package/lib/index.d.ts +37 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +34 -0
- package/lib/regex.generated.d.ts +2 -0
- package/lib/regex.generated.d.ts.map +1 -0
- package/lib/regex.generated.js +2 -0
- package/lib/types/core.d.ts +11 -0
- package/lib/types/core.d.ts.map +1 -0
- package/lib/types/core.js +1 -0
- package/lib/types/date-time.d.ts +135 -0
- package/lib/types/date-time.d.ts.map +1 -0
- package/lib/types/date-time.js +6 -0
- package/lib/types/displaynames.d.ts +47 -0
- package/lib/types/displaynames.d.ts.map +1 -0
- package/lib/types/displaynames.js +1 -0
- package/lib/types/list.d.ts +19 -0
- package/lib/types/list.d.ts.map +1 -0
- package/lib/types/list.js +1 -0
- package/lib/types/number.d.ts +147 -0
- package/lib/types/number.d.ts.map +1 -0
- package/lib/types/number.js +1 -0
- package/lib/types/plural-rules.d.ts +17 -0
- package/lib/types/plural-rules.d.ts.map +1 -0
- package/lib/types/plural-rules.js +1 -0
- package/lib/types/relative-time.d.ts +41 -0
- package/lib/types/relative-time.d.ts.map +1 -0
- package/lib/types/relative-time.js +1 -0
- package/lib/utils.d.ts +24 -0
- package/lib/utils.d.ts.map +1 -0
- package/lib/utils.js +78 -0
- package/package.json +2 -2
- package/regex.generated.d.ts +2 -0
- package/regex.generated.d.ts.map +1 -0
- package/regex.generated.js +5 -0
- package/types/core.d.ts +11 -0
- package/types/core.d.ts.map +1 -0
- package/types/core.js +2 -0
- package/types/date-time.d.ts +135 -0
- package/types/date-time.d.ts.map +1 -0
- package/types/date-time.js +9 -0
- package/types/displaynames.d.ts +47 -0
- package/types/displaynames.d.ts.map +1 -0
- package/types/displaynames.js +2 -0
- package/types/list.d.ts +19 -0
- package/types/list.d.ts.map +1 -0
- package/types/list.js +2 -0
- package/types/number.d.ts +147 -0
- package/types/number.d.ts.map +1 -0
- package/types/number.js +2 -0
- package/types/plural-rules.d.ts +17 -0
- package/types/plural-rules.d.ts.map +1 -0
- package/types/plural-rules.js +2 -0
- package/types/relative-time.d.ts +41 -0
- package/types/relative-time.d.ts.map +1 -0
- package/types/relative-time.js +2 -0
- package/utils.d.ts +24 -0
- package/utils.d.ts.map +1 -0
- package/utils.js +90 -0
- package/262.ts +0 -372
- package/BUILD +0 -97
- package/CHANGELOG.md +0 -709
- package/CanonicalizeLocaleList.ts +0 -8
- package/CanonicalizeTimeZoneName.ts +0 -29
- package/CoerceOptionsToObject.ts +0 -13
- package/DefaultNumberOption.ts +0 -28
- package/GetNumberOption.ts +0 -29
- package/GetOption.ts +0 -38
- package/GetOptionsObject.ts +0 -14
- package/IsSanctionedSimpleUnitIdentifier.ts +0 -66
- package/IsValidTimeZoneName.ts +0 -27
- package/IsWellFormedCurrencyCode.ts +0 -23
- package/IsWellFormedUnitIdentifier.ts +0 -32
- package/NumberFormat/ComputeExponent.ts +0 -49
- package/NumberFormat/ComputeExponentForMagnitude.ts +0 -71
- package/NumberFormat/CurrencyDigits.ts +0 -13
- package/NumberFormat/FormatNumericToParts.ts +0 -22
- package/NumberFormat/FormatNumericToString.ts +0 -71
- package/NumberFormat/InitializeNumberFormat.ts +0 -147
- package/NumberFormat/PartitionNumberPattern.ts +0 -86
- package/NumberFormat/SetNumberFormatDigitOptions.ts +0 -45
- package/NumberFormat/SetNumberFormatUnitOptions.ts +0 -77
- package/NumberFormat/ToRawFixed.ts +0 -56
- package/NumberFormat/ToRawPrecision.ts +0 -86
- package/NumberFormat/digit-mapping.generated.ts +0 -1
- package/NumberFormat/format_to_parts.ts +0 -571
- package/PartitionPattern.ts +0 -38
- package/SupportedLocales.ts +0 -31
- package/data.ts +0 -9
- package/index.ts +0 -45
- package/regex.generated.ts +0 -2
- package/scripts/digit-mapping.ts +0 -109
- package/scripts/regex-gen.ts +0 -19
- package/tests/PartitionPattern.test.ts +0 -38
- package/tests/ToRawFixed.test.tsx +0 -41
- package/tests/ToRawPrecision.test.tsx +0 -65
- package/tsconfig.json +0 -5
- package/types/core.ts +0 -11
- package/types/date-time.ts +0 -199
- package/types/displaynames.ts +0 -48
- package/types/list.ts +0 -22
- package/types/number.ts +0 -240
- package/types/plural-rules.ts +0 -18
- package/types/relative-time.ts +0 -74
- package/utils.ts +0 -128
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PartitionNumberPattern = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var FormatNumericToString_1 = require("./FormatNumericToString");
|
|
6
|
+
var _262_1 = require("../262");
|
|
7
|
+
var ComputeExponent_1 = require("./ComputeExponent");
|
|
8
|
+
var format_to_parts_1 = tslib_1.__importDefault(require("./format_to_parts"));
|
|
9
|
+
/**
|
|
10
|
+
* https://tc39.es/ecma402/#sec-formatnumberstring
|
|
11
|
+
*/
|
|
12
|
+
function PartitionNumberPattern(numberFormat, x, _a) {
|
|
13
|
+
var _b;
|
|
14
|
+
var getInternalSlots = _a.getInternalSlots;
|
|
15
|
+
var internalSlots = getInternalSlots(numberFormat);
|
|
16
|
+
var pl = internalSlots.pl, dataLocaleData = internalSlots.dataLocaleData, numberingSystem = internalSlots.numberingSystem;
|
|
17
|
+
var symbols = dataLocaleData.numbers.symbols[numberingSystem] ||
|
|
18
|
+
dataLocaleData.numbers.symbols[dataLocaleData.numbers.nu[0]];
|
|
19
|
+
var magnitude = 0;
|
|
20
|
+
var exponent = 0;
|
|
21
|
+
var n;
|
|
22
|
+
if (isNaN(x)) {
|
|
23
|
+
n = symbols.nan;
|
|
24
|
+
}
|
|
25
|
+
else if (!isFinite(x)) {
|
|
26
|
+
n = symbols.infinity;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
if (internalSlots.style === 'percent') {
|
|
30
|
+
x *= 100;
|
|
31
|
+
}
|
|
32
|
+
;
|
|
33
|
+
_b = (0, ComputeExponent_1.ComputeExponent)(numberFormat, x, {
|
|
34
|
+
getInternalSlots: getInternalSlots,
|
|
35
|
+
}), exponent = _b[0], magnitude = _b[1];
|
|
36
|
+
// Preserve more precision by doing multiplication when exponent is negative.
|
|
37
|
+
x = exponent < 0 ? x * Math.pow(10, -exponent) : x / Math.pow(10, exponent);
|
|
38
|
+
var formatNumberResult = (0, FormatNumericToString_1.FormatNumericToString)(internalSlots, x);
|
|
39
|
+
n = formatNumberResult.formattedString;
|
|
40
|
+
x = formatNumberResult.roundedNumber;
|
|
41
|
+
}
|
|
42
|
+
// Based on https://tc39.es/ecma402/#sec-getnumberformatpattern
|
|
43
|
+
// We need to do this before `x` is rounded.
|
|
44
|
+
var sign;
|
|
45
|
+
var signDisplay = internalSlots.signDisplay;
|
|
46
|
+
switch (signDisplay) {
|
|
47
|
+
case 'never':
|
|
48
|
+
sign = 0;
|
|
49
|
+
break;
|
|
50
|
+
case 'auto':
|
|
51
|
+
if ((0, _262_1.SameValue)(x, 0) || x > 0 || isNaN(x)) {
|
|
52
|
+
sign = 0;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
sign = -1;
|
|
56
|
+
}
|
|
57
|
+
break;
|
|
58
|
+
case 'always':
|
|
59
|
+
if ((0, _262_1.SameValue)(x, 0) || x > 0 || isNaN(x)) {
|
|
60
|
+
sign = 1;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
sign = -1;
|
|
64
|
+
}
|
|
65
|
+
break;
|
|
66
|
+
default:
|
|
67
|
+
// x === 0 -> x is 0 or x is -0
|
|
68
|
+
if (x === 0 || isNaN(x)) {
|
|
69
|
+
sign = 0;
|
|
70
|
+
}
|
|
71
|
+
else if (x > 0) {
|
|
72
|
+
sign = 1;
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
sign = -1;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return (0, format_to_parts_1.default)({ roundedNumber: x, formattedString: n, exponent: exponent, magnitude: magnitude, sign: sign }, internalSlots.dataLocaleData, pl, internalSlots);
|
|
79
|
+
}
|
|
80
|
+
exports.PartitionNumberPattern = PartitionNumberPattern;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { NumberFormatDigitOptions, NumberFormatNotation, NumberFormatDigitInternalSlots } from '../types/number';
|
|
2
|
+
/**
|
|
3
|
+
* https://tc39.es/ecma402/#sec-setnfdigitoptions
|
|
4
|
+
*/
|
|
5
|
+
export declare function SetNumberFormatDigitOptions(internalSlots: NumberFormatDigitInternalSlots, opts: NumberFormatDigitOptions, mnfdDefault: number, mxfdDefault: number, notation: NumberFormatNotation): void;
|
|
6
|
+
//# sourceMappingURL=SetNumberFormatDigitOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SetNumberFormatDigitOptions.d.ts","sourceRoot":"","sources":["SetNumberFormatDigitOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,8BAA8B,EAC/B,MAAM,iBAAiB,CAAA;AAIxB;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,aAAa,EAAE,8BAA8B,EAC7C,IAAI,EAAE,wBAAwB,EAC9B,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,oBAAoB,QA4B/B"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SetNumberFormatDigitOptions = void 0;
|
|
4
|
+
var GetNumberOption_1 = require("../GetNumberOption");
|
|
5
|
+
var DefaultNumberOption_1 = require("../DefaultNumberOption");
|
|
6
|
+
/**
|
|
7
|
+
* https://tc39.es/ecma402/#sec-setnfdigitoptions
|
|
8
|
+
*/
|
|
9
|
+
function SetNumberFormatDigitOptions(internalSlots, opts, mnfdDefault, mxfdDefault, notation) {
|
|
10
|
+
var mnid = (0, GetNumberOption_1.GetNumberOption)(opts, 'minimumIntegerDigits', 1, 21, 1);
|
|
11
|
+
var mnfd = opts.minimumFractionDigits;
|
|
12
|
+
var mxfd = opts.maximumFractionDigits;
|
|
13
|
+
var mnsd = opts.minimumSignificantDigits;
|
|
14
|
+
var mxsd = opts.maximumSignificantDigits;
|
|
15
|
+
internalSlots.minimumIntegerDigits = mnid;
|
|
16
|
+
if (mnsd !== undefined || mxsd !== undefined) {
|
|
17
|
+
internalSlots.roundingType = 'significantDigits';
|
|
18
|
+
mnsd = (0, DefaultNumberOption_1.DefaultNumberOption)(mnsd, 1, 21, 1);
|
|
19
|
+
mxsd = (0, DefaultNumberOption_1.DefaultNumberOption)(mxsd, mnsd, 21, 21);
|
|
20
|
+
internalSlots.minimumSignificantDigits = mnsd;
|
|
21
|
+
internalSlots.maximumSignificantDigits = mxsd;
|
|
22
|
+
}
|
|
23
|
+
else if (mnfd !== undefined || mxfd !== undefined) {
|
|
24
|
+
internalSlots.roundingType = 'fractionDigits';
|
|
25
|
+
mnfd = (0, DefaultNumberOption_1.DefaultNumberOption)(mnfd, 0, 20, mnfdDefault);
|
|
26
|
+
var mxfdActualDefault = Math.max(mnfd, mxfdDefault);
|
|
27
|
+
mxfd = (0, DefaultNumberOption_1.DefaultNumberOption)(mxfd, mnfd, 20, mxfdActualDefault);
|
|
28
|
+
internalSlots.minimumFractionDigits = mnfd;
|
|
29
|
+
internalSlots.maximumFractionDigits = mxfd;
|
|
30
|
+
}
|
|
31
|
+
else if (notation === 'compact') {
|
|
32
|
+
internalSlots.roundingType = 'compactRounding';
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
internalSlots.roundingType = 'fractionDigits';
|
|
36
|
+
internalSlots.minimumFractionDigits = mnfdDefault;
|
|
37
|
+
internalSlots.maximumFractionDigits = mxfdDefault;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.SetNumberFormatDigitOptions = SetNumberFormatDigitOptions;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { NumberFormatInternal, NumberFormatOptions } from '../types/number';
|
|
2
|
+
/**
|
|
3
|
+
* https://tc39.es/ecma402/#sec-setnumberformatunitoptions
|
|
4
|
+
*/
|
|
5
|
+
export declare function SetNumberFormatUnitOptions(nf: Intl.NumberFormat, options: NumberFormatOptions | undefined, { getInternalSlots, }: {
|
|
6
|
+
getInternalSlots(nf: Intl.NumberFormat): NumberFormatInternal;
|
|
7
|
+
}): void;
|
|
8
|
+
//# sourceMappingURL=SetNumberFormatUnitOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SetNumberFormatUnitOptions.d.ts","sourceRoot":"","sources":["SetNumberFormatUnitOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAE,mBAAmB,EAAC,MAAM,iBAAiB,CAAA;AAKzE;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,EAAE,EAAE,IAAI,CAAC,YAAY,EACrB,OAAO,iCAA2C,EAClD,EACE,gBAAgB,GACjB,EAAE;IAAC,gBAAgB,CAAC,EAAE,EAAE,IAAI,CAAC,YAAY,GAAG,oBAAoB,CAAA;CAAC,QA+DnE"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SetNumberFormatUnitOptions = void 0;
|
|
4
|
+
var GetOption_1 = require("../GetOption");
|
|
5
|
+
var IsWellFormedCurrencyCode_1 = require("../IsWellFormedCurrencyCode");
|
|
6
|
+
var IsWellFormedUnitIdentifier_1 = require("../IsWellFormedUnitIdentifier");
|
|
7
|
+
/**
|
|
8
|
+
* https://tc39.es/ecma402/#sec-setnumberformatunitoptions
|
|
9
|
+
*/
|
|
10
|
+
function SetNumberFormatUnitOptions(nf, options, _a) {
|
|
11
|
+
if (options === void 0) { options = Object.create(null); }
|
|
12
|
+
var getInternalSlots = _a.getInternalSlots;
|
|
13
|
+
var internalSlots = getInternalSlots(nf);
|
|
14
|
+
var style = (0, GetOption_1.GetOption)(options, 'style', 'string', ['decimal', 'percent', 'currency', 'unit'], 'decimal');
|
|
15
|
+
internalSlots.style = style;
|
|
16
|
+
var currency = (0, GetOption_1.GetOption)(options, 'currency', 'string', undefined, undefined);
|
|
17
|
+
if (currency !== undefined && !(0, IsWellFormedCurrencyCode_1.IsWellFormedCurrencyCode)(currency)) {
|
|
18
|
+
throw RangeError('Malformed currency code');
|
|
19
|
+
}
|
|
20
|
+
if (style === 'currency' && currency === undefined) {
|
|
21
|
+
throw TypeError('currency cannot be undefined');
|
|
22
|
+
}
|
|
23
|
+
var currencyDisplay = (0, GetOption_1.GetOption)(options, 'currencyDisplay', 'string', ['code', 'symbol', 'narrowSymbol', 'name'], 'symbol');
|
|
24
|
+
var currencySign = (0, GetOption_1.GetOption)(options, 'currencySign', 'string', ['standard', 'accounting'], 'standard');
|
|
25
|
+
var unit = (0, GetOption_1.GetOption)(options, 'unit', 'string', undefined, undefined);
|
|
26
|
+
if (unit !== undefined && !(0, IsWellFormedUnitIdentifier_1.IsWellFormedUnitIdentifier)(unit)) {
|
|
27
|
+
throw RangeError('Invalid unit argument for Intl.NumberFormat()');
|
|
28
|
+
}
|
|
29
|
+
if (style === 'unit' && unit === undefined) {
|
|
30
|
+
throw TypeError('unit cannot be undefined');
|
|
31
|
+
}
|
|
32
|
+
var unitDisplay = (0, GetOption_1.GetOption)(options, 'unitDisplay', 'string', ['short', 'narrow', 'long'], 'short');
|
|
33
|
+
if (style === 'currency') {
|
|
34
|
+
internalSlots.currency = currency.toUpperCase();
|
|
35
|
+
internalSlots.currencyDisplay = currencyDisplay;
|
|
36
|
+
internalSlots.currencySign = currencySign;
|
|
37
|
+
}
|
|
38
|
+
if (style === 'unit') {
|
|
39
|
+
internalSlots.unit = unit;
|
|
40
|
+
internalSlots.unitDisplay = unitDisplay;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.SetNumberFormatUnitOptions = SetNumberFormatUnitOptions;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RawNumberFormatResult } from '../types/number';
|
|
2
|
+
/**
|
|
3
|
+
* TODO: dedup with intl-pluralrules and support BigInt
|
|
4
|
+
* https://tc39.es/ecma402/#sec-torawfixed
|
|
5
|
+
* @param x a finite non-negative Number or BigInt
|
|
6
|
+
* @param minFraction and integer between 0 and 20
|
|
7
|
+
* @param maxFraction and integer between 0 and 20
|
|
8
|
+
*/
|
|
9
|
+
export declare function ToRawFixed(x: number, minFraction: number, maxFraction: number): RawNumberFormatResult;
|
|
10
|
+
//# sourceMappingURL=ToRawFixed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToRawFixed.d.ts","sourceRoot":"","sources":["ToRawFixed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,qBAAqB,EAAC,MAAM,iBAAiB,CAAA;AAGrD;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,CAAC,EAAE,MAAM,EACT,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,GAClB,qBAAqB,CAyCvB"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ToRawFixed = void 0;
|
|
4
|
+
var utils_1 = require("../utils");
|
|
5
|
+
/**
|
|
6
|
+
* TODO: dedup with intl-pluralrules and support BigInt
|
|
7
|
+
* https://tc39.es/ecma402/#sec-torawfixed
|
|
8
|
+
* @param x a finite non-negative Number or BigInt
|
|
9
|
+
* @param minFraction and integer between 0 and 20
|
|
10
|
+
* @param maxFraction and integer between 0 and 20
|
|
11
|
+
*/
|
|
12
|
+
function ToRawFixed(x, minFraction, maxFraction) {
|
|
13
|
+
var f = maxFraction;
|
|
14
|
+
var n = Math.round(x * Math.pow(10, f));
|
|
15
|
+
var xFinal = n / Math.pow(10, f);
|
|
16
|
+
// n is a positive integer, but it is possible to be greater than 1e21.
|
|
17
|
+
// In such case we will go the slow path.
|
|
18
|
+
// See also: https://tc39.es/ecma262/#sec-numeric-types-number-tostring
|
|
19
|
+
var m;
|
|
20
|
+
if (n < 1e21) {
|
|
21
|
+
m = n.toString();
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
m = n.toString();
|
|
25
|
+
var _a = m.split('e'), mantissa = _a[0], exponent = _a[1];
|
|
26
|
+
m = mantissa.replace('.', '');
|
|
27
|
+
m = m + (0, utils_1.repeat)('0', Math.max(+exponent - m.length + 1, 0));
|
|
28
|
+
}
|
|
29
|
+
var int;
|
|
30
|
+
if (f !== 0) {
|
|
31
|
+
var k = m.length;
|
|
32
|
+
if (k <= f) {
|
|
33
|
+
var z = (0, utils_1.repeat)('0', f + 1 - k);
|
|
34
|
+
m = z + m;
|
|
35
|
+
k = f + 1;
|
|
36
|
+
}
|
|
37
|
+
var a = m.slice(0, k - f);
|
|
38
|
+
var b = m.slice(k - f);
|
|
39
|
+
m = "".concat(a, ".").concat(b);
|
|
40
|
+
int = a.length;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
int = m.length;
|
|
44
|
+
}
|
|
45
|
+
var cut = maxFraction - minFraction;
|
|
46
|
+
while (cut > 0 && m[m.length - 1] === '0') {
|
|
47
|
+
m = m.slice(0, -1);
|
|
48
|
+
cut--;
|
|
49
|
+
}
|
|
50
|
+
if (m[m.length - 1] === '.') {
|
|
51
|
+
m = m.slice(0, -1);
|
|
52
|
+
}
|
|
53
|
+
return { formattedString: m, roundedNumber: xFinal, integerDigitsCount: int };
|
|
54
|
+
}
|
|
55
|
+
exports.ToRawFixed = ToRawFixed;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToRawPrecision.d.ts","sourceRoot":"","sources":["ToRawPrecision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,qBAAqB,EAAC,MAAM,iBAAiB,CAAA;AAGrD,wBAAgB,cAAc,CAC5B,CAAC,EAAE,MAAM,EACT,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,GACnB,qBAAqB,CA8EvB"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ToRawPrecision = void 0;
|
|
4
|
+
var utils_1 = require("../utils");
|
|
5
|
+
function ToRawPrecision(x, minPrecision, maxPrecision) {
|
|
6
|
+
var p = maxPrecision;
|
|
7
|
+
var m;
|
|
8
|
+
var e;
|
|
9
|
+
var xFinal;
|
|
10
|
+
if (x === 0) {
|
|
11
|
+
m = (0, utils_1.repeat)('0', p);
|
|
12
|
+
e = 0;
|
|
13
|
+
xFinal = 0;
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
var xToString = x.toString();
|
|
17
|
+
// If xToString is formatted as scientific notation, the number is either very small or very
|
|
18
|
+
// large. If the precision of the formatted string is lower that requested max precision, we
|
|
19
|
+
// should still infer them from the formatted string, otherwise the formatted result might have
|
|
20
|
+
// precision loss (e.g. 1e41 will not have 0 in every trailing digits).
|
|
21
|
+
var xToStringExponentIndex = xToString.indexOf('e');
|
|
22
|
+
var _a = xToString.split('e'), xToStringMantissa = _a[0], xToStringExponent = _a[1];
|
|
23
|
+
var xToStringMantissaWithoutDecimalPoint = xToStringMantissa.replace('.', '');
|
|
24
|
+
if (xToStringExponentIndex >= 0 &&
|
|
25
|
+
xToStringMantissaWithoutDecimalPoint.length <= p) {
|
|
26
|
+
e = +xToStringExponent;
|
|
27
|
+
m =
|
|
28
|
+
xToStringMantissaWithoutDecimalPoint +
|
|
29
|
+
(0, utils_1.repeat)('0', p - xToStringMantissaWithoutDecimalPoint.length);
|
|
30
|
+
xFinal = x;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
e = (0, utils_1.getMagnitude)(x);
|
|
34
|
+
var decimalPlaceOffset = e - p + 1;
|
|
35
|
+
// n is the integer containing the required precision digits. To derive the formatted string,
|
|
36
|
+
// we will adjust its decimal place in the logic below.
|
|
37
|
+
var n = Math.round(adjustDecimalPlace(x, decimalPlaceOffset));
|
|
38
|
+
// The rounding caused the change of magnitude, so we should increment `e` by 1.
|
|
39
|
+
if (adjustDecimalPlace(n, p - 1) >= 10) {
|
|
40
|
+
e = e + 1;
|
|
41
|
+
// Divide n by 10 to swallow one precision.
|
|
42
|
+
n = Math.floor(n / 10);
|
|
43
|
+
}
|
|
44
|
+
m = n.toString();
|
|
45
|
+
// Equivalent of n * 10 ** (e - p + 1)
|
|
46
|
+
xFinal = adjustDecimalPlace(n, p - 1 - e);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
var int;
|
|
50
|
+
if (e >= p - 1) {
|
|
51
|
+
m = m + (0, utils_1.repeat)('0', e - p + 1);
|
|
52
|
+
int = e + 1;
|
|
53
|
+
}
|
|
54
|
+
else if (e >= 0) {
|
|
55
|
+
m = "".concat(m.slice(0, e + 1), ".").concat(m.slice(e + 1));
|
|
56
|
+
int = e + 1;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
m = "0.".concat((0, utils_1.repeat)('0', -e - 1)).concat(m);
|
|
60
|
+
int = 1;
|
|
61
|
+
}
|
|
62
|
+
if (m.indexOf('.') >= 0 && maxPrecision > minPrecision) {
|
|
63
|
+
var cut = maxPrecision - minPrecision;
|
|
64
|
+
while (cut > 0 && m[m.length - 1] === '0') {
|
|
65
|
+
m = m.slice(0, -1);
|
|
66
|
+
cut--;
|
|
67
|
+
}
|
|
68
|
+
if (m[m.length - 1] === '.') {
|
|
69
|
+
m = m.slice(0, -1);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return { formattedString: m, roundedNumber: xFinal, integerDigitsCount: int };
|
|
73
|
+
// x / (10 ** magnitude), but try to preserve as much floating point precision as possible.
|
|
74
|
+
function adjustDecimalPlace(x, magnitude) {
|
|
75
|
+
return magnitude < 0 ? x * Math.pow(10, -magnitude) : x / Math.pow(10, magnitude);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.ToRawPrecision = ToRawPrecision;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"digit-mapping.generated.d.ts","sourceRoot":"","sources":["digit-mapping.generated.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAA67G,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.digitMapping = void 0;
|
|
4
|
+
exports.digitMapping = { "adlm": ["𞥐", "𞥑", "𞥒", "𞥓", "𞥔", "𞥕", "𞥖", "𞥗", "𞥘", "𞥙"], "ahom": ["𑜰", "𑜱", "𑜲", "𑜳", "𑜴", "𑜵", "𑜶", "𑜷", "𑜸", "𑜹"], "arab": ["٠", "١", "٢", "٣", "٤", "٥", "٦", "٧", "٨", "٩"], "arabext": ["۰", "۱", "۲", "۳", "۴", "۵", "۶", "۷", "۸", "۹"], "bali": ["᭐", "᭑", "᭒", "᭓", "᭔", "᭕", "᭖", "᭗", "᭘", "᭙"], "beng": ["০", "১", "২", "৩", "৪", "৫", "৬", "৭", "৮", "৯"], "bhks": ["𑱐", "𑱑", "𑱒", "𑱓", "𑱔", "𑱕", "𑱖", "𑱗", "𑱘", "𑱙"], "brah": ["𑁦", "𑁧", "𑁨", "𑁩", "𑁪", "𑁫", "𑁬", "𑁭", "𑁮", "𑁯"], "cakm": ["𑄶", "𑄷", "𑄸", "𑄹", "𑄺", "𑄻", "𑄼", "𑄽", "𑄾", "𑄿"], "cham": ["꩐", "꩑", "꩒", "꩓", "꩔", "꩕", "꩖", "꩗", "꩘", "꩙"], "deva": ["०", "१", "२", "३", "४", "५", "६", "७", "८", "९"], "diak": ["𑥐", "𑥑", "𑥒", "𑥓", "𑥔", "𑥕", "𑥖", "𑥗", "𑥘", "𑥙"], "fullwide": ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], "gong": ["𑶠", "𑶡", "𑶢", "𑶣", "𑶤", "𑶥", "𑶦", "𑶧", "𑶨", "𑶩"], "gonm": ["𑵐", "𑵑", "𑵒", "𑵓", "𑵔", "𑵕", "𑵖", "𑵗", "𑵘", "𑵙"], "gujr": ["૦", "૧", "૨", "૩", "૪", "૫", "૬", "૭", "૮", "૯"], "guru": ["੦", "੧", "੨", "੩", "੪", "੫", "੬", "੭", "੮", "੯"], "hanidec": ["〇", "一", "二", "三", "四", "五", "六", "七", "八", "九"], "hmng": ["𖭐", "𖭑", "𖭒", "𖭓", "𖭔", "𖭕", "𖭖", "𖭗", "𖭘", "𖭙"], "hmnp": ["𞅀", "𞅁", "𞅂", "𞅃", "𞅄", "𞅅", "𞅆", "𞅇", "𞅈", "𞅉"], "java": ["꧐", "꧑", "꧒", "꧓", "꧔", "꧕", "꧖", "꧗", "꧘", "꧙"], "kali": ["꤀", "꤁", "꤂", "꤃", "꤄", "꤅", "꤆", "꤇", "꤈", "꤉"], "khmr": ["០", "១", "២", "៣", "៤", "៥", "៦", "៧", "៨", "៩"], "knda": ["೦", "೧", "೨", "೩", "೪", "೫", "೬", "೭", "೮", "೯"], "lana": ["᪀", "᪁", "᪂", "᪃", "᪄", "᪅", "᪆", "᪇", "᪈", "᪉"], "lanatham": ["᪐", "᪑", "᪒", "᪓", "᪔", "᪕", "᪖", "᪗", "᪘", "᪙"], "laoo": ["໐", "໑", "໒", "໓", "໔", "໕", "໖", "໗", "໘", "໙"], "lepc": ["᪐", "᪑", "᪒", "᪓", "᪔", "᪕", "᪖", "᪗", "᪘", "᪙"], "limb": ["᥆", "᥇", "᥈", "᥉", "᥊", "᥋", "᥌", "᥍", "᥎", "᥏"], "mathbold": ["𝟎", "𝟏", "𝟐", "𝟑", "𝟒", "𝟓", "𝟔", "𝟕", "𝟖", "𝟗"], "mathdbl": ["𝟘", "𝟙", "𝟚", "𝟛", "𝟜", "𝟝", "𝟞", "𝟟", "𝟠", "𝟡"], "mathmono": ["𝟶", "𝟷", "𝟸", "𝟹", "𝟺", "𝟻", "𝟼", "𝟽", "𝟾", "𝟿"], "mathsanb": ["𝟬", "𝟭", "𝟮", "𝟯", "𝟰", "𝟱", "𝟲", "𝟳", "𝟴", "𝟵"], "mathsans": ["𝟢", "𝟣", "𝟤", "𝟥", "𝟦", "𝟧", "𝟨", "𝟩", "𝟪", "𝟫"], "mlym": ["൦", "൧", "൨", "൩", "൪", "൫", "൬", "൭", "൮", "൯"], "modi": ["𑙐", "𑙑", "𑙒", "𑙓", "𑙔", "𑙕", "𑙖", "𑙗", "𑙘", "𑙙"], "mong": ["᠐", "᠑", "᠒", "᠓", "᠔", "᠕", "᠖", "᠗", "᠘", "᠙"], "mroo": ["𖩠", "𖩡", "𖩢", "𖩣", "𖩤", "𖩥", "𖩦", "𖩧", "𖩨", "𖩩"], "mtei": ["꯰", "꯱", "꯲", "꯳", "꯴", "꯵", "꯶", "꯷", "꯸", "꯹"], "mymr": ["၀", "၁", "၂", "၃", "၄", "၅", "၆", "၇", "၈", "၉"], "mymrshan": ["႐", "႑", "႒", "႓", "႔", "႕", "႖", "႗", "႘", "႙"], "mymrtlng": ["꧰", "꧱", "꧲", "꧳", "꧴", "꧵", "꧶", "꧷", "꧸", "꧹"], "newa": ["𑑐", "𑑑", "𑑒", "𑑓", "𑑔", "𑑕", "𑑖", "𑑗", "𑑘", "𑑙"], "nkoo": ["߀", "߁", "߂", "߃", "߄", "߅", "߆", "߇", "߈", "߉"], "olck": ["᱐", "᱑", "᱒", "᱓", "᱔", "᱕", "᱖", "᱗", "᱘", "᱙"], "orya": ["୦", "୧", "୨", "୩", "୪", "୫", "୬", "୭", "୮", "୯"], "osma": ["𐒠", "𐒡", "𐒢", "𐒣", "𐒤", "𐒥", "𐒦", "𐒧", "𐒨", "𐒩"], "rohg": ["𐴰", "𐴱", "𐴲", "𐴳", "𐴴", "𐴵", "𐴶", "𐴷", "𐴸", "𐴹"], "saur": ["꣐", "꣑", "꣒", "꣓", "꣔", "꣕", "꣖", "꣗", "꣘", "꣙"], "segment": ["🯰", "🯱", "🯲", "🯳", "🯴", "🯵", "🯶", "🯷", "🯸", "🯹"], "shrd": ["𑇐", "𑇑", "𑇒", "𑇓", "𑇔", "𑇕", "𑇖", "𑇗", "𑇘", "𑇙"], "sind": ["𑋰", "𑋱", "𑋲", "𑋳", "𑋴", "𑋵", "𑋶", "𑋷", "𑋸", "𑋹"], "sinh": ["෦", "෧", "෨", "෩", "෪", "෫", "෬", "෭", "෮", "෯"], "sora": ["𑃰", "𑃱", "𑃲", "𑃳", "𑃴", "𑃵", "𑃶", "𑃷", "𑃸", "𑃹"], "sund": ["᮰", "᮱", "᮲", "᮳", "᮴", "᮵", "᮶", "᮷", "᮸", "᮹"], "takr": ["𑛀", "𑛁", "𑛂", "𑛃", "𑛄", "𑛅", "𑛆", "𑛇", "𑛈", "𑛉"], "talu": ["᧐", "᧑", "᧒", "᧓", "᧔", "᧕", "᧖", "᧗", "᧘", "᧙"], "tamldec": ["௦", "௧", "௨", "௩", "௪", "௫", "௬", "௭", "௮", "௯"], "telu": ["౦", "౧", "౨", "౩", "౪", "౫", "౬", "౭", "౮", "౯"], "thai": ["๐", "๑", "๒", "๓", "๔", "๕", "๖", "๗", "๘", "๙"], "tibt": ["༠", "༡", "༢", "༣", "༤", "༥", "༦", "༧", "༨", "༩"], "tirh": ["𑓐", "𑓑", "𑓒", "𑓓", "𑓔", "𑓕", "𑓖", "𑓗", "𑓘", "𑓙"], "vaii": ["ᘠ", "ᘡ", "ᘢ", "ᘣ", "ᘤ", "ᘥ", "ᘦ", "ᘧ", "ᘨ", "ᘩ"], "wara": ["𑣠", "𑣡", "𑣢", "𑣣", "𑣤", "𑣥", "𑣦", "𑣧", "𑣨", "𑣩"], "wcho": ["𞋰", "𞋱", "𞋲", "𞋳", "𞋴", "𞋵", "𞋶", "𞋷", "𞋸", "𞋹"] };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { NumberFormatOptionsStyle, NumberFormatOptionsNotation, NumberFormatOptionsCompactDisplay, NumberFormatOptionsCurrencyDisplay, NumberFormatOptionsCurrencySign, NumberFormatOptionsUnitDisplay, NumberFormatLocaleInternalData, NumberFormatPart } from '../types/number';
|
|
2
|
+
interface NumberResult {
|
|
3
|
+
formattedString: string;
|
|
4
|
+
roundedNumber: number;
|
|
5
|
+
sign: -1 | 0 | 1;
|
|
6
|
+
exponent: number;
|
|
7
|
+
magnitude: number;
|
|
8
|
+
}
|
|
9
|
+
export default function formatToParts(numberResult: NumberResult, data: NumberFormatLocaleInternalData, pl: Intl.PluralRules, options: {
|
|
10
|
+
numberingSystem: string;
|
|
11
|
+
useGrouping: boolean;
|
|
12
|
+
style: NumberFormatOptionsStyle;
|
|
13
|
+
notation: NumberFormatOptionsNotation;
|
|
14
|
+
compactDisplay?: NumberFormatOptionsCompactDisplay;
|
|
15
|
+
currency?: string;
|
|
16
|
+
currencyDisplay?: NumberFormatOptionsCurrencyDisplay;
|
|
17
|
+
currencySign?: NumberFormatOptionsCurrencySign;
|
|
18
|
+
unit?: string;
|
|
19
|
+
unitDisplay?: NumberFormatOptionsUnitDisplay;
|
|
20
|
+
}): NumberFormatPart[];
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=format_to_parts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format_to_parts.d.ts","sourceRoot":"","sources":["format_to_parts.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,2BAA2B,EAC3B,iCAAiC,EACjC,kCAAkC,EAClC,+BAA+B,EAC/B,8BAA8B,EAC9B,8BAA8B,EAM9B,gBAAgB,EACjB,MAAM,iBAAiB,CAAA;AAexB,UAAU,YAAY;IACpB,eAAe,EAAE,MAAM,CAAA;IACvB,aAAa,EAAE,MAAM,CAAA;IACrB,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAEhB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,CAAC,OAAO,UAAU,aAAa,CACnC,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,8BAA8B,EACpC,EAAE,EAAE,IAAI,CAAC,WAAW,EACpB,OAAO,EAAE;IACP,eAAe,EAAE,MAAM,CAAA;IACvB,WAAW,EAAE,OAAO,CAAA;IACpB,KAAK,EAAE,wBAAwB,CAAA;IAE/B,QAAQ,EAAE,2BAA2B,CAAA;IAErC,cAAc,CAAC,EAAE,iCAAiC,CAAA;IAElD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,eAAe,CAAC,EAAE,kCAAkC,CAAA;IACpD,YAAY,CAAC,EAAE,+BAA+B,CAAA;IAE9C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,8BAA8B,CAAA;CAC7C,GACA,gBAAgB,EAAE,CAySpB"}
|