@formatjs/intl-pluralrules
Version:
Polyfill for Intl.PluralRules
23 lines (22 loc) • 1.18 kB
JavaScript
/* @generated */
// prettier-ignore
if (Intl.PluralRules && typeof Intl.PluralRules.__addLocaleData === 'function') {
Intl.PluralRules.__addLocaleData({"data":{"categories":{"cardinal":["few","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 i = Math.floor(Math.abs(parseFloat(integerPart)));
const v = decimalPart.length;
const f = v > 0 ? parseInt(decimalPart, 10) : 0;
if (isOrdinal) {
}
else {
if (v === 0 && ((i % 10) >= 2 && (i % 10) <= 4) && ((i % 100) < 12 || (i % 100) > 14) || ((f % 10) >= 2 && (f % 10) <= 4) && ((f % 100) < 12 || (f % 100) > 14))
return "few";
if (v === 0 && (i % 10) === 1 && (i % 100) !== 11 || (f % 10) === 1 && (f % 100) !== 11)
return "one";
}
return "other";
},"pluralRanges":{"cardinal":{"few_few":"few","few_one":"one","few_other":"other","one_few":"few","one_one":"one","one_other":"other","other_few":"few","other_one":"one","other_other":"other"},"ordinal":{}}},"locale":"bs"})
}