@eroyeroy/utils - v0.1.0
    Preparing search index...

    Function formatPlural

    • Returns the singular or plural form of a word based on count. If plural is not provided, appends "s" to singular.

      Parameters

      • count: number

        The quantity.

      • singular: string

        Singular form of the word.

      • Optionalplural: string

        Optional plural form. Defaults to singular + "s".

      Returns string

      formatPlural(1, "item")           // => "item"
      formatPlural(3, "item") // => "items"
      formatPlural(2, "person", "people") // => "people"