Skip to content

Function: pluralize()

pluralize(count, noun): string

Format a count with its noun, pluralizing (naive +s) unless the count is 1: pluralize(1, "barrel") -> "1 barrel", pluralize(3, "barrel") -> "3 barrels". Collapses the ${n} noun${n === 1 ? "" : "s"} idiom.

number

string

string