(input: string, replacements: Record<string, string>)
| 60 | |
| 61 | // find strings that match ${varName} and replace with the value from a Record<string, string> where { varName: "value" } |
| 62 | export function replaceAll(input: string, replacements: Record<string, string>) { |
| 63 | let output = input; |
| 64 | for (const [key, value] of Object.entries(replacements)) { |
| 65 | output = output.replace(new RegExp(`\\$\\{${key}\\}`, "g"), value); |
| 66 | } |
| 67 | return output; |
| 68 | } |
no test coverage detected
searching dependent graphs…