@formatjs/intl-pluralrules 7.0.0 → 7.0.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/index.js +20 -15
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/polyfill-force.js +20 -15
- package/polyfill-force.js.map +1 -1
- package/polyfill.iife.js +49 -30
- package/polyfill.js +20 -15
- package/polyfill.js.map +1 -1
package/index.js
CHANGED
|
@@ -748,19 +748,15 @@ function ApplyUnsignedRoundingMode(x, r1, r2, unsignedRoundingMode) {
|
|
|
748
748
|
return r2;
|
|
749
749
|
}
|
|
750
750
|
// packages/ecma402-abstract/NumberFormat/decimal-cache.js
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
*/
|
|
761
|
-
const getPowerOf10 = memoize((exponent) => {
|
|
762
|
-
return Decimal.pow(10, exponent);
|
|
763
|
-
});
|
|
751
|
+
const powersOfTen = /* @__PURE__ */ new Map();
|
|
752
|
+
function getPowerOf10(exponent) {
|
|
753
|
+
const n = typeof exponent === "number" ? exponent : exponent.toNumber();
|
|
754
|
+
const cached = powersOfTen.get(n);
|
|
755
|
+
if (cached !== void 0) return cached;
|
|
756
|
+
const power = Decimal.pow(10, n);
|
|
757
|
+
if (Number.isInteger(n) && n >= -324 && n <= 324) powersOfTen.set(n, power);
|
|
758
|
+
return power;
|
|
759
|
+
}
|
|
764
760
|
// packages/ecma402-abstract/NumberFormat/ToRawFixed.js
|
|
765
761
|
function ToRawFixedFn(n, f) {
|
|
766
762
|
return n.times(getPowerOf10(-f));
|
|
@@ -782,10 +778,19 @@ function findN2R2(x, f, roundingIncrement) {
|
|
|
782
778
|
/**
|
|
783
779
|
* https://tc39.es/ecma402/#sec-torawfixed
|
|
784
780
|
* @param x a finite non-negative Number or BigInt
|
|
785
|
-
* @param minFraction an integer between 0 and
|
|
786
|
-
* @param maxFraction an integer between 0 and
|
|
781
|
+
* @param minFraction an integer between 0 and 100
|
|
782
|
+
* @param maxFraction an integer between 0 and 100
|
|
787
783
|
*/
|
|
788
784
|
function ToRawFixed(x, minFraction, maxFraction, roundingIncrement, unsignedRoundingMode) {
|
|
785
|
+
if (roundingIncrement === 1 && x.isInteger()) {
|
|
786
|
+
const integer = x.toString();
|
|
787
|
+
return {
|
|
788
|
+
formattedString: integer + (minFraction === 0 ? "" : "." + repeat("0", minFraction)),
|
|
789
|
+
roundedNumber: x,
|
|
790
|
+
integerDigitsCount: integer.length,
|
|
791
|
+
roundingMagnitude: -maxFraction
|
|
792
|
+
};
|
|
793
|
+
}
|
|
789
794
|
const f = maxFraction;
|
|
790
795
|
const { n1, r1 } = findN1R1(x, f, roundingIncrement);
|
|
791
796
|
const { n2, r2 } = findN2R2(x, f, roundingIncrement);
|