Module: js-whatever/js/discrete-plural

js-whatever/js/discrete-plural

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
count number

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
Copyright 2013-2018 Micro Focus International plc. Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
Documentation generated by JSDoc 3.4.3 on Thu Jun 21st 18:04 2018 using the DocStrap template.