update
This commit is contained in:
@@ -69,6 +69,7 @@ class NumberFormatter {
|
||||
|
||||
// Assemble the final number
|
||||
let formattedNumber = majorDigits;
|
||||
|
||||
if (minorDigits) {
|
||||
formattedNumber += DECIMAL_SEPARATOR_PLACEHOLDER + minorDigits;
|
||||
}
|
||||
@@ -102,6 +103,7 @@ class NumberFormatter {
|
||||
const result = number.toString().split('.');
|
||||
const majorDigits = result[0];
|
||||
const minorDigits = (result[1] === undefined) ? '' : result[1];
|
||||
|
||||
return [majorDigits, minorDigits];
|
||||
}
|
||||
|
||||
@@ -150,6 +152,7 @@ class NumberFormatter {
|
||||
*/
|
||||
adjustMinorDigitsZeroes(minorDigits) {
|
||||
let digit = minorDigits;
|
||||
|
||||
if (digit.length > this.numberSpecification.getMaxFractionDigits()) {
|
||||
// Strip any trailing zeroes.
|
||||
digit = digit.replace(/0+$/, '');
|
||||
@@ -212,12 +215,12 @@ class NumberFormatter {
|
||||
*/
|
||||
strtr(str, pairs) {
|
||||
const substrs = Object.keys(pairs).map(escapeRE);
|
||||
|
||||
return str.split(RegExp(`(${substrs.join('|')})`))
|
||||
.map(part => pairs[part] || part)
|
||||
.map((part) => pairs[part] || part)
|
||||
.join('');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add missing placeholders to the number using the passed CLDR pattern.
|
||||
*
|
||||
@@ -272,6 +275,7 @@ class NumberFormatter {
|
||||
|
||||
static build(specifications) {
|
||||
let symbol;
|
||||
|
||||
if (undefined !== specifications.numberSymbols) {
|
||||
symbol = new NumberSymbol(...specifications.numberSymbols);
|
||||
} else {
|
||||
@@ -279,6 +283,7 @@ class NumberFormatter {
|
||||
}
|
||||
|
||||
let specification;
|
||||
|
||||
if (specifications.currencySymbol) {
|
||||
specification = new PriceSpecification(
|
||||
specifications.positivePattern,
|
||||
|
||||
Reference in New Issue
Block a user