@os-team/plural-forms
v1.0.12
Published
Declines nouns in the plural form. English and Russian languages are supported.
Downloads
180
Readme
@os-team/plural-forms
Declines nouns in the plural form. English and Russian languages are supported.
Usage
Install the package using the following command:
yarn add @os-team/plural-forms
Example 1. English language
const years = 21;
const yearsPluralForm = pluralForms({
language: 'en',
forms: ['year', 'years'],
number: years,
});
console.log(`${years} ${yearsPluralForm}`); // 21 years
Example 2. Russian language
const years = 21;
const yearsPluralForm = pluralForms({
language: 'ru',
forms: ['год', 'года', 'лет'],
number: years,
});
console.log(`${years} ${yearsPluralForm}`); // 21 год