require("js-whatever/js/discrete-plural")(singular, plural) → {DiscretePluralFunction}
Generates a function which returns a pluralised form for a given number of items
Parameters:
| Name | Type | Description |
|---|---|---|
singular |
string | The singular form of the string |
plural |
string | The plural form of the string |
- Source:
Returns:
The DiscretePluralFunction for the two strings
- Type
- DiscretePluralFunction
Example
var pluralFunction = discretePlural('kitten', 'kittens');
pluralFunction(1); // returns '1 kitten'
pluralFunction(-1); // returns '-1 kitten'
pluralFunction(3); // returns '3 kittens'
pluralFunction(1.5); //returns ''
- Source:
Type Definitions
-
DiscretePluralFunction(count) → {string}
-
Parameters:
Name Type Description countnumber The number of items
- Source:
Returns:
The empty string for non-integer numbers. The singular string for the numbers 1 and -1. The
plural string for all other numbers.- Type
- string