API Reference

Returns a singular or pluralized string based on a provided number. Pluralized version defaults to the letter S appended to the singular form.

function plural(n: number, singular: string, plural?: string): string {}

// Example:

plural(4, "apple") //=> "apples"
 
plural(1, "orange") //=> "orange"

const personCount = 2

const personPhrase = plural(personCount, "person is", "people are")
 
`${personCount} ${personPhrase} here.` //=> "2 people are here."