From 6dd24c0371dd40bc0e38c90c1f5494673d09f220 Mon Sep 17 00:00:00 2001 From: CPD MSBench Runner Date: Mon, 25 May 2026 20:59:06 +0000 Subject: [PATCH] fix: handle empty names in greet function - Add validation for empty or whitespace-only names - Return default greeting for invalid input Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/greet.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/greet.ts b/src/greet.ts index 08c455b..9a99423 100755 --- a/src/greet.ts +++ b/src/greet.ts @@ -1,3 +1,6 @@ export function greet(name: string): string { + if (!name || name.trim().length === 0) { + return "Hi there!"; + } return `Hi, ${name}!`; }