Skip to content

Latest commit

 

History

History
49 lines (28 loc) · 874 Bytes

File metadata and controls

49 lines (28 loc) · 874 Bytes

ts-humanize v1.0.0


ts-humanize / pluralWord

Function: pluralWord()

pluralWord(quantity, singular, plural?): string

Defined in: english/words.ts:37

pluralWord builds the plural form of an English word.

The simple English rules of regular pluralization will be used if the plural arg is empty/undefined.

Parameters

quantity

number

The number of things of the singular.

singular

string

The string to to be converted.

plural?

string

The optional plural case.

Returns

string

Example

pluralWord(1, "cat"); // returns "cat"
pluralWord(2, "cat"); // returns "cats"
pluralWord(2, "index"); // returns "indices"
pluralWord(2, "baby"); // returns "babies"