nouns-number

2.1.0 • Public • Published

nouns-number

A simple selection of the noun case by number

npm npm npm

Syntax

getNoun(array, number)

Params

Param Type Required Description
array string[] true Array with nouns to select
number number true the number on which the noun depends

Examples

import { getNoun } from 'nouns-number'

const array = ['минута', 'минуты', 'минут']

getNoun(array, 1); // -> минута
getNoun(array, 2); // -> минуты
getNoun(array, 5); // -> минут

const count = 2;
const totalMessage = `Прошло всего ${count} ${getNoun(array, count)}`; // -> Прошло всего 2 минуты

/nouns-number/

    Package Sidebar

    Install

    npm i nouns-number

    Weekly Downloads

    0

    Version

    2.1.0

    License

    MIT

    Unpacked Size

    2.21 kB

    Total Files

    3

    Last publish

    Collaborators

    • pirate_jack