MCPcopy Create free account
hub / github.com/continuedev/continue / fillTemplateVariables

Function fillTemplateVariables

packages/config-yaml/src/load/unroll.ts:99–116  ·  view source on GitHub ↗
(
  templatedYaml: string,
  data: { [key: string]: string },
)

Source from the content-addressed store, hash-verified

97}
98
99export function fillTemplateVariables(
100 templatedYaml: string,
101 data: { [key: string]: string },
102): string {
103 // Defensive guard against undefined/null/non-string values
104 if (!templatedYaml || typeof templatedYaml !== "string") {
105 return "";
106 }
107
108 return templatedYaml.replace(TEMPLATE_VAR_REGEX, (match, variableName) => {
109 // Inject data
110 if (variableName in data) {
111 return data[variableName];
112 }
113 // If variable doesn't exist, return the original expression
114 return match;
115 });
116}
117
118export interface TemplateData {
119 inputs: Record<string, string> | undefined;

Callers 4

renderSecretsFunction · 0.85
unroll.test.tsFile · 0.85
replaceInputsWithSecretsFunction · 0.85
renderTemplateDataFunction · 0.85

Calls 1

replaceMethod · 0.45

Tested by

no test coverage detected