(str: string)
| 1 | type JsonValue = string | number | boolean | null | JsonValue[] | { [key: string]: JsonValue }; |
| 2 | |
| 3 | function toSnakeCase(str: string): string { |
| 4 | return str.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`); |
| 5 | } |
| 6 | |
| 7 | function toCamelCase(str: string): string { |
| 8 | return str.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase()); |