Skip to content

Commit

Permalink
feat: add formatted text function
Browse files Browse the repository at this point in the history
  • Loading branch information
Kleostro committed May 9, 2024
1 parent 2ccb7f8 commit ce8751d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/shared/utils/formattedText.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const formattedText = (text: string): string =>
text
.trim()
.split(' ')
.map((word) => (word[0] ? word[0].toUpperCase() + word.slice(1).toLowerCase() : ''))
.join(' ');

export default formattedText;

0 comments on commit ce8751d

Please sign in to comment.