@formatjs/ecma402-abstract 1.9.1 → 1.9.5

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 (221) hide show
  1. package/IsValidTimeZoneName.d.ts +1 -1
  2. package/IsValidTimeZoneName.d.ts.map +1 -1
  3. package/IsValidTimeZoneName.js +6 -1
  4. package/NumberFormat/InitializeNumberFormat.d.ts +2 -2
  5. package/NumberFormat/InitializeNumberFormat.d.ts.map +1 -1
  6. package/NumberFormat/InitializeNumberFormat.js +2 -2
  7. package/NumberFormat/digit-mapping.generated.d.ts +2 -0
  8. package/NumberFormat/digit-mapping.generated.d.ts.map +1 -0
  9. package/NumberFormat/digit-mapping.generated.js +4 -0
  10. package/NumberFormat/format_to_parts.js +2 -3
  11. package/SupportedLocales.js +3 -3
  12. package/index.d.ts +1 -24
  13. package/index.d.ts.map +1 -1
  14. package/index.js +13 -39
  15. package/lib/IsValidTimeZoneName.d.ts +1 -1
  16. package/lib/IsValidTimeZoneName.d.ts.map +1 -1
  17. package/lib/IsValidTimeZoneName.js +6 -1
  18. package/lib/NumberFormat/InitializeNumberFormat.d.ts +2 -2
  19. package/lib/NumberFormat/InitializeNumberFormat.d.ts.map +1 -1
  20. package/lib/NumberFormat/InitializeNumberFormat.js +1 -1
  21. package/lib/NumberFormat/digit-mapping.generated.d.ts +2 -0
  22. package/lib/NumberFormat/digit-mapping.generated.d.ts.map +1 -0
  23. package/lib/NumberFormat/digit-mapping.generated.js +1 -0
  24. package/lib/NumberFormat/format_to_parts.js +1 -1
  25. package/lib/SupportedLocales.js +1 -1
  26. package/lib/index.d.ts +1 -24
  27. package/lib/index.d.ts.map +1 -1
  28. package/lib/index.js +1 -24
  29. package/lib/types/date-time.d.ts +1 -0
  30. package/lib/types/date-time.d.ts.map +1 -1
  31. package/package.json +2 -1
  32. package/types/date-time.d.ts +1 -0
  33. package/types/date-time.d.ts.map +1 -1
  34. package/BestAvailableLocale.d.ts +0 -7
  35. package/BestAvailableLocale.d.ts.map +0 -1
  36. package/BestAvailableLocale.js +0 -25
  37. package/BestFitMatcher.d.ts +0 -9
  38. package/BestFitMatcher.d.ts.map +0 -1
  39. package/BestFitMatcher.js +0 -52
  40. package/DateTimeFormat/BasicFormatMatcher.d.ts +0 -8
  41. package/DateTimeFormat/BasicFormatMatcher.d.ts.map +0 -1
  42. package/DateTimeFormat/BasicFormatMatcher.js +0 -61
  43. package/DateTimeFormat/BestFitFormatMatcher.d.ts +0 -17
  44. package/DateTimeFormat/BestFitFormatMatcher.d.ts.map +0 -1
  45. package/DateTimeFormat/BestFitFormatMatcher.js +0 -121
  46. package/DateTimeFormat/DateTimeStyleFormat.d.ts +0 -3
  47. package/DateTimeFormat/DateTimeStyleFormat.d.ts.map +0 -1
  48. package/DateTimeFormat/DateTimeStyleFormat.js +0 -54
  49. package/DateTimeFormat/FormatDateTime.d.ts +0 -8
  50. package/DateTimeFormat/FormatDateTime.d.ts.map +0 -1
  51. package/DateTimeFormat/FormatDateTime.js +0 -19
  52. package/DateTimeFormat/FormatDateTimePattern.d.ts +0 -14
  53. package/DateTimeFormat/FormatDateTimePattern.d.ts.map +0 -1
  54. package/DateTimeFormat/FormatDateTimePattern.js +0 -182
  55. package/DateTimeFormat/FormatDateTimeRange.d.ts +0 -4
  56. package/DateTimeFormat/FormatDateTimeRange.d.ts.map +0 -1
  57. package/DateTimeFormat/FormatDateTimeRange.js +0 -14
  58. package/DateTimeFormat/FormatDateTimeRangeToParts.d.ts +0 -4
  59. package/DateTimeFormat/FormatDateTimeRangeToParts.d.ts.map +0 -1
  60. package/DateTimeFormat/FormatDateTimeRangeToParts.js +0 -18
  61. package/DateTimeFormat/FormatDateTimeToParts.d.ts +0 -11
  62. package/DateTimeFormat/FormatDateTimeToParts.d.ts.map +0 -1
  63. package/DateTimeFormat/FormatDateTimeToParts.js +0 -25
  64. package/DateTimeFormat/InitializeDateTimeFormat.d.ts +0 -18
  65. package/DateTimeFormat/InitializeDateTimeFormat.d.ts.map +0 -1
  66. package/DateTimeFormat/InitializeDateTimeFormat.js +0 -188
  67. package/DateTimeFormat/PartitionDateTimePattern.d.ts +0 -10
  68. package/DateTimeFormat/PartitionDateTimePattern.d.ts.map +0 -1
  69. package/DateTimeFormat/PartitionDateTimePattern.js +0 -24
  70. package/DateTimeFormat/PartitionDateTimeRangePattern.d.ts +0 -5
  71. package/DateTimeFormat/PartitionDateTimeRangePattern.d.ts.map +0 -1
  72. package/DateTimeFormat/PartitionDateTimeRangePattern.js +0 -125
  73. package/DateTimeFormat/ToDateTimeOptions.d.ts +0 -9
  74. package/DateTimeFormat/ToDateTimeOptions.d.ts.map +0 -1
  75. package/DateTimeFormat/ToDateTimeOptions.js +0 -67
  76. package/DateTimeFormat/ToLocalTime.d.ts +0 -26
  77. package/DateTimeFormat/ToLocalTime.d.ts.map +0 -1
  78. package/DateTimeFormat/ToLocalTime.js +0 -55
  79. package/DateTimeFormat/skeleton.d.ts +0 -14
  80. package/DateTimeFormat/skeleton.d.ts.map +0 -1
  81. package/DateTimeFormat/skeleton.js +0 -301
  82. package/DateTimeFormat/utils.d.ts +0 -10
  83. package/DateTimeFormat/utils.d.ts.map +0 -1
  84. package/DateTimeFormat/utils.js +0 -21
  85. package/DisplayNames/CanonicalCodeForDisplayNames.d.ts +0 -2
  86. package/DisplayNames/CanonicalCodeForDisplayNames.d.ts.map +0 -1
  87. package/DisplayNames/CanonicalCodeForDisplayNames.js +0 -37
  88. package/LookupMatcher.d.ts +0 -9
  89. package/LookupMatcher.d.ts.map +0 -1
  90. package/LookupMatcher.js +0 -29
  91. package/LookupSupportedLocales.d.ts +0 -7
  92. package/LookupSupportedLocales.d.ts.map +0 -1
  93. package/LookupSupportedLocales.js +0 -23
  94. package/NumberFormat/digit-mapping.json +0 -1
  95. package/PluralRules/GetOperands.d.ts +0 -32
  96. package/PluralRules/GetOperands.d.ts.map +0 -1
  97. package/PluralRules/GetOperands.js +0 -51
  98. package/PluralRules/InitializePluralRules.d.ts +0 -9
  99. package/PluralRules/InitializePluralRules.d.ts.map +0 -1
  100. package/PluralRules/InitializePluralRules.js +0 -24
  101. package/PluralRules/ResolvePlural.d.ts +0 -13
  102. package/PluralRules/ResolvePlural.d.ts.map +0 -1
  103. package/PluralRules/ResolvePlural.js +0 -29
  104. package/RelativeTimeFormat/FormatRelativeTime.d.ts +0 -5
  105. package/RelativeTimeFormat/FormatRelativeTime.d.ts.map +0 -1
  106. package/RelativeTimeFormat/FormatRelativeTime.js +0 -14
  107. package/RelativeTimeFormat/FormatRelativeTimeToParts.d.ts +0 -5
  108. package/RelativeTimeFormat/FormatRelativeTimeToParts.d.ts.map +0 -1
  109. package/RelativeTimeFormat/FormatRelativeTimeToParts.js +0 -22
  110. package/RelativeTimeFormat/InitializeRelativeTimeFormat.d.ts +0 -9
  111. package/RelativeTimeFormat/InitializeRelativeTimeFormat.d.ts.map +0 -1
  112. package/RelativeTimeFormat/InitializeRelativeTimeFormat.js +0 -41
  113. package/RelativeTimeFormat/MakePartsList.d.ts +0 -2
  114. package/RelativeTimeFormat/MakePartsList.d.ts.map +0 -1
  115. package/RelativeTimeFormat/MakePartsList.js +0 -31
  116. package/RelativeTimeFormat/PartitionRelativeTimePattern.d.ts +0 -5
  117. package/RelativeTimeFormat/PartitionRelativeTimePattern.d.ts.map +0 -1
  118. package/RelativeTimeFormat/PartitionRelativeTimePattern.js +0 -58
  119. package/RelativeTimeFormat/SingularRelativeTimeUnit.d.ts +0 -7
  120. package/RelativeTimeFormat/SingularRelativeTimeUnit.d.ts.map +0 -1
  121. package/RelativeTimeFormat/SingularRelativeTimeUnit.js +0 -40
  122. package/ResolveLocale.d.ts +0 -15
  123. package/ResolveLocale.d.ts.map +0 -1
  124. package/ResolveLocale.js +0 -78
  125. package/UnicodeExtensionValue.d.ts +0 -7
  126. package/UnicodeExtensionValue.d.ts.map +0 -1
  127. package/UnicodeExtensionValue.js +0 -50
  128. package/lib/BestAvailableLocale.d.ts +0 -7
  129. package/lib/BestAvailableLocale.d.ts.map +0 -1
  130. package/lib/BestAvailableLocale.js +0 -21
  131. package/lib/BestFitMatcher.d.ts +0 -9
  132. package/lib/BestFitMatcher.d.ts.map +0 -1
  133. package/lib/BestFitMatcher.js +0 -48
  134. package/lib/DateTimeFormat/BasicFormatMatcher.d.ts +0 -8
  135. package/lib/DateTimeFormat/BasicFormatMatcher.d.ts.map +0 -1
  136. package/lib/DateTimeFormat/BasicFormatMatcher.js +0 -57
  137. package/lib/DateTimeFormat/BestFitFormatMatcher.d.ts +0 -17
  138. package/lib/DateTimeFormat/BestFitFormatMatcher.d.ts.map +0 -1
  139. package/lib/DateTimeFormat/BestFitFormatMatcher.js +0 -116
  140. package/lib/DateTimeFormat/DateTimeStyleFormat.d.ts +0 -3
  141. package/lib/DateTimeFormat/DateTimeStyleFormat.d.ts.map +0 -1
  142. package/lib/DateTimeFormat/DateTimeStyleFormat.js +0 -50
  143. package/lib/DateTimeFormat/FormatDateTime.d.ts +0 -8
  144. package/lib/DateTimeFormat/FormatDateTime.d.ts.map +0 -1
  145. package/lib/DateTimeFormat/FormatDateTime.js +0 -15
  146. package/lib/DateTimeFormat/FormatDateTimePattern.d.ts +0 -14
  147. package/lib/DateTimeFormat/FormatDateTimePattern.d.ts.map +0 -1
  148. package/lib/DateTimeFormat/FormatDateTimePattern.js +0 -178
  149. package/lib/DateTimeFormat/FormatDateTimeRange.d.ts +0 -4
  150. package/lib/DateTimeFormat/FormatDateTimeRange.d.ts.map +0 -1
  151. package/lib/DateTimeFormat/FormatDateTimeRange.js +0 -10
  152. package/lib/DateTimeFormat/FormatDateTimeRangeToParts.d.ts +0 -4
  153. package/lib/DateTimeFormat/FormatDateTimeRangeToParts.d.ts.map +0 -1
  154. package/lib/DateTimeFormat/FormatDateTimeRangeToParts.js +0 -14
  155. package/lib/DateTimeFormat/FormatDateTimeToParts.d.ts +0 -11
  156. package/lib/DateTimeFormat/FormatDateTimeToParts.d.ts.map +0 -1
  157. package/lib/DateTimeFormat/FormatDateTimeToParts.js +0 -21
  158. package/lib/DateTimeFormat/InitializeDateTimeFormat.d.ts +0 -18
  159. package/lib/DateTimeFormat/InitializeDateTimeFormat.d.ts.map +0 -1
  160. package/lib/DateTimeFormat/InitializeDateTimeFormat.js +0 -184
  161. package/lib/DateTimeFormat/PartitionDateTimePattern.d.ts +0 -10
  162. package/lib/DateTimeFormat/PartitionDateTimePattern.d.ts.map +0 -1
  163. package/lib/DateTimeFormat/PartitionDateTimePattern.js +0 -20
  164. package/lib/DateTimeFormat/PartitionDateTimeRangePattern.d.ts +0 -5
  165. package/lib/DateTimeFormat/PartitionDateTimeRangePattern.d.ts.map +0 -1
  166. package/lib/DateTimeFormat/PartitionDateTimeRangePattern.js +0 -121
  167. package/lib/DateTimeFormat/ToDateTimeOptions.d.ts +0 -9
  168. package/lib/DateTimeFormat/ToDateTimeOptions.d.ts.map +0 -1
  169. package/lib/DateTimeFormat/ToDateTimeOptions.js +0 -63
  170. package/lib/DateTimeFormat/ToLocalTime.d.ts +0 -26
  171. package/lib/DateTimeFormat/ToLocalTime.d.ts.map +0 -1
  172. package/lib/DateTimeFormat/ToLocalTime.js +0 -51
  173. package/lib/DateTimeFormat/skeleton.d.ts +0 -14
  174. package/lib/DateTimeFormat/skeleton.d.ts.map +0 -1
  175. package/lib/DateTimeFormat/skeleton.js +0 -294
  176. package/lib/DateTimeFormat/utils.d.ts +0 -10
  177. package/lib/DateTimeFormat/utils.d.ts.map +0 -1
  178. package/lib/DateTimeFormat/utils.js +0 -18
  179. package/lib/DisplayNames/CanonicalCodeForDisplayNames.d.ts +0 -2
  180. package/lib/DisplayNames/CanonicalCodeForDisplayNames.d.ts.map +0 -1
  181. package/lib/DisplayNames/CanonicalCodeForDisplayNames.js +0 -33
  182. package/lib/LookupMatcher.d.ts +0 -9
  183. package/lib/LookupMatcher.d.ts.map +0 -1
  184. package/lib/LookupMatcher.js +0 -25
  185. package/lib/LookupSupportedLocales.d.ts +0 -7
  186. package/lib/LookupSupportedLocales.d.ts.map +0 -1
  187. package/lib/LookupSupportedLocales.js +0 -19
  188. package/lib/NumberFormat/digit-mapping.json +0 -1
  189. package/lib/PluralRules/GetOperands.d.ts +0 -32
  190. package/lib/PluralRules/GetOperands.d.ts.map +0 -1
  191. package/lib/PluralRules/GetOperands.js +0 -47
  192. package/lib/PluralRules/InitializePluralRules.d.ts +0 -9
  193. package/lib/PluralRules/InitializePluralRules.d.ts.map +0 -1
  194. package/lib/PluralRules/InitializePluralRules.js +0 -20
  195. package/lib/PluralRules/ResolvePlural.d.ts +0 -13
  196. package/lib/PluralRules/ResolvePlural.d.ts.map +0 -1
  197. package/lib/PluralRules/ResolvePlural.js +0 -25
  198. package/lib/RelativeTimeFormat/FormatRelativeTime.d.ts +0 -5
  199. package/lib/RelativeTimeFormat/FormatRelativeTime.d.ts.map +0 -1
  200. package/lib/RelativeTimeFormat/FormatRelativeTime.js +0 -10
  201. package/lib/RelativeTimeFormat/FormatRelativeTimeToParts.d.ts +0 -5
  202. package/lib/RelativeTimeFormat/FormatRelativeTimeToParts.d.ts.map +0 -1
  203. package/lib/RelativeTimeFormat/FormatRelativeTimeToParts.js +0 -18
  204. package/lib/RelativeTimeFormat/InitializeRelativeTimeFormat.d.ts +0 -9
  205. package/lib/RelativeTimeFormat/InitializeRelativeTimeFormat.d.ts.map +0 -1
  206. package/lib/RelativeTimeFormat/InitializeRelativeTimeFormat.js +0 -37
  207. package/lib/RelativeTimeFormat/MakePartsList.d.ts +0 -2
  208. package/lib/RelativeTimeFormat/MakePartsList.d.ts.map +0 -1
  209. package/lib/RelativeTimeFormat/MakePartsList.js +0 -27
  210. package/lib/RelativeTimeFormat/PartitionRelativeTimePattern.d.ts +0 -5
  211. package/lib/RelativeTimeFormat/PartitionRelativeTimePattern.d.ts.map +0 -1
  212. package/lib/RelativeTimeFormat/PartitionRelativeTimePattern.js +0 -54
  213. package/lib/RelativeTimeFormat/SingularRelativeTimeUnit.d.ts +0 -7
  214. package/lib/RelativeTimeFormat/SingularRelativeTimeUnit.d.ts.map +0 -1
  215. package/lib/RelativeTimeFormat/SingularRelativeTimeUnit.js +0 -36
  216. package/lib/ResolveLocale.d.ts +0 -15
  217. package/lib/ResolveLocale.d.ts.map +0 -1
  218. package/lib/ResolveLocale.js +0 -74
  219. package/lib/UnicodeExtensionValue.d.ts +0 -7
  220. package/lib/UnicodeExtensionValue.d.ts.map +0 -1
  221. package/lib/UnicodeExtensionValue.js +0 -46
