@formatjs/ecma402-abstract 1.0.3 → 1.2.2

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 (242) hide show
  1. package/262.d.ts +79 -0
  2. package/262.d.ts.map +1 -0
  3. package/262.js +336 -0
  4. package/_validate_dist-base_options.optionsvalid.d.ts +2 -1
  5. package/_validate_dist-esm_options.optionsvalid.d.ts +2 -1
  6. package/index.d.ts +33 -0
  7. package/index.d.ts.map +1 -1
  8. package/index.js +52 -11
  9. package/lib/262.d.ts +79 -0
  10. package/lib/262.d.ts.map +1 -0
  11. package/lib/262.js +312 -0
  12. package/lib/index.d.ts +33 -0
  13. package/lib/index.d.ts.map +1 -1
  14. package/lib/index.js +33 -0
  15. package/lib/src/CanonicalizeLocaleList.d.ts +6 -0
  16. package/lib/src/CanonicalizeLocaleList.d.ts.map +1 -0
  17. package/lib/src/CanonicalizeLocaleList.js +8 -0
  18. package/lib/src/CanonicalizeTimeZoneName.d.ts +9 -0
  19. package/lib/src/CanonicalizeTimeZoneName.d.ts.map +1 -0
  20. package/lib/src/CanonicalizeTimeZoneName.js +17 -0
  21. package/lib/src/DateTimeFormat/BasicFormatMatcher.d.ts +8 -0
  22. package/lib/src/DateTimeFormat/BasicFormatMatcher.d.ts.map +1 -0
  23. package/lib/src/DateTimeFormat/BasicFormatMatcher.js +61 -0
  24. package/lib/src/DateTimeFormat/BestFitFormatMatcher.d.ts +17 -0
  25. package/lib/src/DateTimeFormat/BestFitFormatMatcher.d.ts.map +1 -0
  26. package/lib/src/DateTimeFormat/BestFitFormatMatcher.js +119 -0
  27. package/lib/src/DateTimeFormat/DateTimeStyleFormat.d.ts +3 -0
  28. package/lib/src/DateTimeFormat/DateTimeStyleFormat.d.ts.map +1 -0
  29. package/lib/src/DateTimeFormat/DateTimeStyleFormat.js +50 -0
  30. package/lib/src/DateTimeFormat/FormatDateTime.d.ts +8 -0
  31. package/lib/src/DateTimeFormat/FormatDateTime.d.ts.map +1 -0
  32. package/lib/src/DateTimeFormat/FormatDateTime.js +15 -0
  33. package/lib/src/DateTimeFormat/FormatDateTimeToParts.d.ts +10 -0
  34. package/lib/src/DateTimeFormat/FormatDateTimeToParts.d.ts.map +1 -0
  35. package/lib/src/DateTimeFormat/FormatDateTimeToParts.js +21 -0
  36. package/lib/src/DateTimeFormat/InitializeDateTimeFormat.d.ts +18 -0
  37. package/lib/src/DateTimeFormat/InitializeDateTimeFormat.d.ts.map +1 -0
  38. package/lib/src/DateTimeFormat/InitializeDateTimeFormat.js +163 -0
  39. package/lib/src/DateTimeFormat/PartitionDateTimePattern.d.ts +13 -0
  40. package/lib/src/DateTimeFormat/PartitionDateTimePattern.d.ts.map +1 -0
  41. package/lib/src/DateTimeFormat/PartitionDateTimePattern.js +176 -0
  42. package/lib/src/DateTimeFormat/ToDateTimeOptions.d.ts +9 -0
  43. package/lib/src/DateTimeFormat/ToDateTimeOptions.d.ts.map +1 -0
  44. package/lib/src/DateTimeFormat/ToDateTimeOptions.js +57 -0
  45. package/lib/src/DateTimeFormat/ToLocalTime.d.ts +24 -0
  46. package/lib/src/DateTimeFormat/ToLocalTime.d.ts.map +1 -0
  47. package/lib/src/DateTimeFormat/ToLocalTime.js +49 -0
  48. package/lib/src/DateTimeFormat/skeleton.d.ts +9 -0
  49. package/lib/src/DateTimeFormat/skeleton.d.ts.map +1 -0
  50. package/lib/src/DateTimeFormat/skeleton.js +163 -0
  51. package/lib/src/DateTimeFormat/utils.d.ts +10 -0
  52. package/lib/src/DateTimeFormat/utils.d.ts.map +1 -0
  53. package/lib/src/DateTimeFormat/utils.js +18 -0
  54. package/lib/src/DisplayNames/CanonicalCodeForDisplayNames.d.ts +2 -0
  55. package/lib/src/DisplayNames/CanonicalCodeForDisplayNames.d.ts.map +1 -0
  56. package/lib/src/DisplayNames/CanonicalCodeForDisplayNames.js +33 -0
  57. package/lib/src/GetOption.js +1 -1
  58. package/lib/src/IsValidTimeZoneName.d.ts +10 -0
  59. package/lib/src/IsValidTimeZoneName.d.ts.map +1 -0
  60. package/lib/src/IsValidTimeZoneName.js +11 -0
  61. package/lib/src/NumberFormat/ComputeExponent.d.ts +12 -0
  62. package/lib/src/NumberFormat/ComputeExponent.d.ts.map +1 -0
  63. package/lib/src/NumberFormat/ComputeExponent.js +39 -0
  64. package/lib/src/NumberFormat/ComputeExponentForMagnitude.d.ts +10 -0
  65. package/lib/src/NumberFormat/ComputeExponentForMagnitude.d.ts.map +1 -0
  66. package/lib/src/NumberFormat/ComputeExponentForMagnitude.js +60 -0
  67. package/lib/src/NumberFormat/CurrencyDigits.d.ts +7 -0
  68. package/lib/src/NumberFormat/CurrencyDigits.d.ts.map +1 -0
  69. package/lib/src/NumberFormat/CurrencyDigits.js +10 -0
  70. package/lib/src/NumberFormat/FormatNumericToParts.d.ts +5 -0
  71. package/lib/src/NumberFormat/FormatNumericToParts.d.ts.map +1 -0
  72. package/lib/src/NumberFormat/FormatNumericToParts.js +14 -0
  73. package/lib/src/NumberFormat/FormatNumericToString.js +1 -1
  74. package/lib/src/NumberFormat/InitializeNumberFormat.d.ts +13 -0
  75. package/lib/src/NumberFormat/InitializeNumberFormat.d.ts.map +1 -0
  76. package/lib/src/NumberFormat/InitializeNumberFormat.js +71 -0
  77. package/lib/src/NumberFormat/PartitionNumberPattern.d.ts +8 -0
  78. package/lib/src/NumberFormat/PartitionNumberPattern.d.ts.map +1 -0
  79. package/lib/src/NumberFormat/PartitionNumberPattern.js +74 -0
  80. package/lib/src/NumberFormat/SetNumberFormatUnitOptions.d.ts +8 -0
  81. package/lib/src/NumberFormat/SetNumberFormatUnitOptions.d.ts.map +1 -0
  82. package/lib/src/NumberFormat/SetNumberFormatUnitOptions.js +39 -0
  83. package/lib/src/NumberFormat/digit-mapping.json +1 -0
  84. package/lib/src/NumberFormat/format_to_parts.d.ts +22 -0
  85. package/lib/src/NumberFormat/format_to_parts.d.ts.map +1 -0
  86. package/lib/src/NumberFormat/format_to_parts.js +421 -0
  87. package/lib/src/PluralRules/GetOperands.d.ts +32 -0
  88. package/lib/src/PluralRules/GetOperands.d.ts.map +1 -0
  89. package/lib/src/PluralRules/GetOperands.js +47 -0
  90. package/lib/src/PluralRules/InitializePluralRules.d.ts +9 -0
  91. package/lib/src/PluralRules/InitializePluralRules.d.ts.map +1 -0
  92. package/lib/src/PluralRules/InitializePluralRules.js +20 -0
  93. package/lib/src/PluralRules/ResolvePlural.d.ts +13 -0
  94. package/lib/src/PluralRules/ResolvePlural.d.ts.map +1 -0
  95. package/lib/src/PluralRules/ResolvePlural.js +25 -0
  96. package/lib/src/RelativeTimeFormat/FormatRelativeTime.d.ts +5 -0
  97. package/lib/src/RelativeTimeFormat/FormatRelativeTime.d.ts.map +1 -0
  98. package/lib/src/RelativeTimeFormat/FormatRelativeTime.js +10 -0
  99. package/lib/src/RelativeTimeFormat/FormatRelativeTimeToParts.d.ts +5 -0
  100. package/lib/src/RelativeTimeFormat/FormatRelativeTimeToParts.d.ts.map +1 -0
  101. package/lib/src/RelativeTimeFormat/FormatRelativeTimeToParts.js +18 -0
  102. package/lib/src/RelativeTimeFormat/InitializeRelativeTimeFormat.d.ts +9 -0
  103. package/lib/src/RelativeTimeFormat/InitializeRelativeTimeFormat.d.ts.map +1 -0
  104. package/lib/src/RelativeTimeFormat/InitializeRelativeTimeFormat.js +32 -0
  105. package/lib/src/RelativeTimeFormat/MakePartsList.d.ts +3 -0
  106. package/lib/src/RelativeTimeFormat/MakePartsList.d.ts.map +1 -0
  107. package/lib/src/RelativeTimeFormat/MakePartsList.js +27 -0
  108. package/lib/src/RelativeTimeFormat/PartitionRelativeTimePattern.d.ts +5 -0
  109. package/lib/src/RelativeTimeFormat/PartitionRelativeTimePattern.d.ts.map +1 -0
  110. package/lib/src/RelativeTimeFormat/PartitionRelativeTimePattern.js +54 -0
  111. package/lib/src/RelativeTimeFormat/SingularRelativeTimeUnit.d.ts +7 -0
  112. package/lib/src/RelativeTimeFormat/SingularRelativeTimeUnit.d.ts.map +1 -0
  113. package/lib/src/RelativeTimeFormat/SingularRelativeTimeUnit.js +36 -0
  114. package/lib/src/SupportedLocales.js +1 -1
  115. package/lib/src/data.js +1 -1
  116. package/lib/types/core.js +1 -0
  117. package/lib/types/date-time.d.ts +112 -0
  118. package/lib/types/date-time.d.ts.map +1 -0
  119. package/lib/types/date-time.js +1 -0
  120. package/lib/types/displaynames.js +1 -0
  121. package/lib/types/list.js +1 -0
  122. package/lib/types/number.d.ts +44 -0
  123. package/lib/types/number.d.ts.map +1 -1
  124. package/lib/types/number.js +1 -0
  125. package/lib/types/plural-rules.d.ts +6 -0
  126. package/lib/types/plural-rules.d.ts.map +1 -1
  127. package/lib/types/plural-rules.js +1 -0
  128. package/lib/types/relative-time.d.ts +63 -0
  129. package/lib/types/relative-time.d.ts.map +1 -1
  130. package/lib/types/relative-time.js +1 -0
  131. package/package.json +2 -6
  132. package/src/CanonicalizeLocaleList.d.ts +6 -0
  133. package/src/CanonicalizeLocaleList.d.ts.map +1 -0
  134. package/src/CanonicalizeLocaleList.js +12 -0
  135. package/src/CanonicalizeTimeZoneName.d.ts +9 -0
  136. package/src/CanonicalizeTimeZoneName.d.ts.map +1 -0
  137. package/src/CanonicalizeTimeZoneName.js +21 -0
  138. package/src/DateTimeFormat/BasicFormatMatcher.d.ts +8 -0
  139. package/src/DateTimeFormat/BasicFormatMatcher.d.ts.map +1 -0
  140. package/src/DateTimeFormat/BasicFormatMatcher.js +65 -0
  141. package/src/DateTimeFormat/BestFitFormatMatcher.d.ts +17 -0
  142. package/src/DateTimeFormat/BestFitFormatMatcher.d.ts.map +1 -0
  143. package/src/DateTimeFormat/BestFitFormatMatcher.js +124 -0
  144. package/src/DateTimeFormat/DateTimeStyleFormat.d.ts +3 -0
  145. package/src/DateTimeFormat/DateTimeStyleFormat.d.ts.map +1 -0
  146. package/src/DateTimeFormat/DateTimeStyleFormat.js +54 -0
  147. package/src/DateTimeFormat/FormatDateTime.d.ts +8 -0
  148. package/src/DateTimeFormat/FormatDateTime.d.ts.map +1 -0
  149. package/src/DateTimeFormat/FormatDateTime.js +19 -0
  150. package/src/DateTimeFormat/FormatDateTimeToParts.d.ts +10 -0
  151. package/src/DateTimeFormat/FormatDateTimeToParts.d.ts.map +1 -0
  152. package/src/DateTimeFormat/FormatDateTimeToParts.js +25 -0
  153. package/src/DateTimeFormat/InitializeDateTimeFormat.d.ts +18 -0
  154. package/src/DateTimeFormat/InitializeDateTimeFormat.d.ts.map +1 -0
  155. package/src/DateTimeFormat/InitializeDateTimeFormat.js +167 -0
  156. package/src/DateTimeFormat/PartitionDateTimePattern.d.ts +13 -0
  157. package/src/DateTimeFormat/PartitionDateTimePattern.d.ts.map +1 -0
  158. package/src/DateTimeFormat/PartitionDateTimePattern.js +180 -0
  159. package/src/DateTimeFormat/ToDateTimeOptions.d.ts +9 -0
  160. package/src/DateTimeFormat/ToDateTimeOptions.d.ts.map +1 -0
  161. package/src/DateTimeFormat/ToDateTimeOptions.js +61 -0
  162. package/src/DateTimeFormat/ToLocalTime.d.ts +24 -0
  163. package/src/DateTimeFormat/ToLocalTime.d.ts.map +1 -0
  164. package/src/DateTimeFormat/ToLocalTime.js +53 -0
  165. package/src/DateTimeFormat/skeleton.d.ts +9 -0
  166. package/src/DateTimeFormat/skeleton.d.ts.map +1 -0
  167. package/src/DateTimeFormat/skeleton.js +167 -0
  168. package/src/DateTimeFormat/utils.d.ts +10 -0
  169. package/src/DateTimeFormat/utils.d.ts.map +1 -0
  170. package/src/DateTimeFormat/utils.js +21 -0
  171. package/src/DisplayNames/CanonicalCodeForDisplayNames.d.ts +2 -0
  172. package/src/DisplayNames/CanonicalCodeForDisplayNames.d.ts.map +1 -0
  173. package/src/DisplayNames/CanonicalCodeForDisplayNames.js +37 -0
  174. package/src/GetOption.js +2 -5
  175. package/src/IsValidTimeZoneName.d.ts +10 -0
  176. package/src/IsValidTimeZoneName.d.ts.map +1 -0
  177. package/src/IsValidTimeZoneName.js +15 -0
  178. package/src/NumberFormat/ComputeExponent.d.ts +12 -0
  179. package/src/NumberFormat/ComputeExponent.d.ts.map +1 -0
  180. package/src/NumberFormat/ComputeExponent.js +43 -0
  181. package/src/NumberFormat/ComputeExponentForMagnitude.d.ts +10 -0
  182. package/src/NumberFormat/ComputeExponentForMagnitude.d.ts.map +1 -0
  183. package/src/NumberFormat/ComputeExponentForMagnitude.js +64 -0
  184. package/src/NumberFormat/CurrencyDigits.d.ts +7 -0
  185. package/src/NumberFormat/CurrencyDigits.d.ts.map +1 -0
  186. package/src/NumberFormat/CurrencyDigits.js +14 -0
  187. package/src/NumberFormat/FormatNumericToParts.d.ts +5 -0
  188. package/src/NumberFormat/FormatNumericToParts.d.ts.map +1 -0
  189. package/src/NumberFormat/FormatNumericToParts.js +18 -0
  190. package/src/NumberFormat/FormatNumericToString.js +2 -5
  191. package/src/NumberFormat/InitializeNumberFormat.d.ts +13 -0
  192. package/src/NumberFormat/InitializeNumberFormat.d.ts.map +1 -0
  193. package/src/NumberFormat/InitializeNumberFormat.js +75 -0
  194. package/src/NumberFormat/PartitionNumberPattern.d.ts +8 -0
  195. package/src/NumberFormat/PartitionNumberPattern.d.ts.map +1 -0
  196. package/src/NumberFormat/PartitionNumberPattern.js +81 -0
  197. package/src/NumberFormat/SetNumberFormatUnitOptions.d.ts +8 -0
  198. package/src/NumberFormat/SetNumberFormatUnitOptions.d.ts.map +1 -0
  199. package/src/NumberFormat/SetNumberFormatUnitOptions.js +43 -0
  200. package/src/NumberFormat/digit-mapping.json +1 -0
  201. package/src/NumberFormat/format_to_parts.d.ts +22 -0
  202. package/src/NumberFormat/format_to_parts.d.ts.map +1 -0
  203. package/src/NumberFormat/format_to_parts.js +443 -0
  204. package/src/PluralRules/GetOperands.d.ts +32 -0
  205. package/src/PluralRules/GetOperands.d.ts.map +1 -0
  206. package/src/PluralRules/GetOperands.js +51 -0
  207. package/src/PluralRules/InitializePluralRules.d.ts +9 -0
  208. package/src/PluralRules/InitializePluralRules.d.ts.map +1 -0
  209. package/src/PluralRules/InitializePluralRules.js +24 -0
  210. package/src/PluralRules/ResolvePlural.d.ts +13 -0
  211. package/src/PluralRules/ResolvePlural.d.ts.map +1 -0
  212. package/src/PluralRules/ResolvePlural.js +29 -0
  213. package/src/RelativeTimeFormat/FormatRelativeTime.d.ts +5 -0
  214. package/src/RelativeTimeFormat/FormatRelativeTime.d.ts.map +1 -0
  215. package/src/RelativeTimeFormat/FormatRelativeTime.js +14 -0
  216. package/src/RelativeTimeFormat/FormatRelativeTimeToParts.d.ts +5 -0
  217. package/src/RelativeTimeFormat/FormatRelativeTimeToParts.d.ts.map +1 -0
  218. package/src/RelativeTimeFormat/FormatRelativeTimeToParts.js +22 -0
  219. package/src/RelativeTimeFormat/InitializeRelativeTimeFormat.d.ts +9 -0
  220. package/src/RelativeTimeFormat/InitializeRelativeTimeFormat.d.ts.map +1 -0
  221. package/src/RelativeTimeFormat/InitializeRelativeTimeFormat.js +36 -0
  222. package/src/RelativeTimeFormat/MakePartsList.d.ts +3 -0
  223. package/src/RelativeTimeFormat/MakePartsList.d.ts.map +1 -0
  224. package/src/RelativeTimeFormat/MakePartsList.js +31 -0
  225. package/src/RelativeTimeFormat/PartitionRelativeTimePattern.d.ts +5 -0
  226. package/src/RelativeTimeFormat/PartitionRelativeTimePattern.d.ts.map +1 -0
  227. package/src/RelativeTimeFormat/PartitionRelativeTimePattern.js +58 -0
  228. package/src/RelativeTimeFormat/SingularRelativeTimeUnit.d.ts +7 -0
  229. package/src/RelativeTimeFormat/SingularRelativeTimeUnit.d.ts.map +1 -0
  230. package/src/RelativeTimeFormat/SingularRelativeTimeUnit.js +40 -0
  231. package/src/SupportedLocales.js +2 -5
  232. package/src/data.js +1 -1
  233. package/types/date-time.d.ts +112 -0
  234. package/types/date-time.d.ts.map +1 -0
  235. package/types/date-time.js +2 -0
  236. package/types/number.d.ts +44 -0
  237. package/types/number.d.ts.map +1 -1
  238. package/types/plural-rules.d.ts +6 -0
  239. package/types/plural-rules.d.ts.map +1 -1
  240. package/types/relative-time.d.ts +63 -0
  241. package/types/relative-time.d.ts.map +1 -1
  242. package/types.js +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComputeExponent.d.ts","sourceRoot":"","sources":["../../../../../../../packages/ecma402-abstract/src/NumberFormat/ComputeExponent.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,oBAAoB,EAAC,MAAM,oBAAoB,CAAC;AAExD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,YAAY,EAAE,IAAI,CAAC,YAAY,EAC/B,CAAC,EAAE,MAAM,EACT,EACE,gBAAgB,GACjB,EAAE;IAAC,gBAAgB,CAAC,EAAE,EAAE,IAAI,CAAC,YAAY,GAAG,oBAAoB,CAAA;CAAC,GACjE,CAAC,MAAM,EAAE,MAAM,CAAC,CA8BlB"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ComputeExponent = void 0;
