@formatjs/ecma402-abstract 3.0.8 → 3.1.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/262.js +6 -1
- package/IsSanctionedSimpleUnitIdentifier.d.ts +0 -2
- package/NumberFormat/ApplyUnsignedRoundingMode.js +4 -1
- package/NumberFormat/format_to_parts.d.ts +0 -5
- package/ToIntlMathematicalValue.d.ts +4 -0
- package/ToIntlMathematicalValue.js +11 -4
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/package.json +5 -5
- package/regex.generated.d.ts +0 -1
- package/regex.generated.js +1 -1
- package/types/number.d.ts +0 -14
- package/types/plural-rules.d.ts +9 -1
- package/utils.d.ts +0 -11
- package/utils.js +0 -1
package/262.js
CHANGED
|
@@ -19,7 +19,12 @@ export function ToNumber(arg) {
|
|
|
19
19
|
if (typeof arg === "number") {
|
|
20
20
|
return new Decimal(arg);
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
// Support bigint values by converting to string first
|
|
23
|
+
// https://tc39.es/ecma402/#sec-intl.pluralrules.prototype.select
|
|
24
|
+
if (typeof arg === "bigint") {
|
|
25
|
+
return new Decimal(arg.toString());
|
|
26
|
+
}
|
|
27
|
+
invariant(typeof arg !== "symbol", "Symbol is not supported", TypeError);
|
|
23
28
|
if (arg === undefined) {
|
|
24
29
|
return new Decimal(NaN);
|
|
25
30
|
}
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
* https://tc39.es/ecma402/#table-sanctioned-simple-unit-identifiers
|
|
3
3
|
*/
|
|
4
4
|
export declare const SANCTIONED_UNITS: readonly ["angle-degree", "area-acre", "area-hectare", "concentr-percent", "digital-bit", "digital-byte", "digital-gigabit", "digital-gigabyte", "digital-kilobit", "digital-kilobyte", "digital-megabit", "digital-megabyte", "digital-petabyte", "digital-terabit", "digital-terabyte", "duration-day", "duration-hour", "duration-millisecond", "duration-minute", "duration-month", "duration-second", "duration-week", "duration-year", "length-centimeter", "length-foot", "length-inch", "length-kilometer", "length-meter", "length-mile-scandinavian", "length-mile", "length-millimeter", "length-yard", "mass-gram", "mass-kilogram", "mass-ounce", "mass-pound", "mass-stone", "temperature-celsius", "temperature-fahrenheit", "volume-fluid-ounce", "volume-gallon", "volume-liter", "volume-milliliter"];
|
|
5
|
-
// In CLDR, the unit name always follows the form `namespace-unit` pattern.
|
|
6
|
-
// For example: `digital-bit` instead of `bit`. This function removes the namespace prefix.
|
|
7
5
|
export declare function removeUnitNamespace(unit: string): string;
|
|
8
6
|
/**
|
|
9
7
|
* https://tc39.es/ecma402/#table-sanctioned-simple-unit-identifiers
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import "../types/number.js";
|
|
2
2
|
import { invariant } from "../utils.js";
|
|
3
3
|
export function ApplyUnsignedRoundingMode(x, r1, r2, unsignedRoundingMode) {
|
|
4
|
-
if (
|
|
4
|
+
// If x equals r1 or if r1 equals r2 (already at rounding boundary), return r1
|
|
5
|
+
if (x.eq(r1) || r1.eq(r2)) return r1;
|
|
6
|
+
// If x equals r2, return r2
|
|
7
|
+
if (x.eq(r2)) return r2;
|
|
5
8
|
invariant(r1.lessThan(x) && x.lessThan(r2), `x should be between r1 and r2 but x=${x}, r1=${r1}, r2=${r2}`);
|
|
6
9
|
if (unsignedRoundingMode === "zero") {
|
|
7
10
|
return r1;
|
|
@@ -4,7 +4,6 @@ interface NumberResult {
|
|
|
4
4
|
formattedString: string;
|
|
5
5
|
roundedNumber: Decimal;
|
|
6
6
|
sign: -1 | 0 | 1;
|
|
7
|
-
// Example: 100K has exponent 3 and magnitude 5.
|
|
8
7
|
exponent: number;
|
|
9
8
|
magnitude: number;
|
|
10
9
|
}
|
|
@@ -12,15 +11,11 @@ export default function formatToParts(numberResult: NumberResult, data: NumberFo
|
|
|
12
11
|
numberingSystem: string;
|
|
13
12
|
useGrouping?: UseGroupingType;
|
|
14
13
|
style: NumberFormatOptionsStyle;
|
|
15
|
-
// Notation
|
|
16
14
|
notation: NumberFormatOptionsNotation;
|
|
17
|
-
// Compact notation
|
|
18
15
|
compactDisplay?: NumberFormatOptionsCompactDisplay;
|
|
19
|
-
// Currency
|
|
20
16
|
currency?: string;
|
|
21
17
|
currencyDisplay?: NumberFormatOptionsCurrencyDisplay;
|
|
22
18
|
currencySign?: NumberFormatOptionsCurrencySign;
|
|
23
|
-
// Unit
|
|
24
19
|
unit?: string;
|
|
25
20
|
unitDisplay?: NumberFormatOptionsUnitDisplay;
|
|
26
21
|
roundingIncrement: number;
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { Decimal } from "decimal.js";
|
|
2
2
|
import { ToPrimitive } from "./262.js";
|
|
3
|
+
/**
|
|
4
|
+
* https://tc39.es/ecma402/#sec-tointlmathematicalvalue
|
|
5
|
+
* Converts input to a mathematical value, supporting BigInt
|
|
6
|
+
*/
|
|
3
7
|
export function ToIntlMathematicalValue(input) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
8
|
+
// Handle BigInt directly before ToPrimitive, since ToPrimitive doesn't
|
|
9
|
+
// handle bigint in its type signature (though the spec says it should return it as-is)
|
|
10
|
+
if (typeof input === "bigint") {
|
|
11
|
+
return new Decimal(input.toString());
|
|
7
12
|
}
|
|
8
|
-
|
|
13
|
+
let primValue = ToPrimitive(input, "number");
|
|
14
|
+
// Handle other primitive types
|
|
9
15
|
if (primValue === undefined) {
|
|
10
16
|
return new Decimal(NaN);
|
|
11
17
|
}
|
|
@@ -18,6 +24,7 @@ export function ToIntlMathematicalValue(input) {
|
|
|
18
24
|
if (primValue === null) {
|
|
19
25
|
return new Decimal(0);
|
|
20
26
|
}
|
|
27
|
+
// Try to convert to Decimal (handles numbers and strings)
|
|
21
28
|
try {
|
|
22
29
|
return new Decimal(primValue);
|
|
23
30
|
} catch {
|
package/index.d.ts
CHANGED
|
@@ -42,6 +42,6 @@ export * from "./types/list.js";
|
|
|
42
42
|
export * from "./types/number.js";
|
|
43
43
|
export * from "./types/plural-rules.js";
|
|
44
44
|
export * from "./types/relative-time.js";
|
|
45
|
-
export {
|
|
45
|
+
export { createMemoizedListFormat, createMemoizedLocale, createMemoizedNumberFormat, createMemoizedPluralRules, invariant } from "./utils.js";
|
|
46
46
|
export { ZERO } from "./constants.js";
|
|
47
47
|
export { ToIntlMathematicalValue } from "./ToIntlMathematicalValue.js";
|
package/index.js
CHANGED
|
@@ -40,6 +40,6 @@ export * from "./types/list.js";
|
|
|
40
40
|
export * from "./types/number.js";
|
|
41
41
|
export * from "./types/plural-rules.js";
|
|
42
42
|
export * from "./types/relative-time.js";
|
|
43
|
-
export {
|
|
43
|
+
export { createMemoizedListFormat, createMemoizedLocale, createMemoizedNumberFormat, createMemoizedPluralRules, invariant } from "./utils.js";
|
|
44
44
|
export { ZERO } from "./constants.js";
|
|
45
45
|
export { ToIntlMathematicalValue } from "./ToIntlMathematicalValue.js";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formatjs/ecma402-abstract",
|
|
3
3
|
"description": "A collection of implementation for ECMAScript abstract operations",
|
|
4
|
-
"version": "3.0
|
|
4
|
+
"version": "3.1.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Long Ho <holevietlong@gmail.com",
|
|
7
7
|
"type": "module",
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
".": "./index.js"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"decimal.js": "^10.
|
|
15
|
-
"tslib": "^2.8.
|
|
16
|
-
"@formatjs/fast-memoize": "3.0
|
|
17
|
-
"@formatjs/intl-localematcher": "0.
|
|
14
|
+
"decimal.js": "^10.6.0",
|
|
15
|
+
"tslib": "^2.8.1",
|
|
16
|
+
"@formatjs/fast-memoize": "3.1.0",
|
|
17
|
+
"@formatjs/intl-localematcher": "0.8.0"
|
|
18
18
|
},
|
|
19
19
|
"bugs": "https://github.com/formatjs/formatjs/issues",
|
|
20
20
|
"gitHead": "a7842673d8ad205171ad7c8cb8bb2f318b427c0c",
|
package/regex.generated.d.ts
CHANGED
package/regex.generated.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @generated from regex-gen.ts
|
|
2
|
-
export const S_UNICODE_REGEX = /[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\
|
|
2
|
+
export const S_UNICODE_REGEX = /[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C1\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2429\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E5\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBD2\uFD40-\uFD4F\uFD90\uFD91\uFDC8-\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD803[\uDD8E\uDD8F\uDED1-\uDED8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDC00-\uDCEF\uDCFA-\uDCFC\uDD00-\uDEB3\uDEBA-\uDED0\uDEE0-\uDEF0\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED8\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0-\uDCBB\uDCC0\uDCC1\uDCD0-\uDCD8\uDD00-\uDE57\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF-\uDEF8\uDF00-\uDF92\uDF94-\uDFEF\uDFFA]/;
|
package/types/number.d.ts
CHANGED
|
@@ -23,7 +23,6 @@ export interface NumberFormatDigitInternalSlots {
|
|
|
23
23
|
minimumSignificantDigits: number;
|
|
24
24
|
maximumSignificantDigits: number;
|
|
25
25
|
roundingType: NumberFormatRoundingType;
|
|
26
|
-
// These two properties are only used when `roundingType` is "fractionDigits".
|
|
27
26
|
minimumFractionDigits: number;
|
|
28
27
|
maximumFractionDigits: number;
|
|
29
28
|
notation: NumberFormatNotation;
|
|
@@ -32,13 +31,11 @@ export interface NumberFormatDigitInternalSlots {
|
|
|
32
31
|
trailingZeroDisplay: TrailingZeroDisplay;
|
|
33
32
|
roundingPriority: RoundingPriorityType;
|
|
34
33
|
}
|
|
35
|
-
// All fields are optional due to de-duping
|
|
36
34
|
export type RawNumberLocaleData = LocaleData<NumberFormatLocaleInternalData>;
|
|
37
35
|
export interface NumberFormatLocaleInternalData {
|
|
38
36
|
units: UnitDataTable;
|
|
39
37
|
currencies: Record<string, CurrencyData>;
|
|
40
38
|
numbers: RawNumberData;
|
|
41
|
-
// Bc of relevantExtensionKeys in the spec
|
|
42
39
|
nu: string[];
|
|
43
40
|
}
|
|
44
41
|
export interface UnitDataTable {
|
|
@@ -46,15 +43,11 @@ export interface UnitDataTable {
|
|
|
46
43
|
compound: Record<string, CompoundUnitData>;
|
|
47
44
|
}
|
|
48
45
|
export interface UnitData {
|
|
49
|
-
// A pattern where {0} is number placeholder. Example: "摂氏 {0} 度".
|
|
50
46
|
long: LDMLPluralRuleMap<string>;
|
|
51
47
|
short: LDMLPluralRuleMap<string>;
|
|
52
48
|
narrow: LDMLPluralRuleMap<string>;
|
|
53
|
-
// perUnitPattern. See http://unicode.org/reports/tr35/tr35-general.html#perUnitPatterns
|
|
54
49
|
perUnit: Record<"narrow" | "short" | "long", string | undefined>;
|
|
55
50
|
}
|
|
56
|
-
// The values are patterns on how to compose simple units.
|
|
57
|
-
// For example, "{0} per {1}".
|
|
58
51
|
export interface CompoundUnitData {
|
|
59
52
|
long: string;
|
|
60
53
|
short: string;
|
|
@@ -83,8 +76,6 @@ export interface RawCurrencyData {
|
|
|
83
76
|
standard: string;
|
|
84
77
|
accounting: string;
|
|
85
78
|
short?: Record<DecimalFormatNum, LDMLPluralRuleMap<string>>;
|
|
86
|
-
// IMPORTANT: We're making the assumption here that currency unitPattern
|
|
87
|
-
// are the same for all LDMLPluralRule
|
|
88
79
|
unitPattern: string;
|
|
89
80
|
}
|
|
90
81
|
export interface SymbolsData {
|
|
@@ -107,13 +98,9 @@ export interface SymbolsData {
|
|
|
107
98
|
}
|
|
108
99
|
export interface RawNumberData {
|
|
109
100
|
nu: string[];
|
|
110
|
-
// numberingSystem -> pattern
|
|
111
101
|
symbols: Record<NumberingSystem, SymbolsData>;
|
|
112
|
-
// numberingSystem -> pattern
|
|
113
102
|
decimal: Record<NumberingSystem, {
|
|
114
|
-
// The standard number pattern of the decimal.
|
|
115
103
|
standard: string;
|
|
116
|
-
// These two are compact notation mappings.
|
|
117
104
|
long: Record<DecimalFormatNum, LDMLPluralRuleMap<string>>;
|
|
118
105
|
short: Record<DecimalFormatNum, LDMLPluralRuleMap<string>>;
|
|
119
106
|
}>;
|
|
@@ -154,7 +141,6 @@ export interface NumberFormatInternal extends NumberFormatDigitInternalSlots {
|
|
|
154
141
|
pl: Intl.PluralRules;
|
|
155
142
|
boundFormat?: Intl.NumberFormat["format"];
|
|
156
143
|
numberingSystem: string;
|
|
157
|
-
// Locale-dependent formatter data
|
|
158
144
|
dataLocaleData: NumberFormatLocaleInternalData;
|
|
159
145
|
roundingMode: RoundingModeType;
|
|
160
146
|
}
|
package/types/plural-rules.d.ts
CHANGED
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
import { type LocaleData } from "./core.js";
|
|
2
2
|
import { type NumberFormatDigitInternalSlots } from "./number.js";
|
|
3
3
|
export type LDMLPluralRule = "zero" | "one" | "two" | "few" | "many" | "other";
|
|
4
|
+
export interface PluralRangesData {
|
|
5
|
+
cardinal?: Record<string, LDMLPluralRule>;
|
|
6
|
+
ordinal?: Record<string, LDMLPluralRule>;
|
|
7
|
+
}
|
|
4
8
|
export interface PluralRulesData {
|
|
5
9
|
categories: {
|
|
6
10
|
cardinal: string[];
|
|
7
11
|
ordinal: string[];
|
|
8
12
|
};
|
|
9
|
-
fn: (val: number | string, ord?: boolean) => LDMLPluralRule;
|
|
13
|
+
fn: (val: number | string, ord?: boolean, exponent?: number) => LDMLPluralRule;
|
|
14
|
+
pluralRanges?: PluralRangesData;
|
|
10
15
|
}
|
|
11
16
|
export type PluralRulesLocaleData = LocaleData<PluralRulesData>;
|
|
12
17
|
export interface PluralRulesInternal extends NumberFormatDigitInternalSlots {
|
|
13
18
|
initializedPluralRules: boolean;
|
|
14
19
|
locale: string;
|
|
15
20
|
type: "cardinal" | "ordinal";
|
|
21
|
+
notation: "standard" | "compact";
|
|
22
|
+
compactDisplay?: "short" | "long";
|
|
23
|
+
dataLocaleData?: any;
|
|
16
24
|
}
|
package/utils.d.ts
CHANGED
|
@@ -27,16 +27,6 @@ export declare function isLiteralPart(patternPart: LiteralPart | {
|
|
|
27
27
|
type: string;
|
|
28
28
|
value?: string;
|
|
29
29
|
}): patternPart is LiteralPart;
|
|
30
|
-
/*
|
|
31
|
-
17 ECMAScript Standard Built-in Objects:
|
|
32
|
-
Every built-in Function object, including constructors, that is not
|
|
33
|
-
identified as an anonymous function has a name property whose value
|
|
34
|
-
is a String.
|
|
35
|
-
|
|
36
|
-
Unless otherwise specified, the name property of a built-in Function
|
|
37
|
-
object, if it exists, has the attributes { [[Writable]]: false,
|
|
38
|
-
[[Enumerable]]: false, [[Configurable]]: true }.
|
|
39
|
-
*/
|
|
40
30
|
export declare function defineProperty<T extends object>(target: T, name: string | symbol, { value }: {
|
|
41
31
|
value: any;
|
|
42
32
|
} & ThisType<any>): void;
|
|
@@ -50,7 +40,6 @@ export declare function createDataProperty<T extends object>(target: T, name: st
|
|
|
50
40
|
export declare const UNICODE_EXTENSION_SEQUENCE_REGEX: RegExp;
|
|
51
41
|
export declare function invariant(condition: boolean, message: string, Err?: any): asserts condition;
|
|
52
42
|
export declare const createMemoizedNumberFormat: (...args: ConstructorParameters<typeof Intl.NumberFormat>) => Intl.NumberFormat;
|
|
53
|
-
export declare const createMemoizedDateTimeFormat: (...args: ConstructorParameters<typeof Intl.DateTimeFormat>) => Intl.DateTimeFormat;
|
|
54
43
|
export declare const createMemoizedPluralRules: (...args: ConstructorParameters<typeof Intl.PluralRules>) => Intl.PluralRules;
|
|
55
44
|
export declare const createMemoizedLocale: (...args: ConstructorParameters<typeof Intl.Locale>) => Intl.Locale;
|
|
56
45
|
export declare const createMemoizedListFormat: (...args: ConstructorParameters<typeof Intl.ListFormat>) => Intl.ListFormat;
|
package/utils.js
CHANGED
|
@@ -76,7 +76,6 @@ export function invariant(condition, message, Err = Error) {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
export const createMemoizedNumberFormat = memoize((...args) => new Intl.NumberFormat(...args), { strategy: strategies.variadic });
|
|
79
|
-
export const createMemoizedDateTimeFormat = memoize((...args) => new Intl.DateTimeFormat(...args), { strategy: strategies.variadic });
|
|
80
79
|
export const createMemoizedPluralRules = memoize((...args) => new Intl.PluralRules(...args), { strategy: strategies.variadic });
|
|
81
80
|
export const createMemoizedLocale = memoize((...args) => new Intl.Locale(...args), { strategy: strategies.variadic });
|
|
82
81
|
export const createMemoizedListFormat = memoize((...args) => new Intl.ListFormat(...args), { strategy: strategies.variadic });
|