Skip to content

techieshark/plural-for

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

plural-for: tiny node module to pluralize English words

Greenkeeper badge

This is meant to be small and stupidly simple.

For the absolutely simplest alternative, see sorp.

For smarter/bigger options, you've got:

Install

npm install --save plural-for

Example Usage

var pluralFor = require('plural-for')
var asWord = require('zero-to-nine').asWord

let nOcelots = 0
let nWolves = 2

console.log(`There will be ${asWord(nOcelots)} ${pluralFor(nOcelots, 'ocelot')} left after building the wall.`)
// output: "There will be zero ocelots left after building the wall."

console.log(`There will be only ${asWord(nWolves)} Mexican gray ${pluralFor(nWolves, 'wolf', 'wolves')} left, sadly.`)
// output: There will be only two Mexican gray wolves left, sadly.

See also: more about biodiversity threats example.

About

Pluralize English words (stupidly simple code)

Resources

Stars

Watchers

Forks

Packages

No packages published