[Bug] Fix camel case bug in strings.ts (#6161)

This commit is contained in:
Bertie690 2025-07-27 23:17:46 -04:00 committed by GitHub
parent 3434078329
commit 157b662f9e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -98,7 +98,9 @@ export function toTitleCase(str: string): string {
*/
export function toCamelCase(str: string) {
return splitWords(str)
.map((word, index) => (index === 0 ? word.toLowerCase() : capitalizeFirstLetter(word)))
.map((word, index) =>
index === 0 ? word.toLowerCase() : word.charAt(0).toUpperCase() + word.slice(1).toLowerCase(),
)
.join("");
}