Function pluralize

  • Take a string and pluralize it depending on a count

    Example

    pluralize('cake', 1) === 'cake'
    

    Example

    pluralize('cake', 2) === 'cakes'
    

    Example

    pluralize('cake', 0) === 'cakes'
    

    Example

    pluralize('child', 2, 'children') === 'children'
    

    Parameters

    • str: string

      The singular form of the word

    • count: number

      The amount of things you have

    • plural: string = ...

      Optionally, a plural form of the word. This is str with an s on the end by default.

    Returns string

Generated using TypeDoc