From fc4861ef6a2f1866088ee24adedee47516a7dcb0 Mon Sep 17 00:00:00 2001 From: Shubham Date: Tue, 16 Apr 2024 22:22:34 +0530 Subject: [PATCH] fix: corrected kebabCase for parameters with numbers (#246) --- src/services/naming-conventions.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/services/naming-conventions.js b/src/services/naming-conventions.js index c01e3a29..04ed35dc 100644 --- a/src/services/naming-conventions.js +++ b/src/services/naming-conventions.js @@ -3,6 +3,7 @@ const kebabCase = (input) => { .trim() .replace(/[ _]/g, '-') // from snake_case (or spaces) .replace(/([a-z\d])([A-Z])/g, '$1-$2') // from PascalCase or camelCase + .replace(/(\d[A-Z]*)([A-Z])/g, '$1-$2') // handling numbers followed by letters .toLowerCase() .replace(/-+/g, '-') // remove duplicate dashes .replace(/^-|-$/g, ''); // remove leading and trailing dashes