Skip to content

Commit

Permalink
feat: format
Browse files Browse the repository at this point in the history
  • Loading branch information
shiliuzi8686 committed Dec 10, 2024
1 parent 10db390 commit 21d2ed5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export const pascal = (str: string): string => {
* title('ABC_content') -> 'Abc Content'
*/
export const title = (str: string | null | undefined): string => {
if (!str) return '';
if (!str) return ''

return str
.split(/(?=[A-Z][a-z])|[\.\-\s_]/)
Expand All @@ -110,11 +110,11 @@ export const title = (str: string | null | undefined): string => {
.map(s => {
if (s === s.toUpperCase()) {
// If the entire string segment is uppercase, capitalize it properly
return capitalize(s.toLowerCase());
return capitalize(s.toLowerCase())
}
return capitalize(s);
return capitalize(s)
})
.join(' ');
.join(' ')
}

/**
Expand Down

0 comments on commit 21d2ed5

Please sign in to comment.