4
+ var utils_1 = require("../utils");
5
+ var ComputeExponentForMagnitude_1 = require("./ComputeExponentForMagnitude");
6
+ var FormatNumericToString_1 = require("./FormatNumericToString");
7
+ /**
8
+ * The abstract operation ComputeExponent computes an exponent (power of ten) by which to scale x
9
+ * according to the number formatting settings. It handles cases such as 999 rounding up to 1000,
10
+ * requiring a different exponent.
11
+ *
12
+ * NOT IN SPEC: it returns [exponent, magnitude].
13
+ */
14
+ function ComputeExponent(numberFormat, x, _a) {
15
+ var getInternalSlots = _a.getInternalSlots;
16
+ if (x === 0) {
17
+ return [0, 0];
18
+ }
19
+ if (x < 0) {
20
+ x = -x;
21
+ }
22
+ var magnitude = utils_1.getMagnitude(x);
23
+ var exponent = ComputeExponentForMagnitude_1.ComputeExponentForMagnitude(numberFormat, magnitude, {
24
+ getInternalSlots: getInternalSlots,
25
+ });
26
+ // Preserve more precision by doing multiplication when exponent is negative.
27
+ x = exponent < 0 ? x * Math.pow(10, -exponent) : x / Math.pow(10, exponent);
28
+ var formatNumberResult = FormatNumericToString_1.FormatNumericToString(getInternalSlots(numberFormat), x);
29
+ if (formatNumberResult.roundedNumber === 0) {
30
+ return [exponent, magnitude];
31
+ }
32
+ var newMagnitude = utils_1.getMagnitude(formatNumberResult.roundedNumber);
33
+ if (newMagnitude === magnitude - exponent) {
34
+ return [exponent, magnitude];
35
+ }
36
+ return [
37
+ ComputeExponentForMagnitude_1.ComputeExponentForMagnitude(numberFormat, magnitude + 1, {
38
+ getInternalSlots: getInternalSlots,
39
+ }),
40
+ magnitude + 1,
41
+ ];
42
+ }
43
+ exports.ComputeExponent = ComputeExponent;
@@ -0,0 +1,10 @@
1
+ import { NumberFormatInternal } from '../../types/number';
2
+ /**
3
+ * The abstract operation ComputeExponentForMagnitude computes an exponent by which to scale a
4
+ * number of the given magnitude (power of ten of the most significant digit) according to the
5
+ * locale and the desired notation (scientific, engineering, or compact).
6
+ */
7
+ export declare function ComputeExponentForMagnitude(numberFormat: Intl.NumberFormat, magnitude: number, { getInternalSlots, }: {
8
+ getInternalSlots(nf: Intl.NumberFormat): NumberFormatInternal;
9
+ }): number;
10
+ //# sourceMappingURL=ComputeExponentForMagnitude.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComputeExponentForMagnitude.d.ts","sourceRoot":"","sources":["../../../../../../../packages/ecma402-abstract/src/NumberFormat/ComputeExponentForMagnitude.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAmB,MAAM,oBAAoB,CAAC;AAE1E;;;;GAIG;AACH,wBAAgB,2BAA2B,CACzC,YAAY,EAAE,IAAI,CAAC,YAAY,EAC/B,SAAS,EAAE,MAAM,EACjB,EACE,gBAAgB,GACjB,EAAE;IAAC,gBAAgB,CAAC,EAAE,EAAE,IAAI,CAAC,YAAY,GAAG,oBAAoB,CAAA;CAAC,GACjE,MAAM,CAyDR"}
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ComputeExponentForMagnitude = void 0;
4
+ /**
5
+ * The abstract operation ComputeExponentForMagnitude computes an exponent by which to scale a
6
+ * number of the given magnitude (power of ten of the most significant digit) according to the
7
+ * locale and the desired notation (scientific, engineering, or compact).
8
+ */
9
+ function ComputeExponentForMagnitude(numberFormat, magnitude, _a) {
10
+ var getInternalSlots = _a.getInternalSlots;
11
+ var internalSlots = getInternalSlots(numberFormat);
12
+ var notation = internalSlots.notation, dataLocaleData = internalSlots.dataLocaleData, numberingSystem = internalSlots.numberingSystem;
13
+ switch (notation) {
14
+ case 'standard':
15
+ return 0;
16
+ case 'scientific':
17
+ return magnitude;
18
+ case 'engineering':
19
+ return Math.floor(magnitude / 3) * 3;
20
+ default: {
21
+ // Let exponent be an implementation- and locale-dependent (ILD) integer by which to scale a
22
+ // number of the given magnitude in compact notation for the current locale.
23
+ var compactDisplay = internalSlots.compactDisplay, style = internalSlots.style, currencyDisplay = internalSlots.currencyDisplay;
24
+ var thresholdMap = void 0;
25
+ if (style === 'currency' && currencyDisplay !== 'name') {
26
+ var currency = dataLocaleData.numbers.currency[numberingSystem] ||
27
+ dataLocaleData.numbers.currency[dataLocaleData.numbers.nu[0]];
28
+ thresholdMap = currency.short;
29
+ }
30
+ else {
31
+ var decimal = dataLocaleData.numbers.decimal[numberingSystem] ||
32
+ dataLocaleData.numbers.decimal[dataLocaleData.numbers.nu[0]];
33
+ thresholdMap = compactDisplay === 'long' ? decimal.long : decimal.short;
34
+ }
35
+ if (!thresholdMap) {
36
+ return 0;
37
+ }
38
+ var num = String(Math.pow(10, magnitude));
39
+ var thresholds = Object.keys(thresholdMap); // TODO: this can be pre-processed
40
+ if (num < thresholds[0]) {
41
+ return 0;
42
+ }
43
+ if (num > thresholds[thresholds.length - 1]) {
44
+ return thresholds[thresholds.length - 1].length - 1;
45
+ }
46
+ var i = thresholds.indexOf(num);
47
+ if (i === -1) {
48
+ return 0;
49
+ }
50
+ // See https://unicode.org/reports/tr35/tr35-numbers.html#Compact_Number_Formats
51
+ // Special handling if the pattern is precisely `0`.
52
+ var magnitudeKey = thresholds[i];
53
+ // TODO: do we need to handle plural here?
54
+ var compactPattern = thresholdMap[magnitudeKey].other;
55
+ if (compactPattern === '0') {
56
+ return 0;
57
+ }
58
+ // Example: in zh-TW, `10000000` maps to `0000萬`. So we need to return 8 - 4 = 4 here.
59
+ return (magnitudeKey.length -
60
+ thresholdMap[magnitudeKey].other.match(/0+/)[0].length);
61
+ }
62
+ }
63
+ }
64
+ exports.ComputeExponentForMagnitude = ComputeExponentForMagnitude;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * https://tc39.es/ecma402/#sec-currencydigits
3
+ */
4
+ export declare function CurrencyDigits(c: string, { currencyDigitsData }: {
5
+ currencyDigitsData: Record<string, number>;
6
+ }): number;
7
+ //# sourceMappingURL=CurrencyDigits.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CurrencyDigits.d.ts","sourceRoot":"","sources":["../../../../../../../packages/ecma402-abstract/src/NumberFormat/CurrencyDigits.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,cAAc,CAC5B,CAAC,EAAE,MAAM,EACT,EAAC,kBAAkB,EAAC,EAAE;IAAC,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAC,GACjE,MAAM,CAIR"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CurrencyDigits = void 0;
4
+ var _262_1 = require("../../262");
5
+ /**
6
+ * https://tc39.es/ecma402/#sec-currencydigits
7
+ */
8
+ function CurrencyDigits(c, _a) {
9
+ var currencyDigitsData = _a.currencyDigitsData;
10
+ return _262_1.HasOwnProperty(currencyDigitsData, c)
11
+ ? currencyDigitsData[c]
12
+ : 2;
13
+ }
14
+ exports.CurrencyDigits = CurrencyDigits;
@@ -0,0 +1,5 @@
1
+ import { NumberFormatInternal, NumberFormatPart } from '../../types/number';
2
+ export declare function FormatNumericToParts(nf: Intl.NumberFormat, x: number, implDetails: {
3
+ getInternalSlots(nf: Intl.NumberFormat): NumberFormatInternal;
4
+ }): NumberFormatPart[];
5
+ //# sourceMappingURL=FormatNumericToParts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormatNumericToParts.d.ts","sourceRoot":"","sources":["../../../../../../../packages/ecma402-abstract/src/NumberFormat/FormatNumericToParts.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,oBAAoB,EAAE,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AAE1E,wBAAgB,oBAAoB,CAClC,EAAE,EAAE,IAAI,CAAC,YAAY,EACrB,CAAC,EAAE,MAAM,EACT,WAAW,EAAE;IACX,gBAAgB,CAAC,EAAE,EAAE,IAAI,CAAC,YAAY,GAAG,oBAAoB,CAAC;CAC/D,GACA,gBAAgB,EAAE,CAWpB"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FormatNumericToParts = void 0;
4
+ var PartitionNumberPattern_1 = require("./PartitionNumberPattern");
5
+ var _262_1 = require("../../262");
6
+ function FormatNumericToParts(nf, x, implDetails) {
7
+ var parts = PartitionNumberPattern_1.PartitionNumberPattern(nf, x, implDetails);
8
+ var result = _262_1.ArrayCreate(0);
9
+ for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {
10
+ var part = parts_1[_i];
11
+ result.push({
12
+ type: part.type,
13
+ value: part.value,
14
+ });
15
+ }
16
+ return result;
17
+ }
18
+ exports.FormatNumericToParts = FormatNumericToParts;
@@ -1,10 +1,7 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.FormatNumericToString = void 0;
7
- var SameValue_1 = __importDefault(require("es-abstract/5/SameValue"));
4
+ var _262_1 = require("../../262");
8
5
  var ToRawPrecision_1 = require("./ToRawPrecision");
