One of the best alternatives is plur
Pluralize formats a word according to a given number. With Typescript under the hood you will be able to write nice and shiny code.
Add pluralize to your project by running:
npm install @public-js/pluralize --save
Then import it with any of these:
import { Pluralize } from '@public-js/pluralize';
import { pluralizeEn } from '@public-js/pluralize';
import * as pluralize from '@public-js/pluralize';
const pluralize = require('@public-js/pluralize');
Example:
const amount = 10;
const amountText = pluralizeEn(amount, ['child', 'children']);
console.log(`${amount} ${amountText}`); // '10 children'
Example:
const amount = 10;
const amountText = pluralizeRu(amount, ['ребенок', 'ребенка', 'детей']);
console.log(`${amount} ${amountText}`); // '10 детей'