Documentation for Simbo's Packages
    Preparing search index...

    Function plural

    • Format a count with the appropriate singular or plural word.

      A count can be a number or a string that can be parsed to a number.

      If the parsed count is NaN, it defaults to 0.

      Parameters

      • count: string | number

        The count of items.

      • singularWord: string

        The singular form of the word.

      • OptionalpluralWord: string

        The plural form of the word. If not provided, defaults to the singular form with an "s" appended.

      • template: string = '%d %s'

        The template string to format the output. Occurrences of "%d" for the count and "%s" for the word will be replaced. Defaults to "%d %s".

      Returns string

      The rendered template string.