(name: string)
| 88 | str.replace(new RegExp(escapeRegExp(find), "g"), replace); |
| 89 | |
| 90 | export function stringToClassName(name: string): string { |
| 91 | const words = name.split(/[^a-zA-Z0-9]+/); |
| 92 | const camelCaseWords = words.map((word, index) => { |
| 93 | if (index === 0) { |
| 94 | const cleanedWord = word.replace(/^[^a-zA-Z]+/g, ""); |
| 95 | return ( |
| 96 | cleanedWord.charAt(0).toUpperCase() + cleanedWord.slice(1).toLowerCase() |
| 97 | ); |
| 98 | } |
| 99 | return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase(); |
| 100 | }); |
| 101 | return camelCaseWords.join(""); |
| 102 | } |
no outgoing calls
no test coverage detected