Skip to content
forked from swang/plural

Rule-based plural library for node.js

Notifications You must be signed in to change notification settings

ivolkoff/plural

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

plural

Plural is a rule-based plural library for node.js

Build Status

install

npm install plural

example

var plural = require('plural')

console.log(plural('zebra', 1)) // returns singular 'zebra'
console.log(plural('zebra', 2)) // returns 'zebras'
console.log(plural('zebra')) // returns 'zebras' (if no parameters, always returns plural)
zebra
zebras
zebras

you can also force it to monkeypatch onto the String prototype

var plural = require('plural')
plural.monkeyPatch()

console.log('zebra'.plural(1))
console.log('zebra'.plural(2))
console.log('zebra'.plural())
zebra
zebras
zebras

you can remove it from the String prototype by using plural.unmonkeyPatch()

license

MIT

About

Rule-based plural library for node.js

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%