@sensimods/utility-lab
    Preparing search index...

    Function pluralize

    • Pluralizes a given string based on the provided amount. Automatically handles dropping the trailing 'y' for 'ies' endings.

      Parameters

      • amount: number

        The number that determines whether to pluralize the string.

      • str: string

        The string to pluralize.

      • ending: PluralTypes = "s"

        The type of pluralization to apply (default is "s").

      Returns string

      The pluralized string if amount is not 1, otherwise returns the original string.

      pluralize(1, "cat") // "cat"
      pluralize(2, "cat") // "cats"