Version: v0.7.0 - Beta.  We welcome contributors & feedback.

String.plural

plural($quantity, $pluralWord = '') -> string

Description

Return the plural form if $quantity is not 1.

By default, it appends 's' or 'es'. Otherwise it returns $pluralWord.

'duck'.plural(1)
//= 'duck'

'duck'.plural(2)
//= 'ducks'

'horse'.plural(3)
//= 'horses'

'goose'.plural(1, 'geese')
//= 'goose'

'goose'.plural(2, 'geese')
//= 'geese'

See Also