@formatjs/intl-pluralrules 5.1.3 → 5.1.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.
- package/package.json +3 -3
- package/polyfill.iife.js +55 -18
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formatjs/intl-pluralrules",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.5",
|
|
4
4
|
"description": "Polyfill for Intl.PluralRules",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"polyfill",
|
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
"url": "git+https://github.com/formatjs/formatjs.git"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@formatjs/ecma402-abstract": "1.
|
|
23
|
+
"@formatjs/ecma402-abstract": "1.14.0",
|
|
24
24
|
"@formatjs/intl-localematcher": "0.2.31",
|
|
25
25
|
"tslib": "2.4.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@formatjs/intl-getcanonicallocales": "2.0.4",
|
|
29
|
-
"@formatjs/intl-locale": "3.0.
|
|
29
|
+
"@formatjs/intl-locale": "3.0.8"
|
|
30
30
|
},
|
|
31
31
|
"bugs": {
|
|
32
32
|
"url": "https://github.com/formatjs/formatjs/issues"
|
package/polyfill.iife.js
CHANGED
|
@@ -614,25 +614,62 @@
|
|
|
614
614
|
var mnsd = opts.minimumSignificantDigits;
|
|
615
615
|
var mxsd = opts.maximumSignificantDigits;
|
|
616
616
|
internalSlots.minimumIntegerDigits = mnid;
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
617
|
+
var roundingPriority = GetOption(opts, "roundingPriority", "string", ["auto", "morePrecision", "lessPrecision"], "auto");
|
|
618
|
+
var hasSd = mnsd !== void 0 || mxsd !== void 0;
|
|
619
|
+
var hasFd = mnfd !== void 0 || mxfd !== void 0;
|
|
620
|
+
var needSd = true;
|
|
621
|
+
var needFd = true;
|
|
622
|
+
if (roundingPriority === "auto") {
|
|
623
|
+
needSd = hasSd;
|
|
624
|
+
if (hasSd || !hasFd && notation === "compact") {
|
|
625
|
+
needFd = false;
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
if (needSd) {
|
|
629
|
+
if (hasSd) {
|
|
630
|
+
mnsd = DefaultNumberOption(mnsd, 1, 21, 1);
|
|
631
|
+
mxsd = DefaultNumberOption(mxsd, mnsd, 21, 21);
|
|
632
|
+
internalSlots.minimumSignificantDigits = mnsd;
|
|
633
|
+
internalSlots.maximumSignificantDigits = mxsd;
|
|
634
|
+
} else {
|
|
635
|
+
internalSlots.minimumSignificantDigits = 1;
|
|
636
|
+
internalSlots.maximumSignificantDigits = 21;
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
if (needFd) {
|
|
640
|
+
if (hasFd) {
|
|
641
|
+
mnfd = DefaultNumberOption(mnfd, 0, 20, void 0);
|
|
642
|
+
mxfd = DefaultNumberOption(mxfd, 0, 20, void 0);
|
|
643
|
+
if (mnfd === void 0) {
|
|
644
|
+
mnfd = Math.min(mnfdDefault, mxfd);
|
|
645
|
+
} else if (mxfd === void 0) {
|
|
646
|
+
mxfd = Math.max(mxfdDefault, mnfd);
|
|
647
|
+
} else if (mnfd > mxfd) {
|
|
648
|
+
throw new RangeError("Invalid range, ".concat(mnfd, " > ").concat(mxfd));
|
|
649
|
+
}
|
|
650
|
+
internalSlots.minimumFractionDigits = mnfd;
|
|
651
|
+
internalSlots.maximumFractionDigits = mxfd;
|
|
652
|
+
} else {
|
|
653
|
+
internalSlots.minimumFractionDigits = mnfdDefault;
|
|
654
|
+
internalSlots.maximumFractionDigits = mxfdDefault;
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
if (needSd || needFd) {
|
|
658
|
+
if (roundingPriority === "morePrecision") {
|
|
659
|
+
internalSlots.roundingType = "morePrecision";
|
|
660
|
+
} else if (roundingPriority === "lessPrecision") {
|
|
661
|
+
internalSlots.roundingType = "lessPrecision";
|
|
662
|
+
} else if (hasSd) {
|
|
663
|
+
internalSlots.roundingType = "significantDigits";
|
|
664
|
+
} else {
|
|
665
|
+
internalSlots.roundingType = "fractionDigits";
|
|
666
|
+
}
|
|
632
667
|
} else {
|
|
633
|
-
internalSlots.roundingType = "
|
|
634
|
-
internalSlots.minimumFractionDigits =
|
|
635
|
-
internalSlots.maximumFractionDigits =
|
|
668
|
+
internalSlots.roundingType = "morePrecision";
|
|
669
|
+
internalSlots.minimumFractionDigits = 0;
|
|
670
|
+
internalSlots.maximumFractionDigits = 0;
|
|
671
|
+
internalSlots.minimumSignificantDigits = 1;
|
|
672
|
+
internalSlots.maximumSignificantDigits = 2;
|
|
636
673
|
}
|
|
637
674
|
}
|
|
638
675
|
|