@formatjs/icu-skeleton-parser 1.7.2 → 1.8.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 (3) hide show
  1. package/lib/number.js +21 -0
  2. package/number.js +21 -0
  3. package/package.json +1 -1
package/lib/number.js CHANGED
@@ -216,6 +216,27 @@ export function parseNumberSkeleton(tokens) {
216
216
  case 'scale':
217
217
  result.scale = parseFloat(token.options[0]);
218
218
  continue;
219
+ case 'rounding-mode-floor':
220
+ result.roundingMode = 'floor';
221
+ continue;
222
+ case 'rounding-mode-ceiling':
223
+ result.roundingMode = 'ceil';
224
+ continue;
225
+ case 'rounding-mode-down':
226
+ result.roundingMode = 'trunc';
227
+ continue;
228
+ case 'rounding-mode-up':
229
+ result.roundingMode = 'expand';
230
+ continue;
231
+ case 'rounding-mode-half-even':
232
+ result.roundingMode = 'halfEven';
233
+ continue;
234
+ case 'rounding-mode-half-down':
235
+ result.roundingMode = 'halfTrunc';
236
+ continue;
237
+ case 'rounding-mode-half-up':
238
+ result.roundingMode = 'halfExpand';
239
+ continue;
219
240
  // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#integer-width
220
241
  case 'integer-width':
221
242
  if (token.options.length > 1) {
package/number.js CHANGED
@@ -220,6 +220,27 @@ function parseNumberSkeleton(tokens) {
220
220
  case 'scale':
221
221
  result.scale = parseFloat(token.options[0]);
222
222
  continue;
223
+ case 'rounding-mode-floor':
224
+ result.roundingMode = 'floor';
225
+ continue;
226
+ case 'rounding-mode-ceiling':
227
+ result.roundingMode = 'ceil';
228
+ continue;
229
+ case 'rounding-mode-down':
230
+ result.roundingMode = 'trunc';
231
+ continue;
232
+ case 'rounding-mode-up':
233
+ result.roundingMode = 'expand';
234
+ continue;
235
+ case 'rounding-mode-half-even':
236
+ result.roundingMode = 'halfEven';
237
+ continue;
238
+ case 'rounding-mode-half-down':
239
+ result.roundingMode = 'halfTrunc';
240
+ continue;
241
+ case 'rounding-mode-half-up':
242
+ result.roundingMode = 'halfExpand';
243
+ continue;
223
244
  // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#integer-width
224
245
  case 'integer-width':
225
246
  if (token.options.length > 1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formatjs/icu-skeleton-parser",
3
- "version": "1.7.2",
3
+ "version": "1.8.0",
4
4
  "main": "index.js",
5
5
  "module": "lib/index.js",
6
6
  "types": "index.d.ts",