(obj: T, context: Record<string, any>, customResolver = (_prefix: string, _expression: string) => '')
| 238 | } |
| 239 | |
| 240 | export function recursiveRender<T extends Record<string, any>>(obj: T, context: Record<string, any>, customResolver = (_prefix: string, _expression: string) => ''): T { |
| 241 | const result = (is.array(obj) ? [] : {}) as Record<string, any>; |
| 242 | for (const [key, value] of Object.entries(obj)) { |
| 243 | const newKey = is.string(key) && key.includes('${') ? render(key, context, customResolver) : key; |
| 244 | |
| 245 | if (is.string(value)) { |
| 246 | result[newKey] = evaluateExpression(value, context, customResolver); |
| 247 | } else if (typeof value === 'object') { |
| 248 | result[newKey] = recursiveRender(value, context, customResolver); |
| 249 | } else { |
| 250 | result[newKey] = value; |
| 251 | } |
| 252 | } |
| 253 | return result as T; |
| 254 | } |
nothing calls this directly
no test coverage detected