(str: string)
| 4 | export const capitalize = (str: string): string => str.charAt(0).toUpperCase() + str.substr(1) |
| 5 | |
| 6 | export function slugify(str: string): string { |
| 7 | return str |
| 8 | .toLowerCase() |
| 9 | .replace(/-/g, ' ') |
| 10 | .replace(/[^\w\s]/g, ' ') |
| 11 | .trim() |
| 12 | .replace(/\s+/g, '-') |
| 13 | } |
| 14 | |
| 15 | /** |
| 16 | * camelCase to kebab-case |