From 911d7f72f3b35351300018a6916e95d515d468e5 Mon Sep 17 00:00:00 2001 From: emreumar Date: Sat, 18 Jul 2026 13:07:14 +0300 Subject: [PATCH] fix(business): collapse repeated whitespaces in username normalization Updates normalizeUsername to collapse and replace all consecutive whitespace sequences with a single hyphen using regex '/\s+/g' instead of replacing only the first space. Closes #27 Signed-off-by: emreumar --- src/business.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/business.js b/src/business.js index a8f0cd0..247232d 100644 --- a/src/business.js +++ b/src/business.js @@ -18,7 +18,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) {