Skip to main content

pluralize

Callable

  • pluralize(total: number): (strings: TemplateStringsArray, ...tokens: string[][]) => string

  • Returns a function that takes a TemplateStringsArray and an array of tokens and returns a string by concatenating the interpolated values of the strings and tokens.

    @example
    pluralize(2)`packag${['e', 'es']} agenc${['y', 'ies']}` // packages agencies

    Parameters

    • total: number

      The total number of items.

    Returns (strings: TemplateStringsArray, ...tokens: string[][]) => string

    The function that takes a TemplateStringsArray and an array of tokens and returns the final string.

      • (strings: TemplateStringsArray, ...tokens: string[][]): string
      • Parameters

        • strings: TemplateStringsArray
        • rest...tokens: string[][]

        Returns string