Socket
Book a DemoInstallSign in
Socket

numd

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

numd

Pluralize a word

latest
Source
npmnpm
Version
3.1.0
Version published
Weekly downloads
90
-45.12%
Maintainers
1
Weekly downloads
 
Created
Source

numd Build Status

Pluralize a word

  • 1 dollar, 5 dollars
  • 1 рубль, 2 рубля, 5 рублей

Install

npm install --save numd

Usage

import numd from 'numd';

numd(2, 'dollar', 'dollars'); // 2 dollars
numd(14, 'рубль', 'рубля', 'рублей'); // 14 рублей

API

numd([num, ]word[, singular], plural)

Return a string if num is defined:

numd(1, 'dollar', 'dollars'); // 1 dollar
numd(1, 'рубль', 'рубля', 'рублей'); // 1 рубль

otherwise return a function:

const rur = numd('рубль', 'рубля', 'рублей');
rur(4); // 4 рубля
rur(51); // 51 рубль

num

Type: number

Count to determine a word.

word

Type: string

Word in the nominative singular.

singular

Type: string

Word in the genitive singular, not used for English words and some other languages.

plural

Type: string

Word in the plural/genitive plural.

License

MIT

Keywords

number

FAQs

Package last updated on 15 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts