@formatjs/intl-pluralrules
Version:
Polyfill for Intl.PluralRules
21 lines (20 loc) • 926 B
JavaScript
/* @generated */
// prettier-ignore
if (Intl.PluralRules && typeof Intl.PluralRules.__addLocaleData === 'function') {
Intl.PluralRules.__addLocaleData({"data":{"categories":{"cardinal":["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 w = decimalPart.replace(/0+$/, "").length;
const t = w > 0 ? parseInt(decimalPart.replace(/0+$/, ""), 10) : 0;
if (isOrdinal) {
}
else {
if (t === 0 && (i % 10) === 1 && (i % 100) !== 11 || (t % 10) === 1 && (t % 100) !== 11)
return "one";
}
return "other";
},"pluralRanges":{"cardinal":{"one_one":"one","one_other":"other","other_one":"one","other_other":"other"},"ordinal":{}}},"locale":"is"})
}