Skip to content

Commit

Permalink
fix: improved safety on capitalize
Browse files Browse the repository at this point in the history
  • Loading branch information
flauc committed Feb 10, 2025
1 parent 49bdf9b commit 4cdf176
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/capitalize/capitalize.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
export function capitalize(word: string) {

if (!word) {
return '';
}

return word.charAt(0).toUpperCase() + word.slice(1);
}

0 comments on commit 4cdf176

Please sign in to comment.