ezyVet Javascript Helper Library Documentation
    Preparing search index...

    Function pluralize

    • Returns the singular or plural form of a word based on a count.

      Parameters

      • count: number

        the count driving pluralisation

      • singular: string

        the singular form of the word

      • Optionalplural: string = ...

        the plural form of the word — defaults to ${singular}s

      Returns string

      singular when count is exactly 1, plural otherwise

      pluralize(1, 'product');
      // returns 'product'
      pluralize(2, 'product');
      // returns 'products'
      pluralize(3, 'organisation level', 'organisation levels');
      // returns 'organisation levels'