@formatjs/intl-numberformat 8.15.0 → 8.15.1
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.
- package/package.json +5 -5
- package/polyfill.iife.js +16 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formatjs/intl-numberformat",
|
|
3
|
-
"version": "8.15.
|
|
3
|
+
"version": "8.15.1",
|
|
4
4
|
"description": "Ponyfill for ES2020 Intl.NumberFormat",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"polyfill",
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"decimal.js": "10",
|
|
26
26
|
"tslib": "2",
|
|
27
|
-
"@formatjs/ecma402-abstract": "2.3.
|
|
27
|
+
"@formatjs/ecma402-abstract": "2.3.1",
|
|
28
28
|
"@formatjs/intl-localematcher": "0.5.9"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@formatjs/intl-
|
|
32
|
-
"@formatjs/intl-locale": "4.2.
|
|
33
|
-
"@formatjs/intl-
|
|
31
|
+
"@formatjs/intl-getcanonicallocales": "2.5.4",
|
|
32
|
+
"@formatjs/intl-locale": "4.2.8",
|
|
33
|
+
"@formatjs/intl-pluralrules": "5.4.1"
|
|
34
34
|
},
|
|
35
35
|
"bugs": {
|
|
36
36
|
"url": "https://github.com/formatjs/formatjs/issues"
|
package/polyfill.iife.js
CHANGED
|
@@ -4012,6 +4012,7 @@
|
|
|
4012
4012
|
var S_DOLLAR_UNICODE_REGEX = new RegExp("".concat(S_UNICODE_REGEX.source, "$"));
|
|
4013
4013
|
var CLDR_NUMBER_PATTERN = /[#0](?:[\.,][#0]+)*/g;
|
|
4014
4014
|
function formatToParts(numberResult, data2, pl, options) {
|
|
4015
|
+
var _a;
|
|
4015
4016
|
var sign2 = numberResult.sign, exponent = numberResult.exponent, magnitude = numberResult.magnitude;
|
|
4016
4017
|
var notation = options.notation, style = options.style, numberingSystem = options.numberingSystem;
|
|
4017
4018
|
var defaultNumberingSystem = data2.numbers.nu[0];
|
|
@@ -4083,7 +4084,7 @@
|
|
|
4083
4084
|
exponent,
|
|
4084
4085
|
numberingSystem,
|
|
4085
4086
|
// If compact number pattern exists, do not insert group separators.
|
|
4086
|
-
!compactNumberPattern &&
|
|
4087
|
+
!compactNumberPattern && ((_a = options.useGrouping) !== null && _a !== void 0 ? _a : true),
|
|
4087
4088
|
decimalNumberPattern,
|
|
4088
4089
|
style,
|
|
4089
4090
|
options.roundingIncrement,
|
|
@@ -4128,8 +4129,8 @@
|
|
|
4128
4129
|
}
|
|
4129
4130
|
var unitPatternParts = unitPattern.split(/(\{[01]\})/g);
|
|
4130
4131
|
var result = [];
|
|
4131
|
-
for (var
|
|
4132
|
-
var part = unitPatternParts_1[
|
|
4132
|
+
for (var _b = 0, unitPatternParts_1 = unitPatternParts; _b < unitPatternParts_1.length; _b++) {
|
|
4133
|
+
var part = unitPatternParts_1[_b];
|
|
4133
4134
|
switch (part) {
|
|
4134
4135
|
case "{0}":
|
|
4135
4136
|
result.push.apply(result, numberParts);
|
|
@@ -4156,7 +4157,7 @@
|
|
|
4156
4157
|
if (unitData) {
|
|
4157
4158
|
unitPattern = selectPlural(pl, numberResult.roundedNumber.times(TEN.pow(exponent)).toNumber(), data2.units.simple[unit][unitDisplay]);
|
|
4158
4159
|
} else {
|
|
4159
|
-
var
|
|
4160
|
+
var _c = unit.split("-per-"), numeratorUnit = _c[0], denominatorUnit = _c[1];
|
|
4160
4161
|
unitData = data2.units.simple[numeratorUnit];
|
|
4161
4162
|
var numeratorUnitPattern = selectPlural(pl, numberResult.roundedNumber.times(TEN.pow(exponent)).toNumber(), data2.units.simple[numeratorUnit][unitDisplay]);
|
|
4162
4163
|
var perUnitPattern = data2.units.simple[denominatorUnit].perUnit[unitDisplay];
|
|
@@ -4169,8 +4170,8 @@
|
|
|
4169
4170
|
}
|
|
4170
4171
|
}
|
|
4171
4172
|
var result = [];
|
|
4172
|
-
for (var
|
|
4173
|
-
var part = _d
|
|
4173
|
+
for (var _d = 0, _e = unitPattern.split(/(\s*\{0\}\s*)/); _d < _e.length; _d++) {
|
|
4174
|
+
var part = _e[_d];
|
|
4174
4175
|
var interpolateMatch = /^(\s*)\{0\}(\s*)$/.exec(part);
|
|
4175
4176
|
if (interpolateMatch) {
|
|
4176
4177
|
if (interpolateMatch[1]) {
|
|
@@ -4213,7 +4214,15 @@
|
|
|
4213
4214
|
} else {
|
|
4214
4215
|
integer = n;
|
|
4215
4216
|
}
|
|
4216
|
-
|
|
4217
|
+
var shouldUseGrouping = false;
|
|
4218
|
+
if (useGrouping === "always") {
|
|
4219
|
+
shouldUseGrouping = true;
|
|
4220
|
+
} else if (useGrouping === "min2") {
|
|
4221
|
+
shouldUseGrouping = x.greaterThanOrEqualTo(1e4);
|
|
4222
|
+
} else if (useGrouping === "auto" || useGrouping) {
|
|
4223
|
+
shouldUseGrouping = notation !== "compact" || x.greaterThanOrEqualTo(1e4);
|
|
4224
|
+
}
|
|
4225
|
+
if (shouldUseGrouping) {
|
|
4217
4226
|
var groupSepSymbol = style === "currency" && symbols.currencyGroup != null ? symbols.currencyGroup : symbols.group;
|
|
4218
4227
|
var groups = [];
|
|
4219
4228
|
var integerNumberPattern = decimalNumberPattern.split(".")[0];
|