@formatjs/intl-pluralrules
Version:
Polyfill for Intl.PluralRules
28 lines (27 loc) • 1.05 kB
JavaScript
/* @generated */
// prettier-ignore
if (Intl.PluralRules && typeof Intl.PluralRules.__addLocaleData === 'function') {
Intl.PluralRules.__addLocaleData({"data":{"categories":{"cardinal":["one","other"],"ordinal":["few","many","one","other","two"]},"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)));
if (isOrdinal) {
if (n === 4)
return "few";
if (n === 6)
return "many";
if ((((((n === 1 || n === 5) || n === 7) || n === 8) || n === 9) || n === 10))
return "one";
if ((n === 2 || n === 3))
return "two";
}
else {
if (i === 0 || n === 1)
return "one";
}
return "other";
},"pluralRanges":{"cardinal":{"one_one":"one","one_other":"other","other_other":"other"},"ordinal":{}}},"locale":"bn"})
}