Skip to content

Commit

Permalink
Improved utility function
Browse files Browse the repository at this point in the history
  • Loading branch information
aaron-diaz committed Oct 16, 2024
1 parent 3159c19 commit d765105
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,11 @@ export const capitalizeInitials = (words: string): string => {
const separated = words.split(" ").filter((word) => word.length);
return separated
.map((word) => {
const lower = word.toLowerCase();
let initial = lower[0];
let initial = word[0];
if ("a" <= initial && initial <= "z") {
initial += -32;
}
return initial + lower.substring(1);
return initial + word.substring(1).toLowerCase();
})
.join(" ");
};

0 comments on commit d765105

Please sign in to comment.