@formatjs/ecma402-abstract 2.3.6 → 3.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.
Files changed (176) hide show
  1. package/262.d.ts +1 -1
  2. package/262.js +42 -68
  3. package/CanonicalizeLocaleList.js +1 -4
  4. package/CanonicalizeTimeZoneName.js +1 -4
  5. package/CoerceOptionsToObject.js +3 -6
  6. package/DefaultNumberOption.js +1 -4
  7. package/GetNumberOption.js +3 -6
  8. package/GetOption.js +3 -6
  9. package/GetOptionsObject.js +1 -4
  10. package/GetStringOrBooleanOption.js +3 -6
  11. package/IsSanctionedSimpleUnitIdentifier.js +5 -10
  12. package/IsValidTimeZoneName.js +1 -4
  13. package/IsWellFormedCurrencyCode.js +1 -4
  14. package/IsWellFormedUnitIdentifier.js +5 -8
  15. package/NumberFormat/ApplyUnsignedRoundingMode.d.ts +2 -2
  16. package/NumberFormat/ApplyUnsignedRoundingMode.js +5 -8
  17. package/NumberFormat/CollapseNumberRange.d.ts +1 -1
  18. package/NumberFormat/CollapseNumberRange.js +1 -4
  19. package/NumberFormat/ComputeExponent.d.ts +2 -2
  20. package/NumberFormat/ComputeExponent.js +8 -12
  21. package/NumberFormat/ComputeExponentForMagnitude.d.ts +2 -2
  22. package/NumberFormat/ComputeExponentForMagnitude.js +6 -10
  23. package/NumberFormat/CurrencyDigits.js +3 -6
  24. package/NumberFormat/FormatApproximately.d.ts +1 -1
  25. package/NumberFormat/FormatApproximately.js +1 -4
  26. package/NumberFormat/FormatNumeric.d.ts +2 -2
  27. package/NumberFormat/FormatNumeric.js +3 -6
  28. package/NumberFormat/FormatNumericRange.d.ts +2 -2
  29. package/NumberFormat/FormatNumericRange.js +3 -6
  30. package/NumberFormat/FormatNumericRangeToParts.d.ts +2 -2
  31. package/NumberFormat/FormatNumericRangeToParts.js +3 -6
  32. package/NumberFormat/FormatNumericToParts.d.ts +2 -2
  33. package/NumberFormat/FormatNumericToParts.js +5 -8
  34. package/NumberFormat/FormatNumericToString.d.ts +2 -2
  35. package/NumberFormat/FormatNumericToString.js +16 -19
  36. package/NumberFormat/GetUnsignedRoundingMode.d.ts +1 -1
  37. package/NumberFormat/GetUnsignedRoundingMode.js +1 -4
  38. package/NumberFormat/InitializeNumberFormat.d.ts +1 -1
  39. package/NumberFormat/InitializeNumberFormat.js +23 -26
  40. package/NumberFormat/PartitionNumberPattern.d.ts +2 -2
  41. package/NumberFormat/PartitionNumberPattern.js +12 -16
  42. package/NumberFormat/PartitionNumberRangePattern.d.ts +2 -2
  43. package/NumberFormat/PartitionNumberRangePattern.js +12 -15
  44. package/NumberFormat/SetNumberFormatDigitOptions.d.ts +1 -1
  45. package/NumberFormat/SetNumberFormatDigitOptions.js +18 -21
  46. package/NumberFormat/SetNumberFormatUnitOptions.d.ts +1 -1
  47. package/NumberFormat/SetNumberFormatUnitOptions.js +15 -18
  48. package/NumberFormat/ToRawFixed.d.ts +2 -2
  49. package/NumberFormat/ToRawFixed.js +10 -14
  50. package/NumberFormat/ToRawPrecision.d.ts +2 -2
  51. package/NumberFormat/ToRawPrecision.js +19 -23
  52. package/NumberFormat/digit-mapping.generated.js +1 -4
  53. package/NumberFormat/format_to_parts.d.ts +2 -2
  54. package/NumberFormat/format_to_parts.js +18 -22
  55. package/PartitionPattern.js +3 -6
  56. package/SupportedLocales.js +8 -11
  57. package/ToIntlMathematicalValue.d.ts +1 -1
  58. package/ToIntlMathematicalValue.js +12 -16
  59. package/constants.d.ts +1 -1
  60. package/constants.js +4 -8
  61. package/data.js +3 -6
  62. package/index.d.ts +47 -47
  63. package/index.js +45 -66
  64. package/package.json +13 -11
  65. package/regex.generated.js +1 -4
  66. package/types/core.js +1 -2
  67. package/types/date-time.js +2 -5
  68. package/types/displaynames.d.ts +1 -1
  69. package/types/displaynames.js +1 -2
  70. package/types/list.d.ts +1 -1
  71. package/types/list.js +1 -2
  72. package/types/number.d.ts +3 -3
  73. package/types/number.js +1 -2
  74. package/types/plural-rules.d.ts +2 -2
  75. package/types/plural-rules.js +1 -2
  76. package/types/relative-time.d.ts +2 -2
  77. package/types/relative-time.js +1 -2
  78. package/utils.js +28 -40
  79. package/lib/262.d.ts +0 -93
  80. package/lib/262.js +0 -400
  81. package/lib/CanonicalizeLocaleList.d.ts +0 -5
  82. package/lib/CanonicalizeLocaleList.js +0 -8
  83. package/lib/CanonicalizeTimeZoneName.d.ts +0 -8
  84. package/lib/CanonicalizeTimeZoneName.js +0 -17
  85. package/lib/CoerceOptionsToObject.d.ts +0 -6
  86. package/lib/CoerceOptionsToObject.js +0 -12
  87. package/lib/DefaultNumberOption.d.ts +0 -8
  88. package/lib/DefaultNumberOption.js +0 -18
  89. package/lib/GetNumberOption.d.ts +0 -9
  90. package/lib/GetNumberOption.js +0 -13
  91. package/lib/GetOption.d.ts +0 -9
  92. package/lib/GetOption.js +0 -31
  93. package/lib/GetOptionsObject.d.ts +0 -6
  94. package/lib/GetOptionsObject.js +0 -14
  95. package/lib/GetStringOrBooleanOption.d.ts +0 -10
  96. package/lib/GetStringOrBooleanOption.js +0 -31
  97. package/lib/IsSanctionedSimpleUnitIdentifier.d.ts +0 -13
  98. package/lib/IsSanctionedSimpleUnitIdentifier.js +0 -63
  99. package/lib/IsValidTimeZoneName.d.ts +0 -9
  100. package/lib/IsValidTimeZoneName.js +0 -17
  101. package/lib/IsWellFormedCurrencyCode.d.ts +0 -4
  102. package/lib/IsWellFormedCurrencyCode.js +0 -21
  103. package/lib/IsWellFormedUnitIdentifier.d.ts +0 -5
  104. package/lib/IsWellFormedUnitIdentifier.js +0 -28
  105. package/lib/NumberFormat/ApplyUnsignedRoundingMode.d.ts +0 -3
  106. package/lib/NumberFormat/ApplyUnsignedRoundingMode.js +0 -33
  107. package/lib/NumberFormat/CollapseNumberRange.d.ts +0 -8
  108. package/lib/NumberFormat/CollapseNumberRange.js +0 -50
  109. package/lib/NumberFormat/ComputeExponent.d.ts +0 -10
  110. package/lib/NumberFormat/ComputeExponent.js +0 -34
  111. package/lib/NumberFormat/ComputeExponentForMagnitude.d.ts +0 -8
  112. package/lib/NumberFormat/ComputeExponentForMagnitude.js +0 -65
  113. package/lib/NumberFormat/CurrencyDigits.d.ts +0 -6
  114. package/lib/NumberFormat/CurrencyDigits.js +0 -10
  115. package/lib/NumberFormat/FormatApproximately.d.ts +0 -5
  116. package/lib/NumberFormat/FormatApproximately.js +0 -9
  117. package/lib/NumberFormat/FormatNumeric.d.ts +0 -3
  118. package/lib/NumberFormat/FormatNumeric.js +0 -5
  119. package/lib/NumberFormat/FormatNumericRange.d.ts +0 -8
  120. package/lib/NumberFormat/FormatNumericRange.js +0 -11
  121. package/lib/NumberFormat/FormatNumericRangeToParts.d.ts +0 -8
  122. package/lib/NumberFormat/FormatNumericRangeToParts.js +0 -16
  123. package/lib/NumberFormat/FormatNumericToParts.d.ts +0 -5
  124. package/lib/NumberFormat/FormatNumericToParts.js +0 -14
  125. package/lib/NumberFormat/FormatNumericToString.d.ts +0 -9
  126. package/lib/NumberFormat/FormatNumericToString.js +0 -84
  127. package/lib/NumberFormat/GetUnsignedRoundingMode.d.ts +0 -2
  128. package/lib/NumberFormat/GetUnsignedRoundingMode.js +0 -28
  129. package/lib/NumberFormat/InitializeNumberFormat.d.ts +0 -12
  130. package/lib/NumberFormat/InitializeNumberFormat.js +0 -66
  131. package/lib/NumberFormat/PartitionNumberPattern.d.ts +0 -6
  132. package/lib/NumberFormat/PartitionNumberPattern.js +0 -126
  133. package/lib/NumberFormat/PartitionNumberRangePattern.d.ts +0 -8
  134. package/lib/NumberFormat/PartitionNumberRangePattern.js +0 -40
  135. package/lib/NumberFormat/SetNumberFormatDigitOptions.d.ts +0 -5
  136. package/lib/NumberFormat/SetNumberFormatDigitOptions.js +0 -179
  137. package/lib/NumberFormat/SetNumberFormatUnitOptions.d.ts +0 -5
  138. package/lib/NumberFormat/SetNumberFormatUnitOptions.js +0 -50
  139. package/lib/NumberFormat/ToRawFixed.d.ts +0 -9
  140. package/lib/NumberFormat/ToRawFixed.js +0 -119
  141. package/lib/NumberFormat/ToRawPrecision.d.ts +0 -9
  142. package/lib/NumberFormat/ToRawPrecision.js +0 -148
  143. package/lib/NumberFormat/digit-mapping.generated.d.ts +0 -1
  144. package/lib/NumberFormat/digit-mapping.generated.js +0 -782
  145. package/lib/NumberFormat/format_to_parts.d.ts +0 -24
  146. package/lib/NumberFormat/format_to_parts.js +0 -447
  147. package/lib/PartitionPattern.d.ts +0 -9
  148. package/lib/PartitionPattern.js +0 -36
  149. package/lib/SupportedLocales.d.ts +0 -9
  150. package/lib/SupportedLocales.js +0 -20
  151. package/lib/ToIntlMathematicalValue.d.ts +0 -2
  152. package/lib/ToIntlMathematicalValue.js +0 -27
  153. package/lib/constants.d.ts +0 -4
  154. package/lib/constants.js +0 -4
  155. package/lib/data.d.ts +0 -5
  156. package/lib/data.js +0 -13
  157. package/lib/index.d.ts +0 -47
  158. package/lib/index.js +0 -45
  159. package/lib/regex.generated.d.ts +0 -1
  160. package/lib/regex.generated.js +0 -2
  161. package/lib/types/core.d.ts +0 -10
  162. package/lib/types/core.js +0 -1
  163. package/lib/types/date-time.d.ts +0 -135
  164. package/lib/types/date-time.js +0 -6
  165. package/lib/types/displaynames.d.ts +0 -65
  166. package/lib/types/displaynames.js +0 -1
  167. package/lib/types/list.d.ts +0 -18
  168. package/lib/types/list.js +0 -1
  169. package/lib/types/number.d.ts +0 -173
  170. package/lib/types/number.js +0 -1
  171. package/lib/types/plural-rules.d.ts +0 -16
  172. package/lib/types/plural-rules.js +0 -1
  173. package/lib/types/relative-time.d.ts +0 -40
  174. package/lib/types/relative-time.js +0 -1
  175. package/lib/utils.d.ts +0 -30
  176. package/lib/utils.js +0 -135
