From d765105c8d4f775391fb7540354744fd39222cdc Mon Sep 17 00:00:00 2001 From: Aaron Diaz Date: Tue, 15 Oct 2024 23:44:41 -0600 Subject: [PATCH] Improved utility function --- src/utils/index.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/utils/index.ts b/src/utils/index.ts index c03d8aa..0e79cfe 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -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(" "); };