@formatjs/ecma402-abstract 1.12.0 → 1.14.0
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/GetStringOrBooleanOption.d.ts +11 -0
- package/GetStringOrBooleanOption.d.ts.map +1 -0
- package/GetStringOrBooleanOption.js +35 -0
- package/NumberFormat/ApplyUnsignedRoundingMode.d.ts +3 -0
- package/NumberFormat/ApplyUnsignedRoundingMode.d.ts.map +1 -0
- package/NumberFormat/ApplyUnsignedRoundingMode.js +42 -0
- package/NumberFormat/CollapseNumberRange.d.ts +5 -0
- package/NumberFormat/CollapseNumberRange.d.ts.map +1 -0
- package/NumberFormat/CollapseNumberRange.js +10 -0
- package/NumberFormat/FormatApproximately.d.ts +8 -0
- package/NumberFormat/FormatApproximately.d.ts.map +1 -0
- package/NumberFormat/FormatApproximately.js +15 -0
- package/NumberFormat/FormatNumericRange.d.ts +8 -0
- package/NumberFormat/FormatNumericRange.d.ts.map +1 -0
- package/NumberFormat/FormatNumericRange.js +15 -0
- package/NumberFormat/FormatNumericRangeToParts.d.ts +8 -0
- package/NumberFormat/FormatNumericRangeToParts.d.ts.map +1 -0
- package/NumberFormat/FormatNumericRangeToParts.js +20 -0
- package/NumberFormat/GetUnsignedRoundingMode.d.ts +3 -0
- package/NumberFormat/GetUnsignedRoundingMode.d.ts.map +1 -0
- package/NumberFormat/GetUnsignedRoundingMode.js +32 -0
- package/NumberFormat/InitializeNumberFormat.d.ts.map +1 -1
- package/NumberFormat/InitializeNumberFormat.js +35 -4
- package/NumberFormat/PartitionNumberPattern.d.ts.map +1 -1
- package/NumberFormat/PartitionNumberPattern.js +14 -9
- package/NumberFormat/PartitionNumberRangePattern.d.ts +8 -0
- package/NumberFormat/PartitionNumberRangePattern.d.ts.map +1 -0
- package/NumberFormat/PartitionNumberRangePattern.js +36 -0
- package/NumberFormat/SetNumberFormatDigitOptions.d.ts.map +1 -1
- package/NumberFormat/SetNumberFormatDigitOptions.js +63 -18
- package/NumberFormat/format_to_parts.d.ts +2 -2
- package/NumberFormat/format_to_parts.d.ts.map +1 -1
- package/NumberFormat/format_to_parts.js +1 -1
- package/index.d.ts +8 -0
- package/index.d.ts.map +1 -1
- package/index.js +8 -0
- package/lib/GetStringOrBooleanOption.d.ts +11 -0
- package/lib/GetStringOrBooleanOption.d.ts.map +1 -0
- package/lib/GetStringOrBooleanOption.js +31 -0
- package/lib/NumberFormat/ApplyUnsignedRoundingMode.d.ts +3 -0
- package/lib/NumberFormat/ApplyUnsignedRoundingMode.d.ts.map +1 -0
- package/lib/NumberFormat/ApplyUnsignedRoundingMode.js +38 -0
- package/lib/NumberFormat/CollapseNumberRange.d.ts +5 -0
- package/lib/NumberFormat/CollapseNumberRange.d.ts.map +1 -0
- package/lib/NumberFormat/CollapseNumberRange.js +6 -0
- package/lib/NumberFormat/FormatApproximately.d.ts +8 -0
- package/lib/NumberFormat/FormatApproximately.d.ts.map +1 -0
- package/lib/NumberFormat/FormatApproximately.js +11 -0
- package/lib/NumberFormat/FormatNumericRange.d.ts +8 -0
- package/lib/NumberFormat/FormatNumericRange.d.ts.map +1 -0
- package/lib/NumberFormat/FormatNumericRange.js +11 -0
- package/lib/NumberFormat/FormatNumericRangeToParts.d.ts +8 -0
- package/lib/NumberFormat/FormatNumericRangeToParts.d.ts.map +1 -0
- package/lib/NumberFormat/FormatNumericRangeToParts.js +16 -0
- package/lib/NumberFormat/GetUnsignedRoundingMode.d.ts +3 -0
- package/lib/NumberFormat/GetUnsignedRoundingMode.d.ts.map +1 -0
- package/lib/NumberFormat/GetUnsignedRoundingMode.js +28 -0
- package/lib/NumberFormat/InitializeNumberFormat.d.ts.map +1 -1
- package/lib/NumberFormat/InitializeNumberFormat.js +35 -4
- package/lib/NumberFormat/PartitionNumberPattern.d.ts.map +1 -1
- package/lib/NumberFormat/PartitionNumberPattern.js +14 -9
- package/lib/NumberFormat/PartitionNumberRangePattern.d.ts +8 -0
- package/lib/NumberFormat/PartitionNumberRangePattern.d.ts.map +1 -0
- package/lib/NumberFormat/PartitionNumberRangePattern.js +32 -0
- package/lib/NumberFormat/SetNumberFormatDigitOptions.d.ts.map +1 -1
- package/lib/NumberFormat/SetNumberFormatDigitOptions.js +63 -18
- package/lib/NumberFormat/format_to_parts.d.ts +2 -2
- package/lib/NumberFormat/format_to_parts.d.ts.map +1 -1
- package/lib/NumberFormat/format_to_parts.js +1 -1
- package/lib/index.d.ts +8 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +8 -0
- package/lib/types/date-time.d.ts +3 -3
- package/lib/types/date-time.d.ts.map +1 -1
- package/lib/types/displaynames.d.ts +22 -3
- package/lib/types/displaynames.d.ts.map +1 -1
- package/lib/types/number.d.ts +25 -7
- package/lib/types/number.d.ts.map +1 -1
- package/package.json +1 -1
- package/types/date-time.d.ts +3 -3
- package/types/date-time.d.ts.map +1 -1
- package/types/displaynames.d.ts +22 -3
- package/types/displaynames.d.ts.map +1 -1
- package/types/number.d.ts +25 -7
- package/types/number.d.ts.map +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* https://tc39.es/ecma402/#sec-getstringorbooleanoption
|
|
3
|
+
* @param opts
|
|
4
|
+
* @param prop
|
|
5
|
+
* @param values
|
|
6
|
+
* @param trueValue
|
|
7
|
+
* @param falsyValue
|
|
8
|
+
* @param fallback
|
|
9
|
+
*/
|
|
10
|
+
export declare function GetStringOrBooleanOption<T extends object, K extends keyof T>(opts: T, prop: K, values: T[K][] | undefined, trueValue: T[K] | boolean, falsyValue: T[K] | boolean, fallback: T[K] | boolean): T[K] | boolean;
|
|
11
|
+
//# sourceMappingURL=GetStringOrBooleanOption.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GetStringOrBooleanOption.d.ts","sourceRoot":"","sources":["GetStringOrBooleanOption.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,EAC1E,IAAI,EAAE,CAAC,EACP,IAAI,EAAE,CAAC,EACP,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,EAC1B,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,EACzB,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,EAC1B,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,GACvB,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAyBhB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* https://tc39.es/ecma402/#sec-getstringorbooleanoption
|
|
4
|
+
* @param opts
|
|
5
|
+
* @param prop
|
|
6
|
+
* @param values
|
|
7
|
+
* @param trueValue
|
|
8
|
+
* @param falsyValue
|
|
9
|
+
* @param fallback
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.GetStringOrBooleanOption = void 0;
|
|
13
|
+
var _262_1 = require("./262");
|
|
14
|
+
function GetStringOrBooleanOption(opts, prop, values, trueValue, falsyValue, fallback) {
|
|
15
|
+
var value = opts[prop];
|
|
16
|
+
if (value === undefined) {
|
|
17
|
+
return fallback;
|
|
18
|
+
}
|
|
19
|
+
if (value === true) {
|
|
20
|
+
return trueValue;
|
|
21
|
+
}
|
|
22
|
+
var valueBoolean = Boolean(value);
|
|
23
|
+
if (valueBoolean === false) {
|
|
24
|
+
return falsyValue;
|
|
25
|
+
}
|
|
26
|
+
value = (0, _262_1.ToString)(value);
|
|
27
|
+
if (value === 'true' || value === 'false') {
|
|
28
|
+
return fallback;
|
|
29
|
+
}
|
|
30
|
+
if ((values || []).indexOf(value) === -1) {
|
|
31
|
+
throw new RangeError("Invalid value ".concat(value));
|
|
32
|
+
}
|
|
33
|
+
return value;
|
|
34
|
+
}
|
|
35
|
+
exports.GetStringOrBooleanOption = GetStringOrBooleanOption;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApplyUnsignedRoundingMode.d.ts","sourceRoot":"","sources":["ApplyUnsignedRoundingMode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,wBAAwB,EAAC,MAAM,iBAAiB,CAAA;AAExD,wBAAgB,yBAAyB,CACvC,CAAC,EAAE,MAAM,EACT,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,oBAAoB,EAAE,wBAAwB,GAC7C,MAAM,CA8CR"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApplyUnsignedRoundingMode = void 0;
|
|
4
|
+
function ApplyUnsignedRoundingMode(x, r1, r2, unsignedRoundingMode) {
|
|
5
|
+
if (x === r1)
|
|
6
|
+
return r1;
|
|
7
|
+
if (unsignedRoundingMode === undefined) {
|
|
8
|
+
throw new Error('unsignedRoundingMode is mandatory');
|
|
9
|
+
}
|
|
10
|
+
if (unsignedRoundingMode === 'zero') {
|
|
11
|
+
return r1;
|
|
12
|
+
}
|
|
13
|
+
if (unsignedRoundingMode === 'infinity') {
|
|
14
|
+
return r2;
|
|
15
|
+
}
|
|
16
|
+
var d1 = x - r1;
|
|
17
|
+
var d2 = r2 - x;
|
|
18
|
+
if (d1 < d2) {
|
|
19
|
+
return r1;
|
|
20
|
+
}
|
|
21
|
+
if (d2 < d1) {
|
|
22
|
+
return r2;
|
|
23
|
+
}
|
|
24
|
+
if (d1 !== d2) {
|
|
25
|
+
throw new Error('Unexpected error');
|
|
26
|
+
}
|
|
27
|
+
if (unsignedRoundingMode === 'half-zero') {
|
|
28
|
+
return r1;
|
|
29
|
+
}
|
|
30
|
+
if (unsignedRoundingMode === 'half-infinity') {
|
|
31
|
+
return r2;
|
|
32
|
+
}
|
|
33
|
+
if (unsignedRoundingMode !== 'half-even') {
|
|
34
|
+
throw new Error("Unexpected value for unsignedRoundingMode: ".concat(unsignedRoundingMode));
|
|
35
|
+
}
|
|
36
|
+
var cardinality = (r1 / (r2 - r1)) % 2;
|
|
37
|
+
if (cardinality === 0) {
|
|
38
|
+
return r1;
|
|
39
|
+
}
|
|
40
|
+
return r2;
|
|
41
|
+
}
|
|
42
|
+
exports.ApplyUnsignedRoundingMode = ApplyUnsignedRoundingMode;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CollapseNumberRange.d.ts","sourceRoot":"","sources":["CollapseNumberRange.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,KAE/C"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CollapseNumberRange = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* https://tc39.es/ecma402/#sec-collapsenumberrange
|
|
6
|
+
*/
|
|
7
|
+
function CollapseNumberRange(result) {
|
|
8
|
+
return result;
|
|
9
|
+
}
|
|
10
|
+
exports.CollapseNumberRange = CollapseNumberRange;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { NumberFormatInternal, NumberFormatPart } from '../types/number';
|
|
2
|
+
/**
|
|
3
|
+
* https://tc39.es/ecma402/#sec-formatapproximately
|
|
4
|
+
*/
|
|
5
|
+
export declare function FormatApproximately(numberFormat: Intl.NumberFormat, result: NumberFormatPart[], { getInternalSlots, }: {
|
|
6
|
+
getInternalSlots(nf: Intl.NumberFormat): NumberFormatInternal;
|
|
7
|
+
}): NumberFormatPart[];
|
|
8
|
+
//# sourceMappingURL=FormatApproximately.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormatApproximately.d.ts","sourceRoot":"","sources":["FormatApproximately.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAE,gBAAgB,EAAC,MAAM,iBAAiB,CAAA;AAEtE;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,IAAI,CAAC,YAAY,EAC/B,MAAM,EAAE,gBAAgB,EAAE,EAC1B,EACE,gBAAgB,GACjB,EAAE;IACD,gBAAgB,CAAC,EAAE,EAAE,IAAI,CAAC,YAAY,GAAG,oBAAoB,CAAA;CAC9D,sBAWF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FormatApproximately = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* https://tc39.es/ecma402/#sec-formatapproximately
|
|
6
|
+
*/
|
|
7
|
+
function FormatApproximately(numberFormat, result, _a) {
|
|
8
|
+
var getInternalSlots = _a.getInternalSlots;
|
|
9
|
+
var internalSlots = getInternalSlots(numberFormat);
|
|
10
|
+
var symbols = internalSlots.dataLocaleData.numbers.symbols[internalSlots.numberingSystem];
|
|
11
|
+
var approximatelySign = symbols.approximatelySign;
|
|
12
|
+
result.push({ type: 'approximatelySign', value: approximatelySign });
|
|
13
|
+
return result;
|
|
14
|
+
}
|
|
15
|
+
exports.FormatApproximately = FormatApproximately;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { NumberFormatInternal } from '../types/number';
|
|
2
|
+
/**
|
|
3
|
+
* https://tc39.es/ecma402/#sec-formatnumericrange
|
|
4
|
+
*/
|
|
5
|
+
export declare function FormatNumericRange(numberFormat: Intl.NumberFormat, x: number, y: number, { getInternalSlots, }: {
|
|
6
|
+
getInternalSlots(nf: Intl.NumberFormat): NumberFormatInternal;
|
|
7
|
+
}): string;
|
|
8
|
+
//# sourceMappingURL=FormatNumericRange.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormatNumericRange.d.ts","sourceRoot":"","sources":["FormatNumericRange.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,iBAAiB,CAAA;AAGpD;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,YAAY,EAAE,IAAI,CAAC,YAAY,EAC/B,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,EACE,gBAAgB,GACjB,EAAE;IACD,gBAAgB,CAAC,EAAE,EAAE,IAAI,CAAC,YAAY,GAAG,oBAAoB,CAAA;CAC9D,UAOF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FormatNumericRange = void 0;
|
|
4
|
+
var PartitionNumberRangePattern_1 = require("./PartitionNumberRangePattern");
|
|
5
|
+
/**
|
|
6
|
+
* https://tc39.es/ecma402/#sec-formatnumericrange
|
|
7
|
+
*/
|
|
8
|
+
function FormatNumericRange(numberFormat, x, y, _a) {
|
|
9
|
+
var getInternalSlots = _a.getInternalSlots;
|
|
10
|
+
var parts = (0, PartitionNumberRangePattern_1.PartitionNumberRangePattern)(numberFormat, x, y, {
|
|
11
|
+
getInternalSlots: getInternalSlots,
|
|
12
|
+
});
|
|
13
|
+
return parts.map(function (part) { return part.value; }).join('');
|
|
14
|
+
}
|
|
15
|
+
exports.FormatNumericRange = FormatNumericRange;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { NumberFormatInternal, NumberRangeToParts } from '../types/number';
|
|
2
|
+
/**
|
|
3
|
+
* https://tc39.es/ecma402/#sec-formatnumericrangetoparts
|
|
4
|
+
*/
|
|
5
|
+
export declare function FormatNumericRangeToParts(numberFormat: Intl.NumberFormat, x: number, y: number, { getInternalSlots, }: {
|
|
6
|
+
getInternalSlots(nf: Intl.NumberFormat): NumberFormatInternal;
|
|
7
|
+
}): NumberRangeToParts[];
|
|
8
|
+
//# sourceMappingURL=FormatNumericRangeToParts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormatNumericRangeToParts.d.ts","sourceRoot":"","sources":["FormatNumericRangeToParts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAE,kBAAkB,EAAC,MAAM,iBAAiB,CAAA;AAGxE;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,IAAI,CAAC,YAAY,EAC/B,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,EACE,gBAAgB,GACjB,EAAE;IACD,gBAAgB,CAAC,EAAE,EAAE,IAAI,CAAC,YAAY,GAAG,oBAAoB,CAAA;CAC9D,GACA,kBAAkB,EAAE,CAWtB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FormatNumericRangeToParts = void 0;
|
|
4
|
+
var PartitionNumberRangePattern_1 = require("./PartitionNumberRangePattern");
|
|
5
|
+
/**
|
|
6
|
+
* https://tc39.es/ecma402/#sec-formatnumericrangetoparts
|
|
7
|
+
*/
|
|
8
|
+
function FormatNumericRangeToParts(numberFormat, x, y, _a) {
|
|
9
|
+
var getInternalSlots = _a.getInternalSlots;
|
|
10
|
+
var parts = (0, PartitionNumberRangePattern_1.PartitionNumberRangePattern)(numberFormat, x, y, {
|
|
11
|
+
getInternalSlots: getInternalSlots,
|
|
12
|
+
});
|
|
13
|
+
return parts.map(function (part, index) { return ({
|
|
14
|
+
type: part.type,
|
|
15
|
+
value: part.value,
|
|
16
|
+
source: part.source,
|
|
17
|
+
result: index.toString(),
|
|
18
|
+
}); });
|
|
19
|
+
}
|
|
20
|
+
exports.FormatNumericRangeToParts = FormatNumericRangeToParts;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GetUnsignedRoundingMode.d.ts","sourceRoot":"","sources":["GetUnsignedRoundingMode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAE,wBAAwB,EAAC,MAAM,iBAAiB,CAAA;AA0B1E,wBAAgB,uBAAuB,CACrC,YAAY,EAAE,gBAAgB,EAC9B,UAAU,EAAE,OAAO,GAClB,wBAAwB,CAK1B"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetUnsignedRoundingMode = void 0;
|
|
4
|
+
var negativeMapping = {
|
|
5
|
+
ceil: 'zero',
|
|
6
|
+
floor: 'infinity',
|
|
7
|
+
expand: 'infinity',
|
|
8
|
+
trunc: 'zero',
|
|
9
|
+
halfCeil: 'half-zero',
|
|
10
|
+
halfFloor: 'half-infinity',
|
|
11
|
+
halfExpand: 'half-infinity',
|
|
12
|
+
halfTrunc: 'half-zero',
|
|
13
|
+
halfEven: 'half-even',
|
|
14
|
+
};
|
|
15
|
+
var positiveMapping = {
|
|
16
|
+
ceil: 'infinity',
|
|
17
|
+
floor: 'zero',
|
|
18
|
+
expand: 'infinity',
|
|
19
|
+
trunc: 'zero',
|
|
20
|
+
halfCeil: 'half-infinity',
|
|
21
|
+
halfFloor: 'half-zero',
|
|
22
|
+
halfExpand: 'half-infinity',
|
|
23
|
+
halfTrunc: 'half-zero',
|
|
24
|
+
halfEven: 'half-even',
|
|
25
|
+
};
|
|
26
|
+
function GetUnsignedRoundingMode(roundingMode, isNegative) {
|
|
27
|
+
if (isNegative) {
|
|
28
|
+
return negativeMapping[roundingMode];
|
|
29
|
+
}
|
|
30
|
+
return positiveMapping[roundingMode];
|
|
31
|
+
}
|
|
32
|
+
exports.GetUnsignedRoundingMode = GetUnsignedRoundingMode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InitializeNumberFormat.d.ts","sourceRoot":"","sources":["InitializeNumberFormat.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,8BAA8B,
|
|
1
|
+
{"version":3,"file":"InitializeNumberFormat.d.ts","sourceRoot":"","sources":["InitializeNumberFormat.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,8BAA8B,EAE/B,MAAM,iBAAiB,CAAA;AAgBxB;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,EAAE,EAAE,IAAI,CAAC,YAAY,EACrB,OAAO,EAAE,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,GAAG,SAAS,EACnD,IAAI,EAAE,mBAAmB,GAAG,SAAS,EACrC,EACE,gBAAgB,EAChB,UAAU,EACV,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,GACnB,EAAE;IACD,gBAAgB,CAAC,EAAE,EAAE,IAAI,CAAC,YAAY,GAAG,oBAAoB,CAAA;IAC7D,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,8BAA8B,GAAG,SAAS,CAAC,CAAA;IACtE,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC7B,oBAAoB,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IAC3C,gBAAgB,IAAI,MAAM,CAAA;IAC1B,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC3C,qBAgLF"}
|
|
@@ -9,6 +9,11 @@ var CurrencyDigits_1 = require("./CurrencyDigits");
|
|
|
9
9
|
var SetNumberFormatDigitOptions_1 = require("./SetNumberFormatDigitOptions");
|
|
10
10
|
var utils_1 = require("../utils");
|
|
11
11
|
var CoerceOptionsToObject_1 = require("../CoerceOptionsToObject");
|
|
12
|
+
var GetNumberOption_1 = require("../GetNumberOption");
|
|
13
|
+
var GetStringOrBooleanOption_1 = require("../GetStringOrBooleanOption");
|
|
14
|
+
var VALID_ROUND_INCREMENT_VALUES = [
|
|
15
|
+
1, 2, 5, 10, 20, 25, 50, 100, 200, 250, 500, 1000, 2000,
|
|
16
|
+
];
|
|
12
17
|
/**
|
|
13
18
|
* https://tc39.es/ecma402/#sec-initializenumberformat
|
|
14
19
|
*/
|
|
@@ -55,14 +60,40 @@ function InitializeNumberFormat(nf, locales, opts, _a) {
|
|
|
55
60
|
var notation = (0, GetOption_1.GetOption)(options, 'notation', 'string', ['standard', 'scientific', 'engineering', 'compact'], 'standard');
|
|
56
61
|
internalSlots.notation = notation;
|
|
57
62
|
(0, SetNumberFormatDigitOptions_1.SetNumberFormatDigitOptions)(internalSlots, options, mnfdDefault, mxfdDefault, notation);
|
|
63
|
+
var roundingIncrement = (0, GetNumberOption_1.GetNumberOption)(options, 'roundingIncrement', 1, 5000, 1);
|
|
64
|
+
if (VALID_ROUND_INCREMENT_VALUES.indexOf(roundingIncrement) === -1) {
|
|
65
|
+
throw new RangeError("Invalid rounding increment value: ".concat(roundingIncrement, ".\nValid values are ").concat(VALID_ROUND_INCREMENT_VALUES, "."));
|
|
66
|
+
}
|
|
67
|
+
if (roundingIncrement !== 1 &&
|
|
68
|
+
internalSlots.roundingType !== 'fractionDigits') {
|
|
69
|
+
throw new TypeError("For roundingIncrement > 1 only fractionDigits is a valid roundingType");
|
|
70
|
+
}
|
|
71
|
+
if (roundingIncrement !== 1 &&
|
|
72
|
+
internalSlots.maximumFractionDigits !== internalSlots.minimumFractionDigits) {
|
|
73
|
+
throw new RangeError('With roundingIncrement > 1, maximumFractionDigits and minimumFractionDigits must be equal.');
|
|
74
|
+
}
|
|
75
|
+
internalSlots.roundingIncrement = roundingIncrement;
|
|
76
|
+
var trailingZeroDisplay = (0, GetOption_1.GetOption)(options, 'trailingZeroDisplay', 'string', ['auto', 'stripIfInteger'], 'auto');
|
|
77
|
+
internalSlots.trailingZeroDisplay = trailingZeroDisplay;
|
|
58
78
|
var compactDisplay = (0, GetOption_1.GetOption)(options, 'compactDisplay', 'string', ['short', 'long'], 'short');
|
|
79
|
+
var defaultUseGrouping = 'auto';
|
|
59
80
|
if (notation === 'compact') {
|
|
60
81
|
internalSlots.compactDisplay = compactDisplay;
|
|
82
|
+
defaultUseGrouping = 'min2';
|
|
61
83
|
}
|
|
62
|
-
|
|
63
|
-
internalSlots.
|
|
64
|
-
|
|
65
|
-
|
|
84
|
+
internalSlots.useGrouping = (0, GetStringOrBooleanOption_1.GetStringOrBooleanOption)(options, 'useGrouping', ['min2', 'auto', 'always'], 'always', false, defaultUseGrouping);
|
|
85
|
+
internalSlots.signDisplay = (0, GetOption_1.GetOption)(options, 'signDisplay', 'string', ['auto', 'never', 'always', 'exceptZero', 'negative'], 'auto');
|
|
86
|
+
internalSlots.roundingMode = (0, GetOption_1.GetOption)(options, 'roundingMode', 'string', [
|
|
87
|
+
'ceil',
|
|
88
|
+
'floor',
|
|
89
|
+
'expand',
|
|
90
|
+
'trunc',
|
|
91
|
+
'halfCeil',
|
|
92
|
+
'halfFloor',
|
|
93
|
+
'halfExpand',
|
|
94
|
+
'halfTrunc',
|
|
95
|
+
'halfEven',
|
|
96
|
+
], 'halfExpand');
|
|
66
97
|
return nf;
|
|
67
98
|
}
|
|
68
99
|
exports.InitializeNumberFormat = InitializeNumberFormat;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PartitionNumberPattern.d.ts","sourceRoot":"","sources":["PartitionNumberPattern.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,iBAAiB,CAAA;AAMpD;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,IAAI,CAAC,YAAY,EAC/B,CAAC,EAAE,MAAM,EACT,EACE,gBAAgB,GACjB,EAAE;IACD,gBAAgB,CAAC,EAAE,EAAE,IAAI,CAAC,YAAY,GAAG,oBAAoB,CAAA;CAC9D,
|
|
1
|
+
{"version":3,"file":"PartitionNumberPattern.d.ts","sourceRoot":"","sources":["PartitionNumberPattern.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,iBAAiB,CAAA;AAMpD;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,IAAI,CAAC,YAAY,EAC/B,CAAC,EAAE,MAAM,EACT,EACE,gBAAgB,GACjB,EAAE;IACD,gBAAgB,CAAC,EAAE,EAAE,IAAI,CAAC,YAAY,GAAG,oBAAoB,CAAA;CAC9D,gDA0EF"}
|
|
@@ -22,19 +22,24 @@ function PartitionNumberPattern(numberFormat, x, _a) {
|
|
|
22
22
|
if (isNaN(x)) {
|
|
23
23
|
n = symbols.nan;
|
|
24
24
|
}
|
|
25
|
-
else if (
|
|
25
|
+
else if (x == Number.POSITIVE_INFINITY || x == Number.NEGATIVE_INFINITY) {
|
|
26
26
|
n = symbols.infinity;
|
|
27
27
|
}
|
|
28
28
|
else {
|
|
29
|
-
if (
|
|
30
|
-
x
|
|
29
|
+
if (!(0, _262_1.SameValue)(x, -0)) {
|
|
30
|
+
if (!isFinite(x)) {
|
|
31
|
+
throw new Error('Input must be a mathematical value');
|
|
32
|
+
}
|
|
33
|
+
if (internalSlots.style == 'percent') {
|
|
34
|
+
x *= 100;
|
|
35
|
+
}
|
|
36
|
+
;
|
|
37
|
+
_b = (0, ComputeExponent_1.ComputeExponent)(numberFormat, x, {
|
|
38
|
+
getInternalSlots: getInternalSlots,
|
|
39
|
+
}), exponent = _b[0], magnitude = _b[1];
|
|
40
|
+
// Preserve more precision by doing multiplication when exponent is negative.
|
|
41
|
+
x = exponent < 0 ? x * Math.pow(10, -exponent) : x / Math.pow(10, exponent);
|
|
31
42
|
}
|
|
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
43
|
var formatNumberResult = (0, FormatNumericToString_1.FormatNumericToString)(internalSlots, x);
|
|
39
44
|
n = formatNumberResult.formattedString;
|
|
40
45
|
x = formatNumberResult.roundedNumber;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { NumberFormatInternal, NumberFormatPart } from '../types/number';
|
|
2
|
+
/**
|
|
3
|
+
* https://tc39.es/ecma402/#sec-partitionnumberrangepattern
|
|
4
|
+
*/
|
|
5
|
+
export declare function PartitionNumberRangePattern(numberFormat: Intl.NumberFormat, x: number, y: number, { getInternalSlots, }: {
|
|
6
|
+
getInternalSlots(nf: Intl.NumberFormat): NumberFormatInternal;
|
|
7
|
+
}): NumberFormatPart[];
|
|
8
|
+
//# sourceMappingURL=PartitionNumberRangePattern.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PartitionNumberRangePattern.d.ts","sourceRoot":"","sources":["PartitionNumberRangePattern.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAE,gBAAgB,EAAC,MAAM,iBAAiB,CAAA;AAKtE;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,YAAY,EAAE,IAAI,CAAC,YAAY,EAC/B,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,EACE,gBAAgB,GACjB,EAAE;IACD,gBAAgB,CAAC,EAAE,EAAE,IAAI,CAAC,YAAY,GAAG,oBAAoB,CAAA;CAC9D,sBAiCF"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PartitionNumberRangePattern = void 0;
|
|
4
|
+
var PartitionNumberPattern_1 = require("./PartitionNumberPattern");
|
|
5
|
+
var CollapseNumberRange_1 = require("./CollapseNumberRange");
|
|
6
|
+
var FormatApproximately_1 = require("./FormatApproximately");
|
|
7
|
+
/**
|
|
8
|
+
* https://tc39.es/ecma402/#sec-partitionnumberrangepattern
|
|
9
|
+
*/
|
|
10
|
+
function PartitionNumberRangePattern(numberFormat, x, y, _a) {
|
|
11
|
+
var getInternalSlots = _a.getInternalSlots;
|
|
12
|
+
if (isNaN(x) || isNaN(y)) {
|
|
13
|
+
throw new RangeError('Input must be a number');
|
|
14
|
+
}
|
|
15
|
+
var result = [];
|
|
16
|
+
var xResult = (0, PartitionNumberPattern_1.PartitionNumberPattern)(numberFormat, x, { getInternalSlots: getInternalSlots });
|
|
17
|
+
var yResult = (0, PartitionNumberPattern_1.PartitionNumberPattern)(numberFormat, y, { getInternalSlots: getInternalSlots });
|
|
18
|
+
if (xResult === yResult) {
|
|
19
|
+
return (0, FormatApproximately_1.FormatApproximately)(numberFormat, xResult, { getInternalSlots: getInternalSlots });
|
|
20
|
+
}
|
|
21
|
+
for (var _i = 0, xResult_1 = xResult; _i < xResult_1.length; _i++) {
|
|
22
|
+
var r = xResult_1[_i];
|
|
23
|
+
r.source = 'startRange';
|
|
24
|
+
}
|
|
25
|
+
result = result.concat(xResult);
|
|
26
|
+
var internalSlots = getInternalSlots(numberFormat);
|
|
27
|
+
var symbols = internalSlots.dataLocaleData.numbers.symbols[internalSlots.numberingSystem];
|
|
28
|
+
result.push({ type: 'literal', value: symbols.rangeSign, source: 'shared' });
|
|
29
|
+
for (var _b = 0, yResult_1 = yResult; _b < yResult_1.length; _b++) {
|
|
30
|
+
var r = yResult_1[_b];
|
|
31
|
+
r.source = 'endRange';
|
|
32
|
+
}
|
|
33
|
+
result = result.concat(yResult);
|
|
34
|
+
return (0, CollapseNumberRange_1.CollapseNumberRange)(result);
|
|
35
|
+
}
|
|
36
|
+
exports.PartitionNumberRangePattern = PartitionNumberRangePattern;
|
|
@@ -1 +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;
|
|
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;AAKxB;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,aAAa,EAAE,8BAA8B,EAC7C,IAAI,EAAE,wBAAwB,EAC9B,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,oBAAoB,QA2E/B"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SetNumberFormatDigitOptions = void 0;
|
|
4
4
|
var GetNumberOption_1 = require("../GetNumberOption");
|
|
5
5
|
var DefaultNumberOption_1 = require("../DefaultNumberOption");
|
|
6
|
+
var GetOption_1 = require("../GetOption");
|
|
6
7
|
/**
|
|
7
8
|
* https://tc39.es/ecma402/#sec-setnfdigitoptions
|
|
8
9
|
*/
|
|
@@ -13,28 +14,72 @@ function SetNumberFormatDigitOptions(internalSlots, opts, mnfdDefault, mxfdDefau
|
|
|
13
14
|
var mnsd = opts.minimumSignificantDigits;
|
|
14
15
|
var mxsd = opts.maximumSignificantDigits;
|
|
15
16
|
internalSlots.minimumIntegerDigits = mnid;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
var roundingPriority = (0, GetOption_1.GetOption)(opts, 'roundingPriority', 'string', ['auto', 'morePrecision', 'lessPrecision'], 'auto');
|
|
18
|
+
var hasSd = mnsd !== undefined || mxsd !== undefined;
|
|
19
|
+
var hasFd = mnfd !== undefined || mxfd !== undefined;
|
|
20
|
+
var needSd = true;
|
|
21
|
+
var needFd = true;
|
|
22
|
+
if (roundingPriority === 'auto') {
|
|
23
|
+
needSd = hasSd;
|
|
24
|
+
if (hasSd || (!hasFd && notation === 'compact')) {
|
|
25
|
+
needFd = false;
|
|
26
|
+
}
|
|
22
27
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
if (needSd) {
|
|
29
|
+
if (hasSd) {
|
|
30
|
+
mnsd = (0, DefaultNumberOption_1.DefaultNumberOption)(mnsd, 1, 21, 1);
|
|
31
|
+
mxsd = (0, DefaultNumberOption_1.DefaultNumberOption)(mxsd, mnsd, 21, 21);
|
|
32
|
+
internalSlots.minimumSignificantDigits = mnsd;
|
|
33
|
+
internalSlots.maximumSignificantDigits = mxsd;
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
internalSlots.minimumSignificantDigits = 1;
|
|
37
|
+
internalSlots.maximumSignificantDigits = 21;
|
|
38
|
+
}
|
|
30
39
|
}
|
|
31
|
-
|
|
32
|
-
|
|
40
|
+
if (needFd) {
|
|
41
|
+
if (hasFd) {
|
|
42
|
+
// @ts-expect-error
|
|
43
|
+
mnfd = (0, DefaultNumberOption_1.DefaultNumberOption)(mnfd, 0, 20, undefined);
|
|
44
|
+
// @ts-expect-error
|
|
45
|
+
mxfd = (0, DefaultNumberOption_1.DefaultNumberOption)(mxfd, 0, 20, undefined);
|
|
46
|
+
if (mnfd === undefined) {
|
|
47
|
+
mnfd = Math.min(mnfdDefault, mxfd);
|
|
48
|
+
}
|
|
49
|
+
else if (mxfd === undefined) {
|
|
50
|
+
mxfd = Math.max(mxfdDefault, mnfd);
|
|
51
|
+
}
|
|
52
|
+
else if (mnfd > mxfd) {
|
|
53
|
+
throw new RangeError("Invalid range, ".concat(mnfd, " > ").concat(mxfd));
|
|
54
|
+
}
|
|
55
|
+
internalSlots.minimumFractionDigits = mnfd;
|
|
56
|
+
internalSlots.maximumFractionDigits = mxfd;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
internalSlots.minimumFractionDigits = mnfdDefault;
|
|
60
|
+
internalSlots.maximumFractionDigits = mxfdDefault;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (needSd || needFd) {
|
|
64
|
+
if (roundingPriority === 'morePrecision') {
|
|
65
|
+
internalSlots.roundingType = 'morePrecision';
|
|
66
|
+
}
|
|
67
|
+
else if (roundingPriority === 'lessPrecision') {
|
|
68
|
+
internalSlots.roundingType = 'lessPrecision';
|
|
69
|
+
}
|
|
70
|
+
else if (hasSd) {
|
|
71
|
+
internalSlots.roundingType = 'significantDigits';
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
internalSlots.roundingType = 'fractionDigits';
|
|
75
|
+
}
|
|
33
76
|
}
|
|
34
77
|
else {
|
|
35
|
-
internalSlots.roundingType = '
|
|
36
|
-
internalSlots.minimumFractionDigits =
|
|
37
|
-
internalSlots.maximumFractionDigits =
|
|
78
|
+
internalSlots.roundingType = 'morePrecision';
|
|
79
|
+
internalSlots.minimumFractionDigits = 0;
|
|
80
|
+
internalSlots.maximumFractionDigits = 0;
|
|
81
|
+
internalSlots.minimumSignificantDigits = 1;
|
|
82
|
+
internalSlots.maximumSignificantDigits = 2;
|
|
38
83
|
}
|
|
39
84
|
}
|
|
40
85
|
exports.SetNumberFormatDigitOptions = SetNumberFormatDigitOptions;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NumberFormatOptionsStyle, NumberFormatOptionsNotation, NumberFormatOptionsCompactDisplay, NumberFormatOptionsCurrencyDisplay, NumberFormatOptionsCurrencySign, NumberFormatOptionsUnitDisplay, NumberFormatLocaleInternalData, NumberFormatPart } from '../types/number';
|
|
1
|
+
import { NumberFormatOptionsStyle, NumberFormatOptionsNotation, NumberFormatOptionsCompactDisplay, NumberFormatOptionsCurrencyDisplay, NumberFormatOptionsCurrencySign, NumberFormatOptionsUnitDisplay, NumberFormatLocaleInternalData, NumberFormatPart, UseGroupingType } from '../types/number';
|
|
2
2
|
interface NumberResult {
|
|
3
3
|
formattedString: string;
|
|
4
4
|
roundedNumber: number;
|
|
@@ -8,7 +8,7 @@ interface NumberResult {
|
|
|
8
8
|
}
|
|
9
9
|
export default function formatToParts(numberResult: NumberResult, data: NumberFormatLocaleInternalData, pl: Intl.PluralRules, options: {
|
|
10
10
|
numberingSystem: string;
|
|
11
|
-
useGrouping
|
|
11
|
+
useGrouping?: UseGroupingType;
|
|
12
12
|
style: NumberFormatOptionsStyle;
|
|
13
13
|
notation: NumberFormatOptionsNotation;
|
|
14
14
|
compactDisplay?: NumberFormatOptionsCompactDisplay;
|
|
@@ -1 +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,
|
|
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,EAChB,eAAe,EAChB,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,CAAC,EAAE,eAAe,CAAA;IAC7B,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"}
|
|
@@ -119,7 +119,7 @@ function formatToParts(numberResult, data, pl, options) {
|
|
|
119
119
|
// We only need to handle scientific and engineering notation here.
|
|
120
120
|
numberParts.push.apply(numberParts, paritionNumberIntoParts(symbols, numberResult, notation, exponent, numberingSystem,
|
|
121
121
|
// If compact number pattern exists, do not insert group separators.
|
|
122
|
-
!compactNumberPattern && options.useGrouping, decimalNumberPattern));
|
|
122
|
+
!compactNumberPattern && Boolean(options.useGrouping), decimalNumberPattern));
|
|
123
123
|
break;
|
|
124
124
|
}
|
|
125
125
|
case '-':
|
package/index.d.ts
CHANGED
|
@@ -4,17 +4,25 @@ export * from './CoerceOptionsToObject';
|
|
|
4
4
|
export * from './GetNumberOption';
|
|
5
5
|
export * from './GetOption';
|
|
6
6
|
export * from './GetOptionsObject';
|
|
7
|
+
export * from './GetStringOrBooleanOption';
|
|
7
8
|
export * from './IsSanctionedSimpleUnitIdentifier';
|
|
8
9
|
export * from './IsValidTimeZoneName';
|
|
9
10
|
export * from './IsWellFormedCurrencyCode';
|
|
10
11
|
export * from './IsWellFormedUnitIdentifier';
|
|
12
|
+
export * from './NumberFormat/ApplyUnsignedRoundingMode';
|
|
13
|
+
export * from './NumberFormat/CollapseNumberRange';
|
|
11
14
|
export * from './NumberFormat/ComputeExponent';
|
|
12
15
|
export * from './NumberFormat/ComputeExponentForMagnitude';
|
|
13
16
|
export * from './NumberFormat/CurrencyDigits';
|
|
17
|
+
export * from './NumberFormat/FormatApproximately';
|
|
18
|
+
export * from './NumberFormat/FormatNumericRange';
|
|
19
|
+
export * from './NumberFormat/FormatNumericRangeToParts';
|
|
14
20
|
export * from './NumberFormat/FormatNumericToParts';
|
|
15
21
|
export * from './NumberFormat/FormatNumericToString';
|
|
22
|
+
export * from './NumberFormat/GetUnsignedRoundingMode';
|
|
16
23
|
export * from './NumberFormat/InitializeNumberFormat';
|
|
17
24
|
export * from './NumberFormat/PartitionNumberPattern';
|
|
25
|
+
export * from './NumberFormat/PartitionNumberRangePattern';
|
|
18
26
|
export * from './NumberFormat/SetNumberFormatDigitOptions';
|
|
19
27
|
export * from './NumberFormat/SetNumberFormatUnitOptions';
|
|
20
28
|
export * from './NumberFormat/ToRawFixed';
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA;AACxC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,yBAAyB,CAAA;AACvC,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA;AAC3B,cAAc,oBAAoB,CAAA;AAClC,cAAc,oCAAoC,CAAA;AAClD,cAAc,uBAAuB,CAAA;AACrC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,4CAA4C,CAAA;AAC1D,cAAc,+BAA+B,CAAA;AAC7C,cAAc,qCAAqC,CAAA;AACnD,cAAc,sCAAsC,CAAA;AACpD,cAAc,uCAAuC,CAAA;AACrD,cAAc,uCAAuC,CAAA;AACrD,cAAc,4CAA4C,CAAA;AAC1D,cAAc,2CAA2C,CAAA;AACzD,cAAc,2BAA2B,CAAA;AACzC,cAAc,+BAA+B,CAAA;AAC7C,OAAO,EAAC,OAAO,IAAI,cAAc,EAAC,MAAM,gCAAgC,CAAA;AACxE,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,aAAa,EACb,eAAe,EACf,qBAAqB,EACrB,YAAY,EACZ,cAAc,GACf,MAAM,SAAS,CAAA;AAChB,YAAY,EAAC,WAAW,EAAC,MAAM,SAAS,CAAA;AAExC,OAAO,EAAC,wBAAwB,EAAC,MAAM,QAAQ,CAAA;AAC/C,cAAc,uBAAuB,CAAA;AACrC,cAAc,mBAAmB,CAAA;AACjC,cAAc,cAAc,CAAA;AAC5B,cAAc,sBAAsB,CAAA;AACpC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,sBAAsB,CAAA;AACpC,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAA;AACjC,YAAY,EAAC,UAAU,EAAC,MAAM,cAAc,CAAA;AAC5C,cAAc,OAAO,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA;AACxC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,yBAAyB,CAAA;AACvC,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA;AAC3B,cAAc,oBAAoB,CAAA;AAClC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,oCAAoC,CAAA;AAClD,cAAc,uBAAuB,CAAA;AACrC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,0CAA0C,CAAA;AACxD,cAAc,oCAAoC,CAAA;AAClD,cAAc,gCAAgC,CAAA;AAC9C,cAAc,4CAA4C,CAAA;AAC1D,cAAc,+BAA+B,CAAA;AAC7C,cAAc,oCAAoC,CAAA;AAClD,cAAc,mCAAmC,CAAA;AACjD,cAAc,0CAA0C,CAAA;AACxD,cAAc,qCAAqC,CAAA;AACnD,cAAc,sCAAsC,CAAA;AACpD,cAAc,wCAAwC,CAAA;AACtD,cAAc,uCAAuC,CAAA;AACrD,cAAc,uCAAuC,CAAA;AACrD,cAAc,4CAA4C,CAAA;AAC1D,cAAc,4CAA4C,CAAA;AAC1D,cAAc,2CAA2C,CAAA;AACzD,cAAc,2BAA2B,CAAA;AACzC,cAAc,+BAA+B,CAAA;AAC7C,OAAO,EAAC,OAAO,IAAI,cAAc,EAAC,MAAM,gCAAgC,CAAA;AACxE,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,aAAa,EACb,eAAe,EACf,qBAAqB,EACrB,YAAY,EACZ,cAAc,GACf,MAAM,SAAS,CAAA;AAChB,YAAY,EAAC,WAAW,EAAC,MAAM,SAAS,CAAA;AAExC,OAAO,EAAC,wBAAwB,EAAC,MAAM,QAAQ,CAAA;AAC/C,cAAc,uBAAuB,CAAA;AACrC,cAAc,mBAAmB,CAAA;AACjC,cAAc,cAAc,CAAA;AAC5B,cAAc,sBAAsB,CAAA;AACpC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,sBAAsB,CAAA;AACpC,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAA;AACjC,YAAY,EAAC,UAAU,EAAC,MAAM,cAAc,CAAA;AAC5C,cAAc,OAAO,CAAA"}
|
package/index.js
CHANGED
|
@@ -8,17 +8,25 @@ tslib_1.__exportStar(require("./CoerceOptionsToObject"), exports);
|
|
|
8
8
|
tslib_1.__exportStar(require("./GetNumberOption"), exports);
|
|
9
9
|
tslib_1.__exportStar(require("./GetOption"), exports);
|
|
10
10
|
tslib_1.__exportStar(require("./GetOptionsObject"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./GetStringOrBooleanOption"), exports);
|
|
11
12
|
tslib_1.__exportStar(require("./IsSanctionedSimpleUnitIdentifier"), exports);
|
|
12
13
|
tslib_1.__exportStar(require("./IsValidTimeZoneName"), exports);
|
|
13
14
|
tslib_1.__exportStar(require("./IsWellFormedCurrencyCode"), exports);
|
|
14
15
|
tslib_1.__exportStar(require("./IsWellFormedUnitIdentifier"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./NumberFormat/ApplyUnsignedRoundingMode"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./NumberFormat/CollapseNumberRange"), exports);
|
|
15
18
|
tslib_1.__exportStar(require("./NumberFormat/ComputeExponent"), exports);
|
|
16
19
|
tslib_1.__exportStar(require("./NumberFormat/ComputeExponentForMagnitude"), exports);
|
|
17
20
|
tslib_1.__exportStar(require("./NumberFormat/CurrencyDigits"), exports);
|
|
21
|
+
tslib_1.__exportStar(require("./NumberFormat/FormatApproximately"), exports);
|
|
22
|
+
tslib_1.__exportStar(require("./NumberFormat/FormatNumericRange"), exports);
|
|
23
|
+
tslib_1.__exportStar(require("./NumberFormat/FormatNumericRangeToParts"), exports);
|
|
18
24
|
tslib_1.__exportStar(require("./NumberFormat/FormatNumericToParts"), exports);
|
|
19
25
|
tslib_1.__exportStar(require("./NumberFormat/FormatNumericToString"), exports);
|
|
26
|
+
tslib_1.__exportStar(require("./NumberFormat/GetUnsignedRoundingMode"), exports);
|
|
20
27
|
tslib_1.__exportStar(require("./NumberFormat/InitializeNumberFormat"), exports);
|
|
21
28
|
tslib_1.__exportStar(require("./NumberFormat/PartitionNumberPattern"), exports);
|
|
29
|
+
tslib_1.__exportStar(require("./NumberFormat/PartitionNumberRangePattern"), exports);
|
|
22
30
|
tslib_1.__exportStar(require("./NumberFormat/SetNumberFormatDigitOptions"), exports);
|
|
23
31
|
tslib_1.__exportStar(require("./NumberFormat/SetNumberFormatUnitOptions"), exports);
|
|
24
32
|
tslib_1.__exportStar(require("./NumberFormat/ToRawFixed"), exports);
|