package/lib/index.js DELETED
@@ -1,45 +0,0 @@
1
- export * from './CanonicalizeLocaleList';
2
- export * from './CanonicalizeTimeZoneName';
3
- export * from './CoerceOptionsToObject';
4
- export * from './GetNumberOption';
5
- export * from './GetOption';
6
- export * from './GetOptionsObject';
7
- export * from './GetStringOrBooleanOption';
8
- export * from './IsSanctionedSimpleUnitIdentifier';
9
- export * from './IsValidTimeZoneName';
10
- export * from './IsWellFormedCurrencyCode';
11
- export * from './IsWellFormedUnitIdentifier';
12
- export * from './NumberFormat/ApplyUnsignedRoundingMode';
13
- export * from './NumberFormat/CollapseNumberRange';
14
- export * from './NumberFormat/ComputeExponent';
15
- export * from './NumberFormat/ComputeExponentForMagnitude';
16
- export * from './NumberFormat/CurrencyDigits';
17
- export { default as _formatToParts } from './NumberFormat/format_to_parts';
18
- export * from './NumberFormat/FormatApproximately';
19
- export * from './NumberFormat/FormatNumeric';
20
- export * from './NumberFormat/FormatNumericRange';
21
- export * from './NumberFormat/FormatNumericRangeToParts';
22
- export * from './NumberFormat/FormatNumericToParts';
23
- export * from './NumberFormat/FormatNumericToString';
24
- export * from './NumberFormat/GetUnsignedRoundingMode';
25
- export * from './NumberFormat/InitializeNumberFormat';
26
- export * from './NumberFormat/PartitionNumberPattern';
27
- export * from './NumberFormat/PartitionNumberRangePattern';
28
- export * from './NumberFormat/SetNumberFormatDigitOptions';
29
- export * from './NumberFormat/SetNumberFormatUnitOptions';
30
- export * from './NumberFormat/ToRawFixed';
31
- export * from './NumberFormat/ToRawPrecision';
32
- export * from './PartitionPattern';
33
- export * from './SupportedLocales';
34
- export { createDataProperty, defineProperty, getInternalSlot, getMultiInternalSlots, isLiteralPart, setInternalSlot, setMultiInternalSlots, } from './utils';
35
- export * from './262';
36
- export { isMissingLocaleDataError } from './data';
37
- export * from './types/date-time';
38
- export * from './types/displaynames';
39
- export * from './types/list';
40
- export * from './types/number';
41
- export * from './types/plural-rules';
42
- export * from './types/relative-time';
43
- export { createMemoizedDateTimeFormat, createMemoizedListFormat, createMemoizedLocale, createMemoizedNumberFormat, createMemoizedPluralRules, invariant, } from './utils';
44
- export { ZERO } from './constants';
45
- export { ToIntlMathematicalValue } from './ToIntlMathematicalValue';
@@ -1 +0,0 @@
1
- export declare const S_UNICODE_REGEX: RegExp;
@@ -1,2 +0,0 @@
1
- // @generated from regex-gen.ts
2
- export var 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-\u20BF\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-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\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-\uFBC1\uFDFC\uFDFD\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]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDE8\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-\uDED7\uDEE0-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF73\uDF80-\uDFD8\uDFE0-\uDFEB]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDD78\uDD7A-\uDDCB\uDDCD-\uDE53\uDE60-\uDE6D\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6\uDF00-\uDF92\uDF94-\uDFCA]/;
@@ -1,10 +0,0 @@
1
- export type Locale = string;
2
- export interface LocaleData<T> {
3
- data: T;
4
- locale: Locale;
5
- }
6
- export interface LookupMatcherResult {
7
- locale: string;
8
- extension?: string;
9
- nu?: string;
10
- }
package/lib/types/core.js DELETED
@@ -1 +0,0 @@
1
- export {};
@@ -1,135 +0,0 @@
1
- export type Formats = Pick<Intl.DateTimeFormatOptions, 'weekday' | 'era' | 'year' | 'month' | 'day' | 'dayPeriod' | 'hour' | 'minute' | 'second' | 'timeZoneName'> & {
2
- fractionalSecondDigits?: 1 | 2 | 3;
3
- hour12?: boolean;
4
- pattern: string;
5
- pattern12: string;
6
- skeleton: string;
7
- rawPattern: string;
8
- rangePatterns: Record<TABLE_2 | 'default', RangePatterns>;
9
- rangePatterns12: Record<TABLE_2 | 'default', RangePatterns>;
10
- };
11
- export interface IntlDateTimeFormatInternal {
12
- locale: string;
13
- dataLocale: string;
14
- calendar?: string;
15
- dateStyle?: 'full' | 'long' | 'medium' | 'short';
16
- timeStyle?: 'full' | 'long' | 'medium' | 'short';
17
- weekday: 'narrow' | 'short' | 'long';
18
- era: 'narrow' | 'short' | 'long';
19
- year: '2-digit' | 'numeric';
20
- month: '2-digit' | 'numeric' | 'narrow' | 'short' | 'long';
21
- day: '2-digit' | 'numeric';
22
- dayPeriod: 'narrow' | 'short' | 'long';
23
- hour: '2-digit' | 'numeric';
24
- minute: '2-digit' | 'numeric';
25
- second: '2-digit' | 'numeric';
26
- timeZoneName: 'short' | 'long' | 'shortOffset' | 'longOffset' | 'shortGeneric' | 'longGeneric';
27
- fractionalSecondDigits?: 1 | 2 | 3;
28
- hourCycle: string;
29
- numberingSystem: string;
30
- timeZone: string;
31
- pattern: string;
32
- format: Formats;
33
- rangePatterns: Record<TABLE_2 | 'default', RangePatterns>;
34
- boundFormat?: Intl.DateTimeFormat['format'];
35
- }
36
- export interface RangePatternPart<T extends RangePatternType = RangePatternType> {
37
- source: T;
38
- pattern: string;
39
- }
40
- export type RangePatterns = Pick<Intl.DateTimeFormatOptions, 'weekday' | 'era' | 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second' | 'timeZoneName'> & {
41
- hour12?: boolean;
42
- patternParts: Array<RangePatternPart>;
43
- };
44
- export declare enum RangePatternType {
45
- startRange = "startRange",
46
- shared = "shared",
47
- endRange = "endRange"
48
- }
49
- export type TABLE_6 = 'weekday' | 'era' | 'year' | 'month' | 'day' | 'dayPeriod' | 'hour' | 'minute' | 'second' | 'fractionalSecondDigits' | 'timeZoneName';
50
- export type TABLE_2 = 'era' | 'year' | 'month' | 'day' | 'dayPeriod' | 'ampm' | 'hour' | 'minute' | 'second' | 'fractionalSecondDigits';
51
- export type TimeZoneNameData = Record<string, {
52
- long?: [string, string];
53
- short?: [string, string];
54
- }>;
55
- export interface EraData {
56
- BC: string;
57
- AD: string;
58
- }
59
- export interface DateTimeFormatLocaleInternalData {
60
- am: string;
61
- pm: string;
62
- weekday: {
63
- narrow: string[];
64
- long: string[];
65
- short: string[];
66
- };
67
- era: {
68
- narrow: EraData;
69
- long: EraData;
70
- short: EraData;
71
- };
72
- month: {
73
- narrow: string[];
74
- long: string[];
75
- short: string[];
76
- };
77
- timeZoneName: TimeZoneNameData;
78
- /**
79
- * So we can construct GMT+08:00
80
- */
81
- gmtFormat: string;
82
- /**
83
- * So we can construct GMT+08:00
84
- */
85
- hourFormat: string;
86
- hourCycle: string;
87
- dateFormat: {
88
- full: Formats;
89
- long: Formats;
90
- medium: Formats;
91
- short: Formats;
92
- };
93
- timeFormat: {
94
- full: Formats;
95
- long: Formats;
96
- medium: Formats;
97
- short: Formats;
98
- };
99
- dateTimeFormat: {
100
- full: string;
101
- long: string;
102
- medium: string;
103
- short: string;
104
- };
105
- formats: Record<string, Formats[]>;
106
- nu: string[];
107
- hc: string[];
108
- ca: string[];
109
- }
110
- export type IntervalFormatsData = {
111
- intervalFormatFallback: string;
112
- } & Record<string, Record<string, string>>;
113
- export interface DateTimeFormat extends Omit<Intl.DateTimeFormat, 'resolvedOptions' | 'formatRange' | 'formatRangeToParts' | 'formatToParts'> {
114
- resolvedOptions(): ResolvedDateTimeFormatOptions;
115
- formatToParts(date?: Date | number): IntlDateTimeFormatPart[];
116
- formatRange(startDate: number | Date, endDate: number | Date): string;
117
- formatRangeToParts(startDate: number | Date, endDate: number | Date): IntlDateTimeFormatPart[];
118
- }
119
- export interface ResolvedDateTimeFormatOptions extends Intl.ResolvedDateTimeFormatOptions {
120
- dateStyle?: 'full' | 'long' | 'medium' | 'short';
121
- timeStyle?: 'full' | 'long' | 'medium' | 'short';
122
- numberingSystem: string;
123
- }
124
- export type UnpackedZoneData = [
125
- number,
126
- string,
127
- number,
128
- boolean
129
- ];
130
- export type IntlDateTimeFormatPartType = Intl.DateTimeFormatPartTypes | 'ampm' | 'relatedYear' | 'yearName' | 'unknown' | 'fractionalSecondDigits';
131
- export interface IntlDateTimeFormatPart {
132
- type: IntlDateTimeFormatPartType;
133
- value: string | undefined;
134
- source?: RangePatternType;
135
- }
@@ -1,6 +0,0 @@
1
- export var RangePatternType;
2
- (function (RangePatternType) {
3
- RangePatternType["startRange"] = "startRange";
4
- RangePatternType["shared"] = "shared";
5
- RangePatternType["endRange"] = "endRange";
6
- })(RangePatternType || (RangePatternType = {}));
@@ -1,65 +0,0 @@
1
- import { LocaleData } from './core';
2
- type LanguageTag = string;
3
- type RegionCode = string;
4
- type ScriptCode = string;
5
- type CurrencyCode = string;
6
- type CalendarCode = string;
7
- type DateTimeFieldCode = string;
8
- export interface DisplayNamesData {
9
- /**
10
- * Note that for style fields, `short` and `narrow` might not exist.
11
- * At runtime, the fallback order will be narrow -> short -> long.
12
- */
13
- types: {
14
- /**
15
- * Maps language subtag like `zh-CN` to their display names.
16
- */
17
- language: {
18
- dialect: {
19
- narrow: Record<LanguageTag, string>;
20
- short: Record<LanguageTag, string>;
21
- long: Record<LanguageTag, string>;
22
- };
23
- standard: {
24
- narrow: Record<LanguageTag, string>;
25
- short: Record<LanguageTag, string>;
26
- long: Record<LanguageTag, string>;
27
- };
28
- };
29
- region: {
30
- narrow: Record<RegionCode, string>;
31
- short: Record<RegionCode, string>;
32
- long: Record<RegionCode, string>;
33
- };
34
- script: {
35
- narrow: Record<ScriptCode, string>;
36
- short: Record<ScriptCode, string>;
37
- long: Record<ScriptCode, string>;
38
- };
39
- currency: {
40
- narrow: Record<CurrencyCode, string>;
41
- short: Record<CurrencyCode, string>;
42
- long: Record<CurrencyCode, string>;
43
- };
44
- calendar: {
45
- narrow: Record<CalendarCode, string>;
46
- short: Record<CalendarCode, string>;
47
- long: Record<CalendarCode, string>;
48
- };
49
- dateTimeField: {
50
- narrow: Record<DateTimeFieldCode, string>;
51
- short: Record<DateTimeFieldCode, string>;
52
- long: Record<DateTimeFieldCode, string>;
53
- };
54
- };
55
- /**
56
- * Not in spec, but we need this to display both language and region in display name.
57
- * e.g. zh-Hans-SG + "{0}({1})" -> 简体中文(新加坡)
58
- * Here {0} is replaced by language display name and {1} is replaced by region display name.
59
- */
60
- patterns: {
61
- locale: string;
62
- };
63
- }
64
- export type DisplayNamesLocaleData = LocaleData<DisplayNamesData>;
65
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,18 +0,0 @@
1
- import { LocaleData } from './core';
2
- export type ListPatternLocaleData = LocaleData<ListPatternFieldsData>;
3
- export interface ListPatternFieldsData {
4
- conjunction?: ListPatternData;
5
- disjunction?: ListPatternData;
6
- unit?: ListPatternData;
7
- }
8
- export interface ListPattern {
9
- start: string;
10
- middle: string;
11
- end: string;
12
- pair: string;
13
- }
14
- export interface ListPatternData {
15
- long: ListPattern;
16
- short?: ListPattern;
17
- narrow?: ListPattern;
18
- }
package/lib/types/list.js DELETED
@@ -1 +0,0 @@
1
- export {};
@@ -1,173 +0,0 @@
1
- import Decimal from 'decimal.js';
2
- import { LocaleData } from './core';
3
- import { LDMLPluralRule } from './plural-rules';
4
- export type NumberFormatNotation = 'standard' | 'scientific' | 'engineering' | 'compact';
5
- export type RoundingPriorityType = 'auto' | 'morePrecision' | 'lessPrecision';
6
- export type NumberFormatRoundingType = 'morePrecision' | 'lessPrecision' | 'significantDigits' | 'fractionDigits';
7
- export type RoundingModeType = 'ceil' | 'floor' | 'expand' | 'trunc' | 'halfCeil' | 'halfFloor' | 'halfExpand' | 'halfTrunc' | 'halfEven';
8
- export type UnsignedRoundingModeType = 'infinity' | 'zero' | 'half-infinity' | 'half-zero' | 'half-even';
9
- export type UseGroupingType = 'min2' | 'auto' | 'always' | boolean;
10
- export interface NumberFormatDigitOptions {
11
- minimumIntegerDigits?: number;
12
- minimumSignificantDigits?: number;
13
- maximumSignificantDigits?: number;
14
- minimumFractionDigits?: number;
15
- maximumFractionDigits?: number;
16
- roundingPriority?: RoundingPriorityType;
17
- roundingIncrement?: number;
18
- roundingMode?: RoundingModeType;
19
- trailingZeroDisplay?: TrailingZeroDisplay;
20
- }
21
- export interface NumberFormatDigitInternalSlots {
22
- minimumIntegerDigits: number;
23
- minimumSignificantDigits: number;
24
- maximumSignificantDigits: number;
25
- roundingType: NumberFormatRoundingType;
26
- minimumFractionDigits: number;
27
- maximumFractionDigits: number;
28
- notation: NumberFormatNotation;
29
- roundingIncrement: number;
30
- roundingMode: RoundingModeType;
31
- trailingZeroDisplay: TrailingZeroDisplay;
32
- roundingPriority: RoundingPriorityType;
33
- }
34
- export type RawNumberLocaleData = LocaleData<NumberFormatLocaleInternalData>;
35
- export interface NumberFormatLocaleInternalData {
36
- units: UnitDataTable;
37
- currencies: Record<string, CurrencyData>;
38
- numbers: RawNumberData;
39
- nu: string[];
40
- }
41
- export interface UnitDataTable {
42
- simple: Record<string, UnitData>;
43
- compound: Record<string, CompoundUnitData>;
44
- }
45
- export interface UnitData {
46
- long: LDMLPluralRuleMap<string>;
47
- short: LDMLPluralRuleMap<string>;
48
- narrow: LDMLPluralRuleMap<string>;
49
- perUnit: Record<'narrow' | 'short' | 'long', string | undefined>;
50
- }
51
- export interface CompoundUnitData {
52
- long: string;
53
- short: string;
54
- narrow: string;
55
- }
56
- export interface CurrencyData {
57
- displayName: LDMLPluralRuleMap<string>;
58
- symbol: string;
59
- narrow: string;
60
- }
61
- export type DecimalFormatNum = '1000' | '10000' | '100000' | '1000000' | '10000000' | '100000000' | '1000000000' | '10000000000' | '100000000000' | '1000000000000' | '10000000000000' | '100000000000000';
62
- export type NumberingSystem = string;
63
- /**
64
- * We only care about insertBetween bc we assume
65
- * `currencyMatch` & `surroundingMatch` are all the same
66
- *
67
- * @export
68
- * @interface CurrencySpacingData
69
- */
70
- export interface CurrencySpacingData {
71
- beforeInsertBetween: string;
72
- afterInsertBetween: string;
73
- }
74
- export interface RawCurrencyData {
75
- currencySpacing: CurrencySpacingData;
76
- standard: string;
77
- accounting: string;
78
- short?: Record<DecimalFormatNum, LDMLPluralRuleMap<string>>;
79
- unitPattern: string;
80
- }
81
- export interface SymbolsData {
82
- decimal: string;
83
- group: string;
84
- list: string;
85
- percentSign: string;
86
- plusSign: string;
87
- minusSign: string;
88
- exponential: string;
89
- superscriptingExponent: string;
90
- perMille: string;
91
- infinity: string;
92
- nan: string;
93
- timeSeparator: string;
94
- approximatelySign: string;
95
- rangeSign: string;
96
- currencyGroup?: string;
97
- currencyDecimal?: string;
98
- }
99
- export interface RawNumberData {
100
- nu: string[];
101
- symbols: Record<NumberingSystem, SymbolsData>;
102
- decimal: Record<NumberingSystem, {
103
- standard: string;
104
- long: Record<DecimalFormatNum, LDMLPluralRuleMap<string>>;
105
- short: Record<DecimalFormatNum, LDMLPluralRuleMap<string>>;
106
- }>;
107
- percent: Record<NumberingSystem, string>;
108
- currency: Record<NumberingSystem, RawCurrencyData>;
109
- }
110
- export type LDMLPluralRuleMap<T> = Omit<Partial<Record<LDMLPluralRule, T>>, 'other'> & {
111
- other: T;
112
- };
113
- export interface RawNumberFormatResult {
114
- formattedString: string;
115
- roundedNumber: Decimal;
116
- integerDigitsCount: number;
117
- roundingMagnitude: number;
118
- }
119
- export type NumberFormatOptionsLocaleMatcher = 'lookup' | 'best fit';
120
- export type NumberFormatOptionsStyle = 'decimal' | 'percent' | 'currency' | 'unit';
121
- export type NumberFormatOptionsCompactDisplay = 'short' | 'long';
122
- export type NumberFormatOptionsCurrencyDisplay = 'symbol' | 'code' | 'name' | 'narrowSymbol';
123
- export type NumberFormatOptionsCurrencySign = 'standard' | 'accounting';
124
- export type NumberFormatOptionsNotation = NumberFormatNotation;
125
- export type NumberFormatOptionsSignDisplay = 'auto' | 'always' | 'never' | 'exceptZero' | 'negative';
126
- export type NumberFormatOptionsUnitDisplay = 'long' | 'short' | 'narrow';
127
- export type TrailingZeroDisplay = 'auto' | 'stripIfInteger';
128
- export interface NumberFormatInternal extends NumberFormatDigitInternalSlots {
129
- locale: string;
130
- dataLocale: string;
131
- style: NumberFormatOptionsStyle;
132
- currency?: string;
133
- currencyDisplay: NumberFormatOptionsCurrencyDisplay;
134
- unit?: string;
135
- unitDisplay: NumberFormatOptionsUnitDisplay;
136
- currencySign: NumberFormatOptionsCurrencySign;
137
- notation: NumberFormatOptionsNotation;
138
- compactDisplay: NumberFormatOptionsCompactDisplay;
139
- signDisplay: NumberFormatOptionsSignDisplay;
140
- useGrouping?: UseGroupingType;
141
- pl: Intl.PluralRules;
142
- boundFormat?: Intl.NumberFormat['format'];
143
- numberingSystem: string;
144
- dataLocaleData: NumberFormatLocaleInternalData;
145
- roundingMode: RoundingModeType;
146
- }
147
- export type NumberFormatOptions = Omit<Intl.NumberFormatOptions, 'signDisplay' | 'useGrouping'> & NumberFormatDigitOptions & {
148
- localeMatcher?: NumberFormatOptionsLocaleMatcher;
149
- style?: NumberFormatOptionsStyle;
150
- compactDisplay?: NumberFormatOptionsCompactDisplay;
151
- currencyDisplay?: NumberFormatOptionsCurrencyDisplay;
152
- currencySign?: NumberFormatOptionsCurrencySign;
153
- notation?: NumberFormatOptionsNotation;
154
- signDisplay?: NumberFormatOptionsSignDisplay;
155
- unit?: string;
156
- unitDisplay?: NumberFormatOptionsUnitDisplay;
157
- numberingSystem?: string;
158
- trailingZeroDisplay?: TrailingZeroDisplay;
159
- roundingPriority?: RoundingPriorityType;
160
- roundingIncrement?: number;
161
- roundingMode?: RoundingModeType;
162
- useGrouping?: UseGroupingType;
163
- };
164
- export type ResolvedNumberFormatOptions = Intl.ResolvedNumberFormatOptions & Pick<NumberFormatInternal, 'currencySign' | 'unit' | 'unitDisplay' | 'notation' | 'compactDisplay' | 'signDisplay'>;
165
- export type NumberFormatPartTypes = Intl.NumberFormatPartTypes | 'exponentSeparator' | 'exponentMinusSign' | 'exponentInteger' | 'compact' | 'unit' | 'literal' | 'approximatelySign';
166
- export interface NumberFormatPart {
167
- type: NumberFormatPartTypes;
168
- value: string;
169
- source?: string;
170
- }
171
- export interface NumberRangeToParts extends NumberFormatPart {
172
- result: string;
173
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,16 +0,0 @@
1
- import { LocaleData } from './core';
2
- import { NumberFormatDigitInternalSlots } from './number';
3
- export type LDMLPluralRule = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other';
4
- export interface PluralRulesData {
5
- categories: {
6
- cardinal: string[];
7
- ordinal: string[];
8
- };
9
- fn: (val: number | string, ord?: boolean) => LDMLPluralRule;
10
- }
11
- export type PluralRulesLocaleData = LocaleData<PluralRulesData>;
12
- export interface PluralRulesInternal extends NumberFormatDigitInternalSlots {
13
- initializedPluralRules: boolean;
14
- locale: string;
15
- type: 'cardinal' | 'ordinal';
16
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,40 +0,0 @@
1
- import { LocaleData } from './core';
2
- import { LDMLPluralRule } from './plural-rules';
3
- export interface FieldData {
4
- '0'?: string;
5
- '1'?: string;
6
- '-1'?: string;
7
- '2'?: string;
8
- '-2'?: string;
9
- '3'?: string;
10
- '-3'?: string;
11
- future: RelativeTimeData;
12
- past: RelativeTimeData;
13
- }
14
- type RelativeTimeData = {
15
- [u in LDMLPluralRule]?: string;
16
- };
17
- export type UnpackedLocaleFieldsData = {
18
- [f in RelativeTimeField]?: FieldData;
19
- } & {
20
- nu: Array<string | null>;
21
- };
22
- export type LocaleFieldsData = {
23
- [f in RelativeTimeField]?: FieldData;
24
- } & {
25
- nu?: Array<string | null>;
26
- };
27
- export type RelativeTimeField = 'second' | 'second-short' | 'second-narrow' | 'minute' | 'minute-short' | 'minute-narrow' | 'hour' | 'hour-short' | 'hour-narrow' | 'day' | 'day-short' | 'day-narrow' | 'week' | 'week-short' | 'week-narrow' | 'month' | 'month-short' | 'month-narrow' | 'quarter' | 'quarter-short' | 'quarter-narrow' | 'year' | 'year-short' | 'year-narrow';
28
- export type RelativeTimeFormatSingularUnit = Exclude<Intl.RelativeTimeFormatUnit, 'seconds' | 'minutes' | 'hours' | 'days' | 'weeks' | 'months' | 'quarters' | 'years'>;
29
- export type RelativeTimeLocaleData = LocaleData<LocaleFieldsData>;
30
- export interface RelativeTimeFormatInternal {
31
- numberFormat: Intl.NumberFormat;
32
- pluralRules: Intl.PluralRules;
33
- locale: string;
34
- fields: LocaleFieldsData;
35
- style: Intl.ResolvedRelativeTimeFormatOptions['style'];
36
- numeric: Intl.ResolvedRelativeTimeFormatOptions['numeric'];
37
- numberingSystem: string;
38
- initializedRelativeTimeFormat: boolean;
39
- }
40
- export {};
@@ -1 +0,0 @@
1
- export {};
package/lib/utils.d.ts DELETED
@@ -1,30 +0,0 @@
1
- export declare function repeat(s: string, times: number): string;
2
- export declare function setInternalSlot<Instance extends object, Internal extends object, Field extends keyof Internal>(map: WeakMap<Instance, Internal>, pl: Instance, field: Field, value: NonNullable<Internal>[Field]): void;
3
- export declare function setMultiInternalSlots<Instance extends object, Internal extends object, K extends keyof Internal>(map: WeakMap<Instance, Internal>, pl: Instance, props: Pick<NonNullable<Internal>, K>): void;
4
- export declare function getInternalSlot<Instance extends object, Internal extends object, Field extends keyof Internal>(map: WeakMap<Instance, Internal>, pl: Instance, field: Field): Internal[Field];
5
- export declare function getMultiInternalSlots<Instance extends object, Internal extends object, Field extends keyof Internal>(map: WeakMap<Instance, Internal>, pl: Instance, ...fields: Field[]): Pick<Internal, Field>;
6
- export interface LiteralPart {
7
- type: 'literal';
8
- value: string;
9
- }
10
- export declare function isLiteralPart(patternPart: LiteralPart | {
11
- type: string;
12
- value?: string;
13
- }): patternPart is LiteralPart;
14
- export declare function defineProperty<T extends object>(target: T, name: string | symbol, { value }: {
15
- value: any;
16
- } & ThisType<any>): void;
17
- /**
18
- * 7.3.5 CreateDataProperty
19
- * @param target
20
- * @param name
21
- * @param value
22
- */
23
- export declare function createDataProperty<T extends object>(target: T, name: string | symbol, value: any): void;
24
- export declare const UNICODE_EXTENSION_SEQUENCE_REGEX: RegExp;
25
- export declare function invariant(condition: boolean, message: string, Err?: any): asserts condition;
26
- export declare const createMemoizedNumberFormat: (...args: ConstructorParameters<typeof Intl.NumberFormat>) => Intl.NumberFormat;
27
- export declare const createMemoizedDateTimeFormat: (...args: ConstructorParameters<typeof Intl.DateTimeFormat>) => Intl.DateTimeFormat;
28
- export declare const createMemoizedPluralRules: (...args: ConstructorParameters<typeof Intl.PluralRules>) => Intl.PluralRules;
29
- export declare const createMemoizedLocale: (...args: ConstructorParameters<typeof Intl.Locale>) => Intl.Locale;
30
- export declare const createMemoizedListFormat: (...args: ConstructorParameters<typeof Intl.ListFormat>) => Intl.ListFormat;