plural

rule-based plural library

npm install plural
10 downloads in the last week
15 downloads in the last month

plural

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

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

npm loves you