(templatedYaml: string)
| 83 | export const TEMPLATE_VAR_REGEX = /\${{[\s]*([^}\s]+)[\s]*}}/g; |
| 84 | |
| 85 | export function getTemplateVariables(templatedYaml: string): string[] { |
| 86 | // Defensive guard against undefined/null/non-string values |
| 87 | if (!templatedYaml || typeof templatedYaml !== "string") { |
| 88 | return []; |
| 89 | } |
| 90 | |
| 91 | const variables = new Set<string>(); |
| 92 | const matches = templatedYaml.matchAll(TEMPLATE_VAR_REGEX); |
| 93 | for (const match of matches) { |
| 94 | variables.add(match[1]); |
| 95 | } |
| 96 | return Array.from(variables); |
| 97 | } |
| 98 | |
| 99 | export function fillTemplateVariables( |
| 100 | templatedYaml: string, |
no test coverage detected