From 9df7d9a90dcdc4a61ee621e6fc4bbb689d3e0a8f Mon Sep 17 00:00:00 2001 From: Prajjwaltripathi20 Date: Wed, 24 Jun 2026 10:08:42 +0530 Subject: [PATCH] fix: collapse repeated whitespace in usernames --- src/business.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/business.js b/src/business.js index a8f0cd0..04a43aa 100644 --- a/src/business.js +++ b/src/business.js @@ -17,8 +17,7 @@ function totalCart(items) { } function normalizeUsername(username) { - // BUG: replaces only the first space and does not collapse repeated whitespace. - return username.trim().toLowerCase().replace(' ', '-'); + return username.trim().toLowerCase().replace(/\s+/g, '-'); } function estimateShipping(weightKg, expedited = false) {