let local = {"views":[" просмотр"," просмотра"," просмотров"]}
let Views = (e)=>{
if(e == 1) return e+local.views[0];
if (((e >10) ? e[e.length-1] : e) % 2 == 0) {
return e+local.views[1];
}
return e+local.views[2];
};
const indexes = [2, 0, 1, 1, 1, 2];
/**
*
* @param {number} amount
* @param {string[]} cases For slavic languages: ['яблоко', 'яблока', 'яблок']
* @returns {string}
*/
function pluralize(amount, cases) {
const mod100 = amount % 100;
const mod10 = amount % 10;
const index = (mod100 > 4 && mod100 < 20) ? 2 : indexes[(mod10 < 5) ? mod10 : 5];
return cases[index];
}