@formatjs/intl-pluralrules
Version:
Polyfill for Intl.PluralRules
24 lines (23 loc) • 933 B
JavaScript
/* @generated */
// prettier-ignore
if (Intl.PluralRules && typeof Intl.PluralRules.__addLocaleData === 'function') {
Intl.PluralRules.__addLocaleData({"data":{"categories":{"cardinal":["many","one","other"],"ordinal":["other"]},"fn":function(num, isOrdinal, exponent = 0) {
const numStr = String(num);
const parts = numStr.split(".");
const integerPart = parts[0];
const decimalPart = parts[1] || "";
const n = Math.abs(parseFloat(numStr));
const i = Math.floor(Math.abs(parseFloat(integerPart)));
const v = decimalPart.length;
const e = exponent;
if (isOrdinal) {
}
else {
if (e === 0 && i !== 0 && (i % 1000000) === 0 && v === 0 || (e < 0 || e > 5))
return "many";
if (n === 1)
return "one";
}
return "other";
},"pluralRanges":{"cardinal":{"one_other":"other","other_one":"other","other_other":"other"},"ordinal":{}}},"locale":"es"})
}