Skip to content

cyan33/sane-plural

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sane-plural

Build Status

The sane way to get the plural form of nouns.

Full document

Usage

npm install --save sane-plural

Instead of:

var amount = 5
console.log(`${amount > 1 ? 'record' : 'records'}.`)  // records

Do:

import plural from 'sane-plural'

var amount = 5
console.log(`${plural('record', amount)}`)  // "records"

You can also provide fallbacks to the function call, or add global customized rules. See more here

Motivation

There is an npm package called plural, but for the last two years no one has been maintaining it and the API seems to me a little bit un-intuitive. So I decided to write one my own.

About

get the plural form in a sane way

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published