The Wayback Machine - https://web.archive.org/web/20200910045139/https://github.com/swang/plural
Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

plural

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

Build Status

this library's aim is to convert most words into their plural form. it's not going to handle every single case but you can fill those in with your own rules (using plural.addRule)

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

Topics

Resources

Packages

No packages published
You can’t perform that action at this time.