From 6f256e44fc4290c342d84c9076d0bd717e24a2f2 Mon Sep 17 00:00:00 2001 From: Bauke Date: Fri, 22 Dec 2023 14:36:29 +0100 Subject: [PATCH] Add a capitalize utility function. --- source/utilities/text.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/utilities/text.ts b/source/utilities/text.ts index 139f581..2a17e50 100644 --- a/source/utilities/text.ts +++ b/source/utilities/text.ts @@ -25,3 +25,10 @@ export async function hashSha256(input: string): Promise { .map((byte) => byte.toString(16).padStart(2, "0")) .join(""); } + +/** + * Capitalize the input string by making the first character in it uppercase. + */ +export function capitalize(input: string): string { + return input[0].toUpperCase() + input.slice(1); +}