Member Junction
    Preparing search index...

    Function GeneratePluralName

    • Converts a singular name to its plural form. The head of the name is kept verbatim, including the separator that ends it, and only the tail is pluralized. The tail keeps its own case. A linear scan finds the tail: the last space, underscore, or hyphen, or else the last Unicode capital that starts a word. A regex over ASCII letters is not used, because it drops a leading character such as Ä and it erases the underscore that distinguishes user_profile from userProfile.

      Parameters

      • singularName: string

        The singular form of the name to pluralize.

      • Optionaloptions: { capitalizeEntireWord?: boolean; capitalizeFirstLetterOnly?: boolean }

      Returns string

      The plural form of the name.

      GeneratePluralName('child'); // returns 'children'
      GeneratePluralName('box'); // returns 'boxes'
      GeneratePluralName('party'); // returns 'parties'
      GeneratePluralName('dog'); // returns 'dogs'
      GeneratePluralName('Contact Person'); // returns 'Contact People'
      GeneratePluralName('user_profile', { capitalizeFirstLetterOnly: true }); // returns 'user_Profiles'