(str: string)
| 89 | } |
| 90 | |
| 91 | export function toPascalCase(str: string): string { |
| 92 | const words = str.trim().toLowerCase().split(wordSplitRegex); |
| 93 | return words.reduce((acc, curr) => { |
| 94 | const [firstChar, ...rest] = curr; |
| 95 | const pascalCaseWord = firstChar?.toUpperCase()?.concat(rest.join('')) ?? ''; |
| 96 | return acc + pascalCaseWord; |
| 97 | }, ''); |
| 98 | } |
| 99 | |
| 100 | export function toSnakeCase(str: string): string { |
| 101 | const words = str.trim().toLowerCase().split(wordSplitRegex); |
no test coverage detected