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

    Function plural

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

      String counts are converted with Number and truncated toward zero. Invalid strings default to 0; numeric counts are used as provided. Words are inserted literally, including dollar-sign replacement sequences.

      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 are replaced once each. Defaults to "%d %s".

      Returns string

      The rendered template string.