unique-username-generator icon indicating copy to clipboard operation
unique-username-generator copied to clipboard

capitalize option capitalizes only first word

Open DenserMeerkat opened this issue 1 year ago • 2 comments
trafficstars

The capital option will capitalize each word of the unique username generated

According to docs it's mentioned each word will get capitalized, but in use only the first word gets capitalized.

DenserMeerkat avatar Apr 29 '24 08:04 DenserMeerkat

you just need to make your own utility

export function capitalize(str: string) {
  return str.charAt(0).toUpperCase() + str.slice(1);
}

example usage

const username = capitalize(generateUsername())
console.log(username);
// Blossomlogistical

Sisableng avatar May 29 '24 08:05 Sisableng

@Sisableng Yes, but the doc incorrectly says all words are capitalized.

DenserMeerkat avatar May 29 '24 12:05 DenserMeerkat