* Interpolate placeholders in a string with context values. * Placeholders use the format: {{key}}
(text: string, context: ErrorContext)
| 86 | * Placeholders use the format: {{key}} |
| 87 | */ |
| 88 | private static interpolate (text: string, context: ErrorContext): string { |
| 89 | return text.replace(/\{\{(\w+)\}\}/g, (match, key) => { |
| 90 | const value = context[key]; |
| 91 | if (value === undefined) { |
| 92 | return match; // Keep placeholder if no value provided |
| 93 | } |
| 94 | return String(value); |
| 95 | }); |
| 96 | } |
| 97 | |
| 98 | /** |
| 99 | * Deep interpolate an object, replacing all string placeholders with context values. |
no test coverage detected