JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 117
  • Score
    100M100P100Q76806F
  • License MIT

Pluralize a word

Package Exports

  • numd

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (numd) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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