@formatjs/ecma402-abstract 1.18.3 → 2.0.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/NumberFormat/format_to_parts.js +4 -1
- package/index.d.ts +6 -6
- package/index.js +8 -7
- package/lib/NumberFormat/format_to_parts.js +4 -1
- package/lib/index.d.ts +6 -6
- package/lib/index.js +5 -5
- package/lib/types/number.d.ts +1 -0
- package/lib/utils.d.ts +7 -0
- package/lib/utils.js +14 -0
- package/package.json +1 -1
- package/types/number.d.ts +1 -0
- package/utils.d.ts +7 -0
- package/utils.js +16 -1
|
@@ -343,7 +343,10 @@ decimalNumberPattern, style) {
|
|
|
343
343
|
}
|
|
344
344
|
// #endregion
|
|
345
345
|
if (fraction !== undefined) {
|
|
346
|
-
|
|
346
|
+
var decimalSepSymbol = style === 'currency' && symbols.currencyDecimal != null
|
|
347
|
+
? symbols.currencyDecimal
|
|
348
|
+
: symbols.decimal;
|
|
349
|
+
result.push({ type: 'decimal', value: decimalSepSymbol }, { type: 'fraction', value: fraction });
|
|
347
350
|
}
|
|
348
351
|
if ((notation === 'scientific' || notation === 'engineering') &&
|
|
349
352
|
isFinite(x)) {
|
package/index.d.ts
CHANGED
|
@@ -30,15 +30,15 @@ export * from './NumberFormat/ToRawPrecision';
|
|
|
30
30
|
export { default as _formatToParts } from './NumberFormat/format_to_parts';
|
|
31
31
|
export * from './PartitionPattern';
|
|
32
32
|
export * from './SupportedLocales';
|
|
33
|
-
export { getInternalSlot, getMultiInternalSlots, isLiteralPart, setInternalSlot, setMultiInternalSlots,
|
|
33
|
+
export { createDataProperty, defineProperty, getInternalSlot, getMagnitude, getMultiInternalSlots, isLiteralPart, setInternalSlot, setMultiInternalSlots, } from './utils';
|
|
34
34
|
export type { LiteralPart } from './utils';
|
|
35
|
+
export * from './262';
|
|
35
36
|
export { isMissingLocaleDataError } from './data';
|
|
36
|
-
export
|
|
37
|
+
export type { LocaleData } from './types/core';
|
|
37
38
|
export * from './types/date-time';
|
|
39
|
+
export * from './types/displaynames';
|
|
38
40
|
export * from './types/list';
|
|
39
|
-
export * from './types/plural-rules';
|
|
40
41
|
export * from './types/number';
|
|
41
|
-
export * from './types/
|
|
42
|
+
export * from './types/plural-rules';
|
|
43
|
+
export * from './types/relative-time';
|
|
42
44
|
export { invariant } from './utils';
|
|
43
|
-
export type { LocaleData } from './types/core';
|
|
44
|
-
export * from './262';
|
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.invariant = exports.isMissingLocaleDataError = exports.
|
|
3
|
+
exports.invariant = exports.isMissingLocaleDataError = exports.setMultiInternalSlots = exports.setInternalSlot = exports.isLiteralPart = exports.getMultiInternalSlots = exports.getMagnitude = exports.getInternalSlot = exports.defineProperty = exports.createDataProperty = exports._formatToParts = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
tslib_1.__exportStar(require("./CanonicalizeLocaleList"), exports);
|
|
6
6
|
tslib_1.__exportStar(require("./CanonicalizeTimeZoneName"), exports);
|
|
@@ -36,21 +36,22 @@ Object.defineProperty(exports, "_formatToParts", { enumerable: true, get: functi
|
|
|
36
36
|
tslib_1.__exportStar(require("./PartitionPattern"), exports);
|
|
37
37
|
tslib_1.__exportStar(require("./SupportedLocales"), exports);
|
|
38
38
|
var utils_1 = require("./utils");
|
|
39
|
+
Object.defineProperty(exports, "createDataProperty", { enumerable: true, get: function () { return utils_1.createDataProperty; } });
|
|
40
|
+
Object.defineProperty(exports, "defineProperty", { enumerable: true, get: function () { return utils_1.defineProperty; } });
|
|
39
41
|
Object.defineProperty(exports, "getInternalSlot", { enumerable: true, get: function () { return utils_1.getInternalSlot; } });
|
|
42
|
+
Object.defineProperty(exports, "getMagnitude", { enumerable: true, get: function () { return utils_1.getMagnitude; } });
|
|
40
43
|
Object.defineProperty(exports, "getMultiInternalSlots", { enumerable: true, get: function () { return utils_1.getMultiInternalSlots; } });
|
|
41
44
|
Object.defineProperty(exports, "isLiteralPart", { enumerable: true, get: function () { return utils_1.isLiteralPart; } });
|
|
42
45
|
Object.defineProperty(exports, "setInternalSlot", { enumerable: true, get: function () { return utils_1.setInternalSlot; } });
|
|
43
46
|
Object.defineProperty(exports, "setMultiInternalSlots", { enumerable: true, get: function () { return utils_1.setMultiInternalSlots; } });
|
|
44
|
-
|
|
45
|
-
Object.defineProperty(exports, "defineProperty", { enumerable: true, get: function () { return utils_1.defineProperty; } });
|
|
47
|
+
tslib_1.__exportStar(require("./262"), exports);
|
|
46
48
|
var data_1 = require("./data");
|
|
47
49
|
Object.defineProperty(exports, "isMissingLocaleDataError", { enumerable: true, get: function () { return data_1.isMissingLocaleDataError; } });
|
|
48
|
-
tslib_1.__exportStar(require("./types/relative-time"), exports);
|
|
49
50
|
tslib_1.__exportStar(require("./types/date-time"), exports);
|
|
51
|
+
tslib_1.__exportStar(require("./types/displaynames"), exports);
|
|
50
52
|
tslib_1.__exportStar(require("./types/list"), exports);
|
|
51
|
-
tslib_1.__exportStar(require("./types/plural-rules"), exports);
|
|
52
53
|
tslib_1.__exportStar(require("./types/number"), exports);
|
|
53
|
-
tslib_1.__exportStar(require("./types/
|
|
54
|
+
tslib_1.__exportStar(require("./types/plural-rules"), exports);
|
|
55
|
+
tslib_1.__exportStar(require("./types/relative-time"), exports);
|
|
54
56
|
var utils_2 = require("./utils");
|
|
55
57
|
Object.defineProperty(exports, "invariant", { enumerable: true, get: function () { return utils_2.invariant; } });
|
|
56
|
-
tslib_1.__exportStar(require("./262"), exports);
|
|
@@ -340,7 +340,10 @@ decimalNumberPattern, style) {
|
|
|
340
340
|
}
|
|
341
341
|
// #endregion
|
|
342
342
|
if (fraction !== undefined) {
|
|
343
|
-
|
|
343
|
+
var decimalSepSymbol = style === 'currency' && symbols.currencyDecimal != null
|
|
344
|
+
? symbols.currencyDecimal
|
|
345
|
+
: symbols.decimal;
|
|
346
|
+
result.push({ type: 'decimal', value: decimalSepSymbol }, { type: 'fraction', value: fraction });
|
|
344
347
|
}
|
|
345
348
|
if ((notation === 'scientific' || notation === 'engineering') &&
|
|
346
349
|
isFinite(x)) {
|
package/lib/index.d.ts
CHANGED
|
@@ -30,15 +30,15 @@ export * from './NumberFormat/ToRawPrecision';
|
|
|
30
30
|
export { default as _formatToParts } from './NumberFormat/format_to_parts';
|
|
31
31
|
export * from './PartitionPattern';
|
|
32
32
|
export * from './SupportedLocales';
|
|
33
|
-
export { getInternalSlot, getMultiInternalSlots, isLiteralPart, setInternalSlot, setMultiInternalSlots,
|
|
33
|
+
export { createDataProperty, defineProperty, getInternalSlot, getMagnitude, getMultiInternalSlots, isLiteralPart, setInternalSlot, setMultiInternalSlots, } from './utils';
|
|
34
34
|
export type { LiteralPart } from './utils';
|
|
35
|
+
export * from './262';
|
|
35
36
|
export { isMissingLocaleDataError } from './data';
|
|
36
|
-
export
|
|
37
|
+
export type { LocaleData } from './types/core';
|
|
37
38
|
export * from './types/date-time';
|
|
39
|
+
export * from './types/displaynames';
|
|
38
40
|
export * from './types/list';
|
|
39
|
-
export * from './types/plural-rules';
|
|
40
41
|
export * from './types/number';
|
|
41
|
-
export * from './types/
|
|
42
|
+
export * from './types/plural-rules';
|
|
43
|
+
export * from './types/relative-time';
|
|
42
44
|
export { invariant } from './utils';
|
|
43
|
-
export type { LocaleData } from './types/core';
|
|
44
|
-
export * from './262';
|
package/lib/index.js
CHANGED
|
@@ -30,13 +30,13 @@ export * from './NumberFormat/ToRawPrecision';
|
|
|
30
30
|
export { default as _formatToParts } from './NumberFormat/format_to_parts';
|
|
31
31
|
export * from './PartitionPattern';
|
|
32
32
|
export * from './SupportedLocales';
|
|
33
|
-
export { getInternalSlot, getMultiInternalSlots, isLiteralPart, setInternalSlot, setMultiInternalSlots,
|
|
33
|
+
export { createDataProperty, defineProperty, getInternalSlot, getMagnitude, getMultiInternalSlots, isLiteralPart, setInternalSlot, setMultiInternalSlots, } from './utils';
|
|
34
|
+
export * from './262';
|
|
34
35
|
export { isMissingLocaleDataError } from './data';
|
|
35
|
-
export * from './types/relative-time';
|
|
36
36
|
export * from './types/date-time';
|
|
37
|
+
export * from './types/displaynames';
|
|
37
38
|
export * from './types/list';
|
|
38
|
-
export * from './types/plural-rules';
|
|
39
39
|
export * from './types/number';
|
|
40
|
-
export * from './types/
|
|
40
|
+
export * from './types/plural-rules';
|
|
41
|
+
export * from './types/relative-time';
|
|
41
42
|
export { invariant } from './utils';
|
|
42
|
-
export * from './262';
|
package/lib/types/number.d.ts
CHANGED
package/lib/utils.d.ts
CHANGED
|
@@ -19,5 +19,12 @@ export declare function isLiteralPart(patternPart: LiteralPart | {
|
|
|
19
19
|
export declare function defineProperty<T extends object>(target: T, name: string | symbol, { value }: {
|
|
20
20
|
value: any;
|
|
21
21
|
} & ThisType<any>): void;
|
|
22
|
+
/**
|
|
23
|
+
* 7.3.5 CreateDataProperty
|
|
24
|
+
* @param target
|
|
25
|
+
* @param name
|
|
26
|
+
* @param value
|
|
27
|
+
*/
|
|
28
|
+
export declare function createDataProperty<T extends object>(target: T, name: string | symbol, value: any): void;
|
|
22
29
|
export declare const UNICODE_EXTENSION_SEQUENCE_REGEX: RegExp;
|
|
23
30
|
export declare function invariant(condition: boolean, message: string, Err?: any): asserts condition;
|
package/lib/utils.js
CHANGED
|
@@ -69,6 +69,20 @@ export function defineProperty(target, name, _a) {
|
|
|
69
69
|
value: value,
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* 7.3.5 CreateDataProperty
|
|
74
|
+
* @param target
|
|
75
|
+
* @param name
|
|
76
|
+
* @param value
|
|
77
|
+
*/
|
|
78
|
+
export function createDataProperty(target, name, value) {
|
|
79
|
+
Object.defineProperty(target, name, {
|
|
80
|
+
configurable: true,
|
|
81
|
+
enumerable: true,
|
|
82
|
+
writable: true,
|
|
83
|
+
value: value,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
72
86
|
export var UNICODE_EXTENSION_SEQUENCE_REGEX = /-u(?:-[0-9a-z]{2,8})+/gi;
|
|
73
87
|
export function invariant(condition, message, Err) {
|
|
74
88
|
if (Err === void 0) { Err = Error; }
|
package/package.json
CHANGED
package/types/number.d.ts
CHANGED
package/utils.d.ts
CHANGED
|
@@ -19,5 +19,12 @@ export declare function isLiteralPart(patternPart: LiteralPart | {
|
|
|
19
19
|
export declare function defineProperty<T extends object>(target: T, name: string | symbol, { value }: {
|
|
20
20
|
value: any;
|
|
21
21
|
} & ThisType<any>): void;
|
|
22
|
+
/**
|
|
23
|
+
* 7.3.5 CreateDataProperty
|
|
24
|
+
* @param target
|
|
25
|
+
* @param name
|
|
26
|
+
* @param value
|
|
27
|
+
*/
|
|
28
|
+
export declare function createDataProperty<T extends object>(target: T, name: string | symbol, value: any): void;
|
|
22
29
|
export declare const UNICODE_EXTENSION_SEQUENCE_REGEX: RegExp;
|
|
23
30
|
export declare function invariant(condition: boolean, message: string, Err?: any): asserts condition;
|
package/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.invariant = exports.UNICODE_EXTENSION_SEQUENCE_REGEX = exports.defineProperty = exports.isLiteralPart = exports.getMultiInternalSlots = exports.getInternalSlot = exports.setMultiInternalSlots = exports.setInternalSlot = exports.repeat = exports.getMagnitude = void 0;
|
|
3
|
+
exports.invariant = exports.UNICODE_EXTENSION_SEQUENCE_REGEX = exports.createDataProperty = exports.defineProperty = exports.isLiteralPart = exports.getMultiInternalSlots = exports.getInternalSlot = exports.setMultiInternalSlots = exports.setInternalSlot = exports.repeat = exports.getMagnitude = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Cannot do Math.log(x) / Math.log(10) bc if IEEE floating point issue
|
|
6
6
|
* @param x number
|
|
@@ -80,6 +80,21 @@ function defineProperty(target, name, _a) {
|
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
82
|
exports.defineProperty = defineProperty;
|
|
83
|
+
/**
|
|
84
|
+
* 7.3.5 CreateDataProperty
|
|
85
|
+
* @param target
|
|
86
|
+
* @param name
|
|
87
|
+
* @param value
|
|
88
|
+
*/
|
|
89
|
+
function createDataProperty(target, name, value) {
|
|
90
|
+
Object.defineProperty(target, name, {
|
|
91
|
+
configurable: true,
|
|
92
|
+
enumerable: true,
|
|
93
|
+
writable: true,
|
|
94
|
+
value: value,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
exports.createDataProperty = createDataProperty;
|
|
83
98
|
exports.UNICODE_EXTENSION_SEQUENCE_REGEX = /-u(?:-[0-9a-z]{2,8})+/gi;
|
|
84
99
|
function invariant(condition, message, Err) {
|
|
85
100
|
if (Err === void 0) { Err = Error; }
|