9
6
  var utils_1 = require("../utils");
10
7
  var ToRawFixed_1 = require("./ToRawFixed");
@@ -12,7 +9,7 @@ var ToRawFixed_1 = require("./ToRawFixed");
12
9
  * https://tc39.es/ecma402/#sec-formatnumberstring
13
10
  */
14
11
  function FormatNumericToString(intlObject, x) {
15
- var isNegative = x < 0 || SameValue_1.default(x, -0);
12
+ var isNegative = x < 0 || _262_1.SameValue(x, -0);
16
13
  if (isNegative) {
17
14
  x = -x;
18
15
  }
@@ -0,0 +1,13 @@
1
+ import { NumberFormatInternal, NumberFormatOptions, NumberFormatLocaleInternalData } from '../../types/number';
2
+ /**
3
+ * https://tc39.es/ecma402/#sec-initializenumberformat
4
+ */
5
+ export declare function InitializeNumberFormat(nf: Intl.NumberFormat, locales: string | string[] | undefined, opts: NumberFormatOptions | undefined, { getInternalSlots, localeData, availableLocales, numberingSystemNames, getDefaultLocale, currencyDigitsData, }: {
6
+ getInternalSlots(nf: Intl.NumberFormat): NumberFormatInternal;
7
+ localeData: Record<string, NumberFormatLocaleInternalData>;
8
+ availableLocales: string[];
9
+ numberingSystemNames: string[];
10
+ getDefaultLocale(): string;
11
+ currencyDigitsData: Record<string, number>;
12
+ }): Intl.NumberFormat;
13
+ //# sourceMappingURL=InitializeNumberFormat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InitializeNumberFormat.d.ts","sourceRoot":"","sources":["../../../../../../../packages/ecma402-abstract/src/NumberFormat/InitializeNumberFormat.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,8BAA8B,EAC/B,MAAM,oBAAoB,CAAC;AAmB5B;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,EAAE,EAAE,IAAI,CAAC,YAAY,EACrB,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,EACtC,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,CAAC;IAC9D,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,8BAA8B,CAAC,CAAC;IAC3D,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B,gBAAgB,IAAI,MAAM,CAAC;IAC3B,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC5C,qBAgHF"}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InitializeNumberFormat = void 0;
4
+ var CanonicalizeLocaleList_1 = require("../CanonicalizeLocaleList");
5
+ var _262_1 = require("../../262");
6
+ var GetOption_1 = require("../GetOption");
7
+ var ResolveLocale_1 = require("../ResolveLocale");
8
+ var SetNumberFormatUnitOptions_1 = require("./SetNumberFormatUnitOptions");
9
+ var CurrencyDigits_1 = require("./CurrencyDigits");
10
+ var SetNumberFormatDigitOptions_1 = require("./SetNumberFormatDigitOptions");
11
+ /**
12
+ * Chop off the unicode extension from the locale string.
13
+ */
14
+ function removeUnicodeExtensionFromLocale(canonicalLocale) {
15
+ var extensionIndex = canonicalLocale.indexOf('-u-');
16
+ return extensionIndex >= 0
17
+ ? canonicalLocale.slice(0, extensionIndex)
18
+ : canonicalLocale;
19
+ }
20
+ /**
21
+ * https://tc39.es/ecma402/#sec-initializenumberformat
22
+ */
23
+ function InitializeNumberFormat(nf, locales, opts, _a) {
24
+ var getInternalSlots = _a.getInternalSlots, localeData = _a.localeData, availableLocales = _a.availableLocales, numberingSystemNames = _a.numberingSystemNames, getDefaultLocale = _a.getDefaultLocale, currencyDigitsData = _a.currencyDigitsData;
25
+ // @ts-ignore
26
+ var requestedLocales = CanonicalizeLocaleList_1.CanonicalizeLocaleList(locales);
27
+ var options = opts === undefined ? Object.create(null) : _262_1.ToObject(opts);
28
+ var opt = Object.create(null);
29
+ var matcher = GetOption_1.GetOption(options, 'localeMatcher', 'string', ['lookup', 'best fit'], 'best fit');
30
+ opt.localeMatcher = matcher;
31
+ var numberingSystem = GetOption_1.GetOption(options, 'numberingSystem', 'string', undefined, undefined);
32
+ if (numberingSystem !== undefined &&
33
+ numberingSystemNames.indexOf(numberingSystem) < 0) {
34
+ // 8.a. If numberingSystem does not match the Unicode Locale Identifier type nonterminal,
35
+ // throw a RangeError exception.
36
+ throw RangeError("Invalid numberingSystems: " + numberingSystem);
37
+ }
38
+ opt.nu = numberingSystem;
39
+ var r = ResolveLocale_1.ResolveLocale(availableLocales, requestedLocales, opt,
40
+ // [[RelevantExtensionKeys]] slot, which is a constant
41
+ ['nu'], localeData, getDefaultLocale);
42
+ var dataLocaleData = localeData[removeUnicodeExtensionFromLocale(r.locale)];
43
+ var internalSlots = getInternalSlots(nf);
44
+ internalSlots.locale = r.locale;
45
+ internalSlots.dataLocale = r.dataLocale;
46
+ internalSlots.numberingSystem = r.nu;
47
+ internalSlots.dataLocaleData = dataLocaleData;
48
+ SetNumberFormatUnitOptions_1.SetNumberFormatUnitOptions(nf, options, { getInternalSlots: getInternalSlots });
49
+ var style = internalSlots.style;
50
+ var mnfdDefault;
51
+ var mxfdDefault;
52
+ if (style === 'currency') {
53
+ var currency = internalSlots.currency;
54
+ var cDigits = CurrencyDigits_1.CurrencyDigits(currency, { currencyDigitsData: currencyDigitsData });
55
+ mnfdDefault = cDigits;
56
+ mxfdDefault = cDigits;
57
+ }
58
+ else {
59
+ mnfdDefault = 0;
60
+ mxfdDefault = style === 'percent' ? 0 : 3;
61
+ }
62
+ var notation = GetOption_1.GetOption(options, 'notation', 'string', ['standard', 'scientific', 'engineering', 'compact'], 'standard');
63
+ internalSlots.notation = notation;
64
+ SetNumberFormatDigitOptions_1.SetNumberFormatDigitOptions(internalSlots, options, mnfdDefault, mxfdDefault, notation);
65
+ var compactDisplay = GetOption_1.GetOption(options, 'compactDisplay', 'string', ['short', 'long'], 'short');
66
+ if (notation === 'compact') {
67
+ internalSlots.compactDisplay = compactDisplay;
68
+ }
69
+ var useGrouping = GetOption_1.GetOption(options, 'useGrouping', 'boolean', undefined, true);
70
+ internalSlots.useGrouping = useGrouping;
71
+ var signDisplay = GetOption_1.GetOption(options, 'signDisplay', 'string', ['auto', 'never', 'always', 'exceptZero'], 'auto');
72
+ internalSlots.signDisplay = signDisplay;
73
+ return nf;
74
+ }
75
+ exports.InitializeNumberFormat = InitializeNumberFormat;
@@ -0,0 +1,8 @@
1
+ import { NumberFormatInternal } from '../../types/number';
2
+ /**
3
+ * https://tc39.es/ecma402/#sec-formatnumberstring
4
+ */
5
+ export declare function PartitionNumberPattern(numberFormat: Intl.NumberFormat, x: number, { getInternalSlots, }: {
6
+ getInternalSlots(nf: Intl.NumberFormat): NumberFormatInternal;
7
+ }): import("../../types/number").NumberFormatPart[];
8
+ //# sourceMappingURL=PartitionNumberPattern.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PartitionNumberPattern.d.ts","sourceRoot":"","sources":["../../../../../../../packages/ecma402-abstract/src/NumberFormat/PartitionNumberPattern.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,oBAAoB,CAAC;AAMxD;;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,CAAC;CAC/D,mDAqEF"}
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.PartitionNumberPattern = void 0;
7
+ var FormatNumericToString_1 = require("./FormatNumericToString");
8
+ var _262_1 = require("../../262");
9
+ var ComputeExponent_1 = require("./ComputeExponent");
10
+ var format_to_parts_1 = __importDefault(require("./format_to_parts"));
11
+ /**
12
+ * https://tc39.es/ecma402/#sec-formatnumberstring
13
+ */
14
+ function PartitionNumberPattern(numberFormat, x, _a) {
15
+ var _b;
16
+ var getInternalSlots = _a.getInternalSlots;
17
+ var internalSlots = getInternalSlots(numberFormat);
18
+ var pl = internalSlots.pl, dataLocaleData = internalSlots.dataLocaleData, numberingSystem = internalSlots.numberingSystem;
19
+ var symbols = dataLocaleData.numbers.symbols[numberingSystem] ||
20
+ dataLocaleData.numbers.symbols[dataLocaleData.numbers.nu[0]];
21
+ var magnitude = 0;
22
+ var exponent = 0;
23
+ var n;
24
+ if (isNaN(x)) {
25
+ n = symbols.nan;
26
+ }
27
+ else if (!isFinite(x)) {
28
+ n = symbols.infinity;
29
+ }
30
+ else {
31
+ if (internalSlots.style === 'percent') {
32
+ x *= 100;
33
+ }
34
+ _b = ComputeExponent_1.ComputeExponent(numberFormat, x, {
35
+ getInternalSlots: getInternalSlots,
36
+ }), exponent = _b[0], magnitude = _b[1];
37
+ // Preserve more precision by doing multiplication when exponent is negative.
38
+ x = exponent < 0 ? x * Math.pow(10, -exponent) : x / Math.pow(10, exponent);
39
+ var formatNumberResult = FormatNumericToString_1.FormatNumericToString(internalSlots, x);
40
+ n = formatNumberResult.formattedString;
41
+ x = formatNumberResult.roundedNumber;
42
+ }
43
+ // Based on https://tc39.es/ecma402/#sec-getnumberformatpattern
44
+ // We need to do this before `x` is rounded.
45
+ var sign;
46
+ var signDisplay = internalSlots.signDisplay;
47
+ switch (signDisplay) {
48
+ case 'never':
49
+ sign = 0;
50
+ break;
51
+ case 'auto':
52
+ if (_262_1.SameValue(x, 0) || x > 0 || isNaN(x)) {
53
+ sign = 0;
54
+ }
55
+ else {
56
+ sign = -1;
57
+ }
58
+ break;
59
+ case 'always':
60
+ if (_262_1.SameValue(x, 0) || x > 0 || isNaN(x)) {
61
+ sign = 1;
62
+ }
63
+ else {
64
+ sign = -1;
65
+ }
66
+ break;
67
+ default:
68
+ // x === 0 -> x is 0 or x is -0
69
+ if (x === 0 || isNaN(x)) {
70
+ sign = 0;
71
+ }
72
+ else if (x > 0) {
73
+ sign = 1;
74
+ }
75
+ else {
76
+ sign = -1;
77
+ }
78
+ }
79
+ return format_to_parts_1.default({ roundedNumber: x, formattedString: n, exponent: exponent, magnitude: magnitude, sign: sign }, internalSlots.dataLocaleData, pl, internalSlots);
80
+ }
81
+ exports.PartitionNumberPattern = PartitionNumberPattern;
@@ -0,0 +1,8 @@
1
+ import { NumberFormatInternal, NumberFormatOptions } from '../../types/number';
2
+ /**
3
+ * https://tc39.es/ecma402/#sec-setnumberformatunitoptions
4
+ */
5
+ export declare function SetNumberFormatUnitOptions(nf: Intl.NumberFormat, options: NumberFormatOptions | undefined, { getInternalSlots, }: {
6
+ getInternalSlots(nf: Intl.NumberFormat): NumberFormatInternal;
7
+ }): void;
8
+ //# sourceMappingURL=SetNumberFormatUnitOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SetNumberFormatUnitOptions.d.ts","sourceRoot":"","sources":["../../../../../../../packages/ecma402-abstract/src/NumberFormat/SetNumberFormatUnitOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAE,mBAAmB,EAAC,MAAM,oBAAoB,CAAC;AAK7E;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,EAAE,EAAE,IAAI,CAAC,YAAY,EACrB,OAAO,iCAA2C,EAClD,EACE,gBAAgB,GACjB,EAAE;IAAC,gBAAgB,CAAC,EAAE,EAAE,IAAI,CAAC,YAAY,GAAG,oBAAoB,CAAA;CAAC,QA+DnE"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SetNumberFormatUnitOptions = void 0;
4
+ var GetOption_1 = require("../GetOption");
5
+ var IsWellFormedCurrencyCode_1 = require("../IsWellFormedCurrencyCode");
6
+ var IsWellFormedUnitIdentifier_1 = require("../IsWellFormedUnitIdentifier");
7
+ /**
8
+ * https://tc39.es/ecma402/#sec-setnumberformatunitoptions
9
+ */
10
+ function SetNumberFormatUnitOptions(nf, options, _a) {
11
+ if (options === void 0) { options = Object.create(null); }
12
+ var getInternalSlots = _a.getInternalSlots;
13
+ var internalSlots = getInternalSlots(nf);
14
+ var style = GetOption_1.GetOption(options, 'style', 'string', ['decimal', 'percent', 'currency', 'unit'], 'decimal');
15
+ internalSlots.style = style;
16
+ var currency = GetOption_1.GetOption(options, 'currency', 'string', undefined, undefined);
17
+ if (currency !== undefined && !IsWellFormedCurrencyCode_1.IsWellFormedCurrencyCode(currency)) {
18
+ throw RangeError('Malformed currency code');
19
+ }
20
+ if (style === 'currency' && currency === undefined) {
21
+ throw TypeError('currency cannot be undefined');
22
+ }
23
+ var currencyDisplay = GetOption_1.GetOption(options, 'currencyDisplay', 'string', ['code', 'symbol', 'narrowSymbol', 'name'], 'symbol');
24
+ var currencySign = GetOption_1.GetOption(options, 'currencySign', 'string', ['standard', 'accounting'], 'standard');
25
+ var unit = GetOption_1.GetOption(options, 'unit', 'string', undefined, undefined);
26
+ if (unit !== undefined && !IsWellFormedUnitIdentifier_1.IsWellFormedUnitIdentifier(unit)) {
27
+ throw RangeError('Invalid unit argument for Intl.NumberFormat()');
28
+ }
29
+ if (style === 'unit' && unit === undefined) {
30
+ throw TypeError('unit cannot be undefined');
31
+ }
32
+ var unitDisplay = GetOption_1.GetOption(options, 'unitDisplay', 'string', ['short', 'narrow', 'long'], 'short');
33
+ if (style === 'currency') {
34
+ internalSlots.currency = currency.toUpperCase();
35
+ internalSlots.currencyDisplay = currencyDisplay;
36
+ internalSlots.currencySign = currencySign;
37
+ }
38
+ if (style === 'unit') {
39
+ internalSlots.unit = unit;
40
+ internalSlots.unitDisplay = unitDisplay;
41
+ }
42
+ }
43
+ exports.SetNumberFormatUnitOptions = SetNumberFormatUnitOptions;
@@ -0,0 +1 @@
1
+ { "adlm": ["𞥐", "𞥑", "𞥒", "𞥓", "𞥔", "𞥕", "𞥖", "𞥗", "𞥘", "𞥙"], "ahom": ["𑜰", "𑜱", "𑜲", "𑜳", "𑜴", "𑜵", "𑜶", "𑜷", "𑜸", "𑜹"], "arab": ["٠", "١", "٢", "٣", "٤", "٥", "٦", "٧", "٨", "٩"], "arabext": ["۰", "۱", "۲", "۳", "۴", "۵", "۶", "۷", "۸", "۹"], "bali": ["᭐", "᭑", "᭒", "᭓", "᭔", "᭕", "᭖", "᭗", "᭘", "᭙"], "beng": ["০", "১", "২", "৩", "৪", "৫", "৬", "৭", "৮", "৯"], "bhks": ["𑱐", "𑱑", "𑱒", "𑱓", "𑱔", "𑱕", "𑱖", "𑱗", "𑱘", "𑱙"], "brah": ["𑁦", "𑁧", "𑁨", "𑁩", "𑁪", "𑁫", "𑁬", "𑁭", "𑁮", "𑁯"], "cakm": ["𑄶", "𑄷", "𑄸", "𑄹", "𑄺", "𑄻", "𑄼", "𑄽", "𑄾", "𑄿"], "cham": ["꩐", "꩑", "꩒", "꩓", "꩔", "꩕", "꩖", "꩗", "꩘", "꩙"], "deva": ["०", "१", "२", "३", "४", "५", "६", "७", "८", "९"], "diak": ["𑥐", "𑥑", "𑥒", "𑥓", "𑥔", "𑥕", "𑥖", "𑥗", "𑥘", "𑥙"], "fullwide": ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], "gong": ["𑶠", "𑶡", "𑶢", "𑶣", "𑶤", "𑶥", "𑶦", "𑶧", "𑶨", "𑶩"], "gonm": ["𑵐", "𑵑", "𑵒", "𑵓", "𑵔", "𑵕", "𑵖", "𑵗", "𑵘", "𑵙"], "gujr": ["૦", "૧", "૨", "૩", "૪", "૫", "૬", "૭", "૮", "૯"], "guru": ["੦", "੧", "੨", "੩", "੪", "੫", "੬", "੭", "੮", "੯"], "hanidec": ["〇", "一", "二", "三", "四", "五", "六", "七", "八", "九"], "hmng": ["𖭐", "𖭑", "𖭒", "𖭓", "𖭔", "𖭕", "𖭖", "𖭗", "𖭘", "𖭙"], "hmnp": ["𞅀", "𞅁", "𞅂", "𞅃", "𞅄", "𞅅", "𞅆", "𞅇", "𞅈", "𞅉"], "java": ["꧐", "꧑", "꧒", "꧓", "꧔", "꧕", "꧖", "꧗", "꧘", "꧙"], "kali": ["꤀", "꤁", "꤂", "꤃", "꤄", "꤅", "꤆", "꤇", "꤈", "꤉"], "khmr": ["០", "១", "២", "៣", "៤", "៥", "៦", "៧", "៨", "៩"], "knda": ["೦", "೧", "೨", "೩", "೪", "೫", "೬", "೭", "೮", "೯"], "lana": ["᪀", "᪁", "᪂", "᪃", "᪄", "᪅", "᪆", "᪇", "᪈", "᪉"], "lanatham": ["᪐", "᪑", "᪒", "᪓", "᪔", "᪕", "᪖", "᪗", "᪘", "᪙"], "laoo": ["໐", "໑", "໒", "໓", "໔", "໕", "໖", "໗", "໘", "໙"], "lepc": ["᪐", "᪑", "᪒", "᪓", "᪔", "᪕", "᪖", "᪗", "᪘", "᪙"], "limb": ["᥆", "᥇", "᥈", "᥉", "᥊", "᥋", "᥌", "᥍", "᥎", "᥏"], "mathbold": ["𝟎", "𝟏", "𝟐", "𝟑", "𝟒", "𝟓", "𝟔", "𝟕", "𝟖", "𝟗"], "mathdbl": ["𝟘", "𝟙", "𝟚", "𝟛", "𝟜", "𝟝", "𝟞", "𝟟", "𝟠", "𝟡"], "mathmono": ["𝟶", "𝟷", "𝟸", "𝟹", "𝟺", "𝟻", "𝟼", "𝟽", "𝟾", "𝟿"], "mathsanb": ["𝟬", "𝟭", "𝟮", "𝟯", "𝟰", "𝟱", "𝟲", "𝟳", "𝟴", "𝟵"], "mathsans": ["𝟢", "𝟣", "𝟤", "𝟥", "𝟦", "𝟧", "𝟨", "𝟩", "𝟪", "𝟫"], "mlym": ["൦", "൧", "൨", "൩", "൪", "൫", "൬", "൭", "൮", "൯"], "modi": ["𑙐", "𑙑", "𑙒", "𑙓", "𑙔", "𑙕", "𑙖", "𑙗", "𑙘", "𑙙"], "mong": ["᠐", "᠑", "᠒", "᠓", "᠔", "᠕", "᠖", "᠗", "᠘", "᠙"], "mroo": ["𖩠", "𖩡", "𖩢", "𖩣", "𖩤", "𖩥", "𖩦", "𖩧", "𖩨", "𖩩"], "mtei": ["꯰", "꯱", "꯲", "꯳", "꯴", "꯵", "꯶", "꯷", "꯸", "꯹"], "mymr": ["၀", "၁", "၂", "၃", "၄", "၅", "၆", "၇", "၈", "၉"], "mymrshan": ["႐", "႑", "႒", "႓", "႔", "႕", "႖", "႗", "႘", "႙"], "mymrtlng": ["꧰", "꧱", "꧲", "꧳", "꧴", "꧵", "꧶", "꧷", "꧸", "꧹"], "newa": ["𑑐", "𑑑", "𑑒", "𑑓", "𑑔", "𑑕", "𑑖", "𑑗", "𑑘", "𑑙"], "nkoo": ["߀", "߁", "߂", "߃", "߄", "߅", "߆", "߇", "߈", "߉"], "olck": ["᱐", "᱑", "᱒", "᱓", "᱔", "᱕", "᱖", "᱗", "᱘", "᱙"], "orya": ["୦", "୧", "୨", "୩", "୪", "୫", "୬", "୭", "୮", "୯"], "osma": ["𐒠", "𐒡", "𐒢", "𐒣", "𐒤", "𐒥", "𐒦", "𐒧", "𐒨", "𐒩"], "rohg": ["𐴰", "𐴱", "𐴲", "𐴳", "𐴴", "𐴵", "𐴶", "𐴷", "𐴸", "𐴹"], "saur": ["꣐", "꣑", "꣒", "꣓", "꣔", "꣕", "꣖", "꣗", "꣘", "꣙"], "segment": ["🯰", "🯱", "🯲", "🯳", "🯴", "🯵", "🯶", "🯷", "🯸", "🯹"], "shrd": ["𑇐", "𑇑", "𑇒", "𑇓", "𑇔", "𑇕", "𑇖", "𑇗", "𑇘", "𑇙"], "sind": ["𑋰", "𑋱", "𑋲", "𑋳", "𑋴", "𑋵", "𑋶", "𑋷", "𑋸", "𑋹"], "sinh": ["෦", "෧", "෨", "෩", "෪", "෫", "෬", "෭", "෮", "෯"], "sora": ["𑃰", "𑃱", "𑃲", "𑃳", "𑃴", "𑃵", "𑃶", "𑃷", "𑃸", "𑃹"], "sund": ["᮰", "᮱", "᮲", "᮳", "᮴", "᮵", "᮶", "᮷", "᮸", "᮹"], "takr": ["𑛀", "𑛁", "𑛂", "𑛃", "𑛄", "𑛅", "𑛆", "𑛇", "𑛈", "𑛉"], "talu": ["᧐", "᧑", "᧒", "᧓", "᧔", "᧕", "᧖", "᧗", "᧘", "᧙"], "tamldec": ["௦", "௧", "௨", "௩", "௪", "௫", "௬", "௭", "௮", "௯"], "telu": ["౦", "౧", "౨", "౩", "౪", "౫", "౬", "౭", "౮", "౯"], "thai": ["๐", "๑", "๒", "๓", "๔", "๕", "๖", "๗", "๘", "๙"], "tibt": ["༠", "༡", "༢", "༣", "༤", "༥", "༦", "༧", "༨", "༩"], "tirh": ["𑓐", "𑓑", "𑓒", "𑓓", "𑓔", "𑓕", "𑓖", "𑓗", "𑓘", "𑓙"], "vaii": ["ᘠ", "ᘡ", "ᘢ", "ᘣ", "ᘤ", "ᘥ", "ᘦ", "ᘧ", "ᘨ", "ᘩ"], "wara": ["𑣠", "𑣡", "𑣢", "𑣣", "𑣤", "𑣥", "𑣦", "𑣧", "𑣨", "𑣩"], "wcho": ["𞋰", "𞋱", "𞋲", "𞋳", "𞋴", "𞋵", "𞋶", "𞋷", "𞋸", "𞋹"] }
@@ -0,0 +1,22 @@
1
+ import { NumberFormatOptionsStyle, NumberFormatOptionsNotation, NumberFormatOptionsCompactDisplay, NumberFormatOptionsCurrencyDisplay, NumberFormatOptionsCurrencySign, NumberFormatOptionsUnitDisplay, NumberFormatLocaleInternalData, NumberFormatPart } from '../../types/number';
2
+ interface NumberResult {
3
+ formattedString: string;
4
+ roundedNumber: number;
5
+ sign: -1 | 0 | 1;
6
+ exponent: number;
7
+ magnitude: number;
8
+ }
9
+ export default function formatToParts(numberResult: NumberResult, data: NumberFormatLocaleInternalData, pl: Intl.PluralRules, options: {
10
+ numberingSystem: string;
11
+ useGrouping: boolean;
12
+ style: NumberFormatOptionsStyle;
13
+ notation: NumberFormatOptionsNotation;
14
+ compactDisplay?: NumberFormatOptionsCompactDisplay;
15
+ currency?: string;
16
+ currencyDisplay?: NumberFormatOptionsCurrencyDisplay;
17
+ currencySign?: NumberFormatOptionsCurrencySign;
18
+ unit?: string;
19
+ unitDisplay?: NumberFormatOptionsUnitDisplay;
20
+ }): NumberFormatPart[];
21
+ export {};
22
+ //# sourceMappingURL=format_to_parts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format_to_parts.d.ts","sourceRoot":"","sources":["../../../../../../../packages/ecma402-abstract/src/NumberFormat/format_to_parts.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,2BAA2B,EAC3B,iCAAiC,EACjC,kCAAkC,EAClC,+BAA+B,EAC/B,8BAA8B,EAC9B,8BAA8B,EAM9B,gBAAgB,EACjB,MAAM,oBAAoB,CAAC;AAe5B,UAAU,YAAY;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAEjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;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,CAAC;IACxB,WAAW,EAAE,OAAO,CAAC;IACrB,KAAK,EAAE,wBAAwB,CAAC;IAEhC,QAAQ,EAAE,2BAA2B,CAAC;IAEtC,cAAc,CAAC,EAAE,iCAAiC,CAAC;IAEnD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,kCAAkC,CAAC;IACrD,YAAY,CAAC,EAAE,+BAA+B,CAAC;IAE/C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,8BAA8B,CAAC;CAC9C,GACA,gBAAgB,EAAE,CAySpB"}