Skip to content

Commit

Permalink
fix: corrected kebabCase for parameters with numbers (#246)
Browse files Browse the repository at this point in the history
  • Loading branch information
tiwarishubham635 committed Apr 16, 2024
1 parent eb93b79 commit fc4861e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/services/naming-conventions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fc4861e

Please sign in to comment.