@formatjs/icu-skeleton-parser
Advanced tools
Comparing version 1.2.13 to 1.3.0
@@ -33,3 +33,3 @@ import { __assign } from "tslib"; | ||
var FRACTION_PRECISION_REGEX = /^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g; | ||
var SIGNIFICANT_PRECISION_REGEX = /^(@+)?(\+|#+)?$/g; | ||
var SIGNIFICANT_PRECISION_REGEX = /^(@+)?(\+|#+)?[rs]?$/g; | ||
var INTEGER_WIDTH_REGEX = /(\*)(0+)|(#+)(0+)|(0+)/g; | ||
@@ -39,2 +39,8 @@ var CONCISE_INTEGER_WIDTH_REGEX = /^(0+)$/; | ||
var result = {}; | ||
if (str[str.length - 1] === 'r') { | ||
result.roundingPriority = 'morePrecision'; | ||
} | ||
else if (str[str.length - 1] === 's') { | ||
result.roundingPriority = 'lessPrecision'; | ||
} | ||
str.replace(SIGNIFICANT_PRECISION_REGEX, function (_, g1, g2) { | ||
@@ -266,5 +272,10 @@ // @@@ case | ||
}); | ||
if (token.options.length) { | ||
result = __assign(__assign({}, result), parseSignificantPrecision(token.options[0])); | ||
var opt = token.options[0]; | ||
// https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#trailing-zero-display | ||
if (opt === 'w') { | ||
result = __assign(__assign({}, result), { trailingZeroDisplay: 'stripIfInteger' }); | ||
} | ||
else if (opt) { | ||
result = __assign(__assign({}, result), parseSignificantPrecision(opt)); | ||
} | ||
continue; | ||
@@ -271,0 +282,0 @@ } |
@@ -37,3 +37,3 @@ "use strict"; | ||
var FRACTION_PRECISION_REGEX = /^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g; | ||
var SIGNIFICANT_PRECISION_REGEX = /^(@+)?(\+|#+)?$/g; | ||
var SIGNIFICANT_PRECISION_REGEX = /^(@+)?(\+|#+)?[rs]?$/g; | ||
var INTEGER_WIDTH_REGEX = /(\*)(0+)|(#+)(0+)|(0+)/g; | ||
@@ -43,2 +43,8 @@ var CONCISE_INTEGER_WIDTH_REGEX = /^(0+)$/; | ||
var result = {}; | ||
if (str[str.length - 1] === 'r') { | ||
result.roundingPriority = 'morePrecision'; | ||
} | ||
else if (str[str.length - 1] === 's') { | ||
result.roundingPriority = 'lessPrecision'; | ||
} | ||
str.replace(SIGNIFICANT_PRECISION_REGEX, function (_, g1, g2) { | ||
@@ -270,5 +276,10 @@ // @@@ case | ||
}); | ||
if (token.options.length) { | ||
result = tslib_1.__assign(tslib_1.__assign({}, result), parseSignificantPrecision(token.options[0])); | ||
var opt = token.options[0]; | ||
// https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#trailing-zero-display | ||
if (opt === 'w') { | ||
result = tslib_1.__assign(tslib_1.__assign({}, result), { trailingZeroDisplay: 'stripIfInteger' }); | ||
} | ||
else if (opt) { | ||
result = tslib_1.__assign(tslib_1.__assign({}, result), parseSignificantPrecision(opt)); | ||
} | ||
continue; | ||
@@ -275,0 +286,0 @@ } |
{ | ||
"name": "@formatjs/icu-skeleton-parser", | ||
"version": "1.2.13", | ||
"version": "1.3.0", | ||
"main": "index.js", | ||
@@ -9,5 +9,5 @@ "module": "lib/index.js", | ||
"dependencies": { | ||
"@formatjs/ecma402-abstract": "1.9.9", | ||
"@formatjs/ecma402-abstract": "1.10.0", | ||
"tslib": "^2.1.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
39029
901
+ Added@formatjs/ecma402-abstract@1.10.0(transitive)
- Removed@formatjs/ecma402-abstract@1.9.9(transitive)