| 125 | |
| 126 | function deepen(modifyString: (source: string) => string) { |
| 127 | function modifyObject<T>(source: T): T { |
| 128 | if (typeof source !== 'object' || !source) return source; |
| 129 | if (Array.isArray(source)) return source.map(modifyObject) as any; |
| 130 | const result = {} as any; |
| 131 | for (const key in source) { |
| 132 | result[modifyString(key)] = modifyObject(source[key]); |
| 133 | } |
| 134 | return result as T; |
| 135 | } |
| 136 | |
| 137 | return function t<T>(source: T): T { |
| 138 | if (typeof source === 'string') return modifyString(source) as any; |