@@ -1,301 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.splitRangePattern = exports.splitFallbackRangePattern = exports.parseDateTimeSkeleton = exports.processDateTimePattern = void 0;
4
- var tslib_1 = require("tslib");
5
- var date_time_1 = require("../types/date-time");
6
- /**
7
- * https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
8
- * Credit: https://github.com/caridy/intl-datetimeformat-pattern/blob/master/index.js
9
- * with some tweaks
10
- */
11
- var DATE_TIME_REGEX = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;
12
- // trim patterns after transformations
13
- var expPatternTrimmer = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
14
- function matchSkeletonPattern(match, result) {
15
- var len = match.length;
16
- switch (match[0]) {
17
- // Era
18
- case 'G':
19
- result.era = len === 4 ? 'long' : len === 5 ? 'narrow' : 'short';
20
- return '{era}';
21
- // Year
22
- case 'y':
23
- case 'Y':
24
- case 'u':
25
- case 'U':
26
- case 'r':
27
- result.year = len === 2 ? '2-digit' : 'numeric';
28
- return '{year}';
29
- // Quarter
30
- case 'q':
31
- case 'Q':
32
- throw new RangeError('`w/Q` (quarter) patterns are not supported');
33
- // Month
34
- case 'M':
35
- case 'L':
36
- result.month = ['numeric', '2-digit', 'short', 'long', 'narrow'][len - 1];
37
- return '{month}';
38
- // Week
39
- case 'w':
40
- case 'W':
41
- throw new RangeError('`w/W` (week of year) patterns are not supported');
42
- case 'd':
43
- result.day = ['numeric', '2-digit'][len - 1];
44
- return '{day}';
45
- case 'D':
46
- case 'F':
47
- case 'g':
48
- result.day = 'numeric';
49
- return '{day}';
50
- // Weekday
51
- case 'E':
52
- result.weekday = len === 4 ? 'long' : len === 5 ? 'narrow' : 'short';
53
- return '{weekday}';
54
- case 'e':
55
- result.weekday = [
56
- undefined,
57
- undefined,
58
- 'short',
59
- 'long',
60
- 'narrow',
61
- 'short',
62
- ][len - 1];
63
- return '{weekday}';
64
- case 'c':
65
- result.weekday = [
66
- undefined,
67
- undefined,
68
- 'short',
69
- 'long',
70
- 'narrow',
71
- 'short',
72
- ][len - 1];
73
- return '{weekday}';
74
- // Period
75
- case 'a': // AM, PM
76
- case 'b': // am, pm, noon, midnight
77
- case 'B': // flexible day periods
78
- result.hour12 = true;
79
- return '{ampm}';
80
- // Hour
81
- case 'h':
82
- result.hour = ['numeric', '2-digit'][len - 1];
83
- result.hour12 = true;
84
- return '{hour}';
85
- case 'H':
86
- result.hour = ['numeric', '2-digit'][len - 1];
87
- return '{hour}';
88
- case 'K':
89
- result.hour = ['numeric', '2-digit'][len - 1];
90
- result.hour12 = true;
91
- return '{hour}';
92
- case 'k':
93
- result.hour = ['numeric', '2-digit'][len - 1];
94
- return '{hour}';
95
- case 'j':
96
- case 'J':
97
- case 'C':
98
- throw new RangeError('`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead');
99
- // Minute
100
- case 'm':
101
- result.minute = ['numeric', '2-digit'][len - 1];
102
- return '{minute}';
103
- // Second
104
- case 's':
105
- result.second = ['numeric', '2-digit'][len - 1];
106
- return '{second}';
107
- case 'S':
108
- case 'A':
109
- result.second = 'numeric';
110
- return '{second}';
111
- // Zone
112
- case 'z': // 1..3, 4: specific non-location format
113
- case 'Z': // 1..3, 4, 5: The ISO8601 varios formats
114
- case 'O': // 1, 4: miliseconds in day short, long
115
- case 'v': // 1, 4: generic non-location format
116
- case 'V': // 1, 2, 3, 4: time zone ID or city
117
- case 'X': // 1, 2, 3, 4: The ISO8601 varios formats
118
- case 'x': // 1, 2, 3, 4: The ISO8601 varios formats
119
- result.timeZoneName = len < 4 ? 'short' : 'long';
120
- return '{timeZoneName}';
121
- }
122
- return '';
123
- }
124
- function skeletonTokenToTable2(c) {
125
- switch (c) {
126
- // Era
127
- case 'G':
128
- return 'era';
129
- // Year
130
- case 'y':
131
- case 'Y':
132
- case 'u':
133
- case 'U':
134
- case 'r':
135
- return 'year';
136
- // Month
137
- case 'M':
138
- case 'L':
139
- return 'month';
140
- // Day
141
- case 'd':
142
- case 'D':
143
- case 'F':
144
- case 'g':
145
- return 'day';
146
- // Period
147
- case 'a': // AM, PM
148
- case 'b': // am, pm, noon, midnight
149
- case 'B': // flexible day periods
150
- return 'ampm';
151
- // Hour
152
- case 'h':
153
- case 'H':
154
- case 'K':
155
- case 'k':
156
- return 'hour';
157
- // Minute
158
- case 'm':
159
- return 'minute';
160
- // Second
161
- case 's':
162
- case 'S':
163
- case 'A':
164
- return 'second';
165
- default:
166
- throw new RangeError('Invalid range pattern token');
167
- }
168
- }
169
- function processDateTimePattern(pattern, result) {
170
- var literals = [];
171
- // Use skeleton to populate result, but use mapped pattern to populate pattern
172
- var pattern12 = pattern
173
- // Double apostrophe
174
- .replace(/'{2}/g, '{apostrophe}')
175
- // Apostrophe-escaped
176
- .replace(/'(.*?)'/g, function (_, literal) {
177
- literals.push(literal);
178
- return "$$" + (literals.length - 1) + "$$";
179
- })
180
- .replace(DATE_TIME_REGEX, function (m) { return matchSkeletonPattern(m, result || {}); });
181
- //Restore literals
182
- if (literals.length) {
183
- pattern12 = pattern12
184
- .replace(/\$\$(\d+)\$\$/g, function (_, i) {
185
- return literals[+i];
186
- })
187
- .replace(/\{apostrophe\}/g, "'");
188
- }
189
- // Handle apostrophe-escaped things
190
- return [
191
- pattern12
192
- .replace(/([\s\uFEFF\xA0])\{ampm\}([\s\uFEFF\xA0])/, '$1')
193
- .replace('{ampm}', '')
194
- .replace(expPatternTrimmer, ''),
195
- pattern12,
196
- ];
197
- }
198
- exports.processDateTimePattern = processDateTimePattern;
199
- /**
200
- * Parse Date time skeleton into Intl.DateTimeFormatOptions
201
- * Ref: https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
202
- * @public
203
- * @param skeleton skeleton string
204
- */
205
- function parseDateTimeSkeleton(skeleton, rawPattern, rangePatterns, intervalFormatFallback) {
206
- if (rawPattern === void 0) { rawPattern = skeleton; }
207
- var result = {
208
- pattern: '',
209
- pattern12: '',
210
- skeleton: skeleton,
211
- rawPattern: rawPattern,
212
- rangePatterns: {},
213
- rangePatterns12: {},
214
- };
215
- if (rangePatterns) {
216
- for (var k in rangePatterns) {
217
- var key = skeletonTokenToTable2(k);
218
- var rawPattern_1 = rangePatterns[k];
219
- var intervalResult = {
220
- patternParts: [],
221
- };
222
- var _a = processDateTimePattern(rawPattern_1, intervalResult), pattern_1 = _a[0], pattern12_1 = _a[1];
223
- result.rangePatterns[key] = tslib_1.__assign(tslib_1.__assign({}, intervalResult), { patternParts: splitRangePattern(pattern_1) });
224
- result.rangePatterns12[key] = tslib_1.__assign(tslib_1.__assign({}, intervalResult), { patternParts: splitRangePattern(pattern12_1) });
225
- }
226
- }
227
- if (intervalFormatFallback) {
228
- var patternParts = splitFallbackRangePattern(intervalFormatFallback);
229
- result.rangePatterns.default = {
230
- patternParts: patternParts,
231
- };
232
- result.rangePatterns12.default = {
233
- patternParts: patternParts,
234
- };
235
- }
236
- // Process skeleton
237
- skeleton.replace(DATE_TIME_REGEX, function (m) { return matchSkeletonPattern(m, result); });
238
- var _b = processDateTimePattern(rawPattern), pattern = _b[0], pattern12 = _b[1];
239
- result.pattern = pattern;
240
- result.pattern12 = pattern12;
241
- return result;
242
- }
243
- exports.parseDateTimeSkeleton = parseDateTimeSkeleton;
244
- function splitFallbackRangePattern(pattern) {
245
- var parts = pattern.split(/(\{[0|1]\})/g).filter(Boolean);
246
- return parts.map(function (pattern) {
247
- switch (pattern) {
248
- case '{0}':
249
- return {
250
- source: date_time_1.RangePatternType.startRange,
251
- pattern: pattern,
252
- };
253
- case '{1}':
254
- return {
255
- source: date_time_1.RangePatternType.endRange,
256
- pattern: pattern,
257
- };
258
- default:
259
- return {
260
- source: date_time_1.RangePatternType.shared,
261
- pattern: pattern,
262
- };
263
- }
264
- });
265
- }
266
- exports.splitFallbackRangePattern = splitFallbackRangePattern;
267
- function splitRangePattern(pattern) {
268
- var PART_REGEX = /\{(.*?)\}/g;
269
- // Map of part and index within the string
270
- var parts = {};
271
- var match;
272
- var splitIndex = 0;
273
- while ((match = PART_REGEX.exec(pattern))) {
274
- if (!(match[0] in parts)) {
275
- parts[match[0]] = match.index;
276
- }
277
- else {
278
- splitIndex = match.index;
279
- break;
280
- }
281
- }
282
- if (!splitIndex) {
283
- return [
284
- {
285
- source: date_time_1.RangePatternType.startRange,
286
- pattern: pattern,
287
- },
288
- ];
289
- }
290
- return [
291
- {
292
- source: date_time_1.RangePatternType.startRange,
293
- pattern: pattern.slice(0, splitIndex),
294
- },
295
- {
296
- source: date_time_1.RangePatternType.endRange,
297
- pattern: pattern.slice(splitIndex),
298
- },
299
- ];
300
- }
301
- exports.splitRangePattern = splitRangePattern;
@@ -1,10 +0,0 @@
1
- import { IntlDateTimeFormatInternal, TABLE_6 } from '../types/date-time';
2
- export declare const DATE_TIME_PROPS: Array<keyof Pick<IntlDateTimeFormatInternal, TABLE_6>>;
3
- export declare const removalPenalty = 120;
4
- export declare const additionPenalty = 20;
5
- export declare const differentNumericTypePenalty = 15;
6
- export declare const longLessPenalty = 8;
7
- export declare const longMorePenalty = 6;
8
- export declare const shortLessPenalty = 6;
9
- export declare const shortMorePenalty = 3;
10
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../packages/ecma402-abstract/DateTimeFormat/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,0BAA0B,EAAE,OAAO,EAAC,MAAM,oBAAoB,CAAA;AAEtE,eAAO,MAAM,eAAe,EAAE,KAAK,CACjC,MAAM,IAAI,CAAC,0BAA0B,EAAE,OAAO,CAAC,CAWhD,CAAA;AAED,eAAO,MAAM,cAAc,MAAM,CAAA;AACjC,eAAO,MAAM,eAAe,KAAK,CAAA;AACjC,eAAO,MAAM,2BAA2B,KAAK,CAAA;AAC7C,eAAO,MAAM,eAAe,IAAI,CAAA;AAChC,eAAO,MAAM,eAAe,IAAI,CAAA;AAChC,eAAO,MAAM,gBAAgB,IAAI,CAAA;AACjC,eAAO,MAAM,gBAAgB,IAAI,CAAA"}
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.shortMorePenalty = exports.shortLessPenalty = exports.longMorePenalty = exports.longLessPenalty = exports.differentNumericTypePenalty = exports.additionPenalty = exports.removalPenalty = exports.DATE_TIME_PROPS = void 0;
4
- exports.DATE_TIME_PROPS = [
5
- 'weekday',
6
- 'era',
7
- 'year',
8
- 'month',
9
- 'day',
10
- 'hour',
11
- 'minute',
12
- 'second',
13
- 'timeZoneName',
14
- ];
15
- exports.removalPenalty = 120;
16
- exports.additionPenalty = 20;
17
- exports.differentNumericTypePenalty = 15;
18
- exports.longLessPenalty = 8;
19
- exports.longMorePenalty = 6;
20
- exports.shortLessPenalty = 6;
21
- exports.shortMorePenalty = 3;
@@ -1,2 +0,0 @@
1
- export declare function CanonicalCodeForDisplayNames(type: 'language' | 'region' | 'script' | 'currency', code: string): string;
2
- //# sourceMappingURL=CanonicalCodeForDisplayNames.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CanonicalCodeForDisplayNames.d.ts","sourceRoot":"","sources":["../../../../../../packages/ecma402-abstract/DisplayNames/CanonicalCodeForDisplayNames.ts"],"names":[],"mappings":"AAcA,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,EACnD,IAAI,EAAE,MAAM,GACX,MAAM,CAqBR"}
@@ -1,37 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CanonicalCodeForDisplayNames = void 0;
4
- var CanonicalizeLocaleList_1 = require("../CanonicalizeLocaleList");
5
- var utils_1 = require("../utils");
6
- var IsWellFormedCurrencyCode_1 = require("../IsWellFormedCurrencyCode");
7
- var UNICODE_REGION_SUBTAG_REGEX = /^([a-z]{2}|[0-9]{3})$/i;
8
- var ALPHA_4 = /^[a-z]{4}$/i;
9
- function isUnicodeRegionSubtag(region) {
10
- return UNICODE_REGION_SUBTAG_REGEX.test(region);
11
- }
12
- function isUnicodeScriptSubtag(script) {
13
- return ALPHA_4.test(script);
14
- }
15
- function CanonicalCodeForDisplayNames(type, code) {
16
- if (type === 'language') {
17
- return CanonicalizeLocaleList_1.CanonicalizeLocaleList([code])[0];
18
- }
19
- if (type === 'region') {
20
- if (!isUnicodeRegionSubtag(code)) {
21
- throw RangeError('invalid region');
22
- }
23
- return code.toUpperCase();
24
- }
25
- if (type === 'script') {
26
- if (!isUnicodeScriptSubtag(code)) {
27
- throw RangeError('invalid script');
28
- }
29
- return "" + code[0].toUpperCase() + code.slice(1).toLowerCase();
30
- }
31
- utils_1.invariant(type === 'currency', 'invalid type');
32
- if (!IsWellFormedCurrencyCode_1.IsWellFormedCurrencyCode(code)) {
33
- throw RangeError('invalid currency');
34
- }
35
- return code.toUpperCase();
36
- }
37
- exports.CanonicalCodeForDisplayNames = CanonicalCodeForDisplayNames;
@@ -1,9 +0,0 @@
1
- import { LookupMatcherResult } from './types/core';
2
- /**
3
- * https://tc39.es/ecma402/#sec-lookupmatcher
4
- * @param availableLocales
5
- * @param requestedLocales
6
- * @param getDefaultLocale
7
- */
8
- export declare function LookupMatcher(availableLocales: Set<string>, requestedLocales: string[], getDefaultLocale: () => string): LookupMatcherResult;
9
- //# sourceMappingURL=LookupMatcher.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LookupMatcher.d.ts","sourceRoot":"","sources":["../../../../../packages/ecma402-abstract/LookupMatcher.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,mBAAmB,EAAC,MAAM,cAAc,CAAA;AAEhD;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,EAC7B,gBAAgB,EAAE,MAAM,EAAE,EAC1B,gBAAgB,EAAE,MAAM,MAAM,GAC7B,mBAAmB,CAwBrB"}
package/LookupMatcher.js DELETED
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LookupMatcher = void 0;
4
- var utils_1 = require("./utils");
5
- var BestAvailableLocale_1 = require("./BestAvailableLocale");
6
- /**
7
- * https://tc39.es/ecma402/#sec-lookupmatcher
8
- * @param availableLocales
9
- * @param requestedLocales
10
- * @param getDefaultLocale
11
- */
12
- function LookupMatcher(availableLocales, requestedLocales, getDefaultLocale) {
13
- var result = { locale: '' };
14
- for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
15
- var locale = requestedLocales_1[_i];
16
- var noExtensionLocale = locale.replace(utils_1.UNICODE_EXTENSION_SEQUENCE_REGEX, '');
17
- var availableLocale = BestAvailableLocale_1.BestAvailableLocale(availableLocales, noExtensionLocale);
18
- if (availableLocale) {
19
- result.locale = availableLocale;
20
- if (locale !== noExtensionLocale) {
21
- result.extension = locale.slice(noExtensionLocale.length + 1, locale.length);
22
- }
23
- return result;
24
- }
25
- }
26
- result.locale = getDefaultLocale();
27
- return result;
28
- }
29
- exports.LookupMatcher = LookupMatcher;
@@ -1,7 +0,0 @@
1
- /**
2
- * https://tc39.es/ecma402/#sec-lookupsupportedlocales
3
- * @param availableLocales
4
- * @param requestedLocales
5
- */
6
- export declare function LookupSupportedLocales(availableLocales: Set<string>, requestedLocales: string[]): string[];
7
- //# sourceMappingURL=LookupSupportedLocales.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LookupSupportedLocales.d.ts","sourceRoot":"","sources":["../../../../../packages/ecma402-abstract/LookupSupportedLocales.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,EAC7B,gBAAgB,EAAE,MAAM,EAAE,YAiB3B"}
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LookupSupportedLocales = void 0;
4
- var utils_1 = require("./utils");
5
- var BestAvailableLocale_1 = require("./BestAvailableLocale");
6
- /**
7
- * https://tc39.es/ecma402/#sec-lookupsupportedlocales
8
- * @param availableLocales
9
- * @param requestedLocales
10
- */
11
- function LookupSupportedLocales(availableLocales, requestedLocales) {
12
- var subset = [];
13
- for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
14
- var locale = requestedLocales_1[_i];
15
- var noExtensionLocale = locale.replace(utils_1.UNICODE_EXTENSION_SEQUENCE_REGEX, '');
16
- var availableLocale = BestAvailableLocale_1.BestAvailableLocale(availableLocales, noExtensionLocale);
17
- if (availableLocale) {
18
- subset.push(availableLocale);
19
- }
20
- }
21
- return subset;
22
- }
23
- exports.LookupSupportedLocales = LookupSupportedLocales;
@@ -1 +0,0 @@
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": ["𞋰", "𞋱", "𞋲", "𞋳", "𞋴", "𞋵", "𞋶", "𞋷", "𞋸", "𞋹"] }
@@ -1,32 +0,0 @@
1
- export interface OperandsRecord {
2
- /**
3
- * Absolute value of the source number (integer and decimals)
4
- */
5
- Number: number;
6
- /**
7
- * Number of digits of `number`
8
- */
9
- IntegerDigits: number;
10
- /**
11
- * Number of visible fraction digits in [[Number]], with trailing zeroes.
12
- */
13
- NumberOfFractionDigits: number;
14
- /**
15
- * Number of visible fraction digits in [[Number]], without trailing zeroes.
16
- */
17
- NumberOfFractionDigitsWithoutTrailing: number;
18
- /**
19
- * Number of visible fractional digits in [[Number]], with trailing zeroes.
20
- */
21
- FractionDigits: number;
22
- /**
23
- * Number of visible fractional digits in [[Number]], without trailing zeroes.
24
- */
25
- FractionDigitsWithoutTrailing: number;
26
- }
27
- /**
28
- * http://ecma-international.org/ecma-402/7.0/index.html#sec-getoperands
29
- * @param s
30
- */
31
- export declare function GetOperands(s: string): OperandsRecord;
32
- //# sourceMappingURL=GetOperands.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GetOperands.d.ts","sourceRoot":"","sources":["../../../../../../packages/ecma402-abstract/PluralRules/GetOperands.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,aAAa,EAAE,MAAM,CAAA;IACrB;;OAEG;IACH,sBAAsB,EAAE,MAAM,CAAA;IAC9B;;OAEG;IACH,qCAAqC,EAAE,MAAM,CAAA;IAC7C;;OAEG;IACH,cAAc,EAAE,MAAM,CAAA;IACtB;;OAEG;IACH,6BAA6B,EAAE,MAAM,CAAA;CACtC;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,cAAc,CAyCrD"}
@@ -1,51 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GetOperands = void 0;
4
- var utils_1 = require("../utils");
5
- var _262_1 = require("../262");
6
- /**
7
- * http://ecma-international.org/ecma-402/7.0/index.html#sec-getoperands
8
- * @param s
9
- */
10
- function GetOperands(s) {
11
- utils_1.invariant(typeof s === 'string', "GetOperands should have been called with a string");
12
- var n = _262_1.ToNumber(s);
13
- utils_1.invariant(isFinite(n), 'n should be finite');
14
- var dp = s.indexOf('.');
15
- var iv;
16
- var f;
17
- var v;
18
- var fv = '';
19
- if (dp === -1) {
20
- iv = n;
21
- f = 0;
22
- v = 0;
23
- }
24
- else {
25
- iv = s.slice(0, dp);
26
- fv = s.slice(dp, s.length);
27
- f = _262_1.ToNumber(fv);
28
- v = fv.length;
29
- }
30
- var i = Math.abs(_262_1.ToNumber(iv));
31
- var w;
32
- var t;
33
- if (f !== 0) {
34
- var ft = fv.replace(/0+$/, '');
35
- w = ft.length;
36
- t = _262_1.ToNumber(ft);
37
- }
38
- else {
39
- w = 0;
40
- t = 0;
41
- }
42
- return {
43
- Number: n,
44
- IntegerDigits: i,
45
- NumberOfFractionDigits: v,
46
- NumberOfFractionDigitsWithoutTrailing: w,
47
- FractionDigits: f,
48
- FractionDigitsWithoutTrailing: t,
49
- };
50
- }
51
- exports.GetOperands = GetOperands;
@@ -1,9 +0,0 @@
1
- import { PluralRulesInternal, PluralRulesData } from '../types/plural-rules';
2
- export declare function InitializePluralRules(pl: Intl.PluralRules, locales: string | string[] | undefined, options: Intl.PluralRulesOptions | undefined, { availableLocales, relevantExtensionKeys, localeData, getDefaultLocale, getInternalSlots, }: {
3
- availableLocales: Set<string>;
4
- relevantExtensionKeys: string[];
5
- localeData: Record<string, PluralRulesData | undefined>;
6
- getDefaultLocale(): string;
7
- getInternalSlots(pl: Intl.PluralRules): PluralRulesInternal;
8
- }): Intl.PluralRules;
9
- //# sourceMappingURL=InitializePluralRules.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InitializePluralRules.d.ts","sourceRoot":"","sources":["../../../../../../packages/ecma402-abstract/PluralRules/InitializePluralRules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAE,eAAe,EAAC,MAAM,uBAAuB,CAAA;AAO1E,wBAAgB,qBAAqB,CACnC,EAAE,EAAE,IAAI,CAAC,WAAW,EACpB,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,EACtC,OAAO,EAAE,IAAI,CAAC,kBAAkB,GAAG,SAAS,EAC5C,EACE,gBAAgB,EAChB,qBAAqB,EACrB,UAAU,EACV,gBAAgB,EAChB,gBAAgB,GACjB,EAAE;IACD,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC7B,qBAAqB,EAAE,MAAM,EAAE,CAAA;IAC/B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,GAAG,SAAS,CAAC,CAAA;IACvD,gBAAgB,IAAI,MAAM,CAAA;IAC1B,gBAAgB,CAAC,EAAE,EAAE,IAAI,CAAC,WAAW,GAAG,mBAAmB,CAAA;CAC5D,oBAkCF"}
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InitializePluralRules = void 0;
4
- var CanonicalizeLocaleList_1 = require("../CanonicalizeLocaleList");
5
- var GetOption_1 = require("../GetOption");
6
- var SetNumberFormatDigitOptions_1 = require("../NumberFormat/SetNumberFormatDigitOptions");
7
- var ResolveLocale_1 = require("../ResolveLocale");
8
- var CoerceOptionsToObject_1 = require("../CoerceOptionsToObject");
9
- function InitializePluralRules(pl, locales, options, _a) {
10
- var availableLocales = _a.availableLocales, relevantExtensionKeys = _a.relevantExtensionKeys, localeData = _a.localeData, getDefaultLocale = _a.getDefaultLocale, getInternalSlots = _a.getInternalSlots;
11
- var requestedLocales = CanonicalizeLocaleList_1.CanonicalizeLocaleList(locales);
12
- var opt = Object.create(null);
13
- var opts = CoerceOptionsToObject_1.CoerceOptionsToObject(options);
14
- var internalSlots = getInternalSlots(pl);
15
- internalSlots.initializedPluralRules = true;
16
- var matcher = GetOption_1.GetOption(opts, 'localeMatcher', 'string', ['best fit', 'lookup'], 'best fit');
17
- opt.localeMatcher = matcher;
18
- internalSlots.type = GetOption_1.GetOption(opts, 'type', 'string', ['cardinal', 'ordinal'], 'cardinal');
19
- SetNumberFormatDigitOptions_1.SetNumberFormatDigitOptions(internalSlots, opts, 0, 3, 'standard');
20
- var r = ResolveLocale_1.ResolveLocale(availableLocales, requestedLocales, opt, relevantExtensionKeys, localeData, getDefaultLocale);
21
- internalSlots.locale = r.locale;
22
- return pl;
23
- }
24
- exports.InitializePluralRules = InitializePluralRules;
@@ -1,13 +0,0 @@
1
- import { LDMLPluralRule, PluralRulesInternal } from '../types/plural-rules';
2
- import { OperandsRecord } from './GetOperands';
3
- /**
4
- * http://ecma-international.org/ecma-402/7.0/index.html#sec-resolveplural
5
- * @param pl
6
- * @param n
7
- * @param PluralRuleSelect Has to pass in bc it's implementation-specific
8
- */
9
- export declare function ResolvePlural(pl: Intl.PluralRules, n: number, { getInternalSlots, PluralRuleSelect, }: {
10
- getInternalSlots(pl: Intl.PluralRules): PluralRulesInternal;
11
- PluralRuleSelect: (locale: string, type: 'cardinal' | 'ordinal', n: number, operands: OperandsRecord) => LDMLPluralRule;
12
- }): LDMLPluralRule;
13
- //# sourceMappingURL=ResolvePlural.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ResolvePlural.d.ts","sourceRoot":"","sources":["../../../../../../packages/ecma402-abstract/PluralRules/ResolvePlural.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,cAAc,EAAE,mBAAmB,EAAC,MAAM,uBAAuB,CAAA;AAEzE,OAAO,EAAc,cAAc,EAAC,MAAM,eAAe,CAAA;AAEzD;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,EAAE,EAAE,IAAI,CAAC,WAAW,EACpB,CAAC,EAAE,MAAM,EACT,EACE,gBAAgB,EAChB,gBAAgB,GACjB,EAAE;IACD,gBAAgB,CAAC,EAAE,EAAE,IAAI,CAAC,WAAW,GAAG,mBAAmB,CAAA;IAC3D,gBAAgB,EAAE,CAChB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,UAAU,GAAG,SAAS,EAC5B,CAAC,EAAE,MAAM,EACT,QAAQ,EAAE,cAAc,KACrB,cAAc,CAAA;CACpB,GACA,cAAc,CAgBhB"}