MCPcopy Create free account
hub / github.com/Superflows-AI/superflows / replaceVariables

Function replaceVariables

lib/edge-runtime/utils.ts:339–348  ·  view source on GitHub ↗
(
  input: string,
  variables: { [key: string]: any },
)

Source from the content-addressed store, hash-verified

337}
338
339export function replaceVariables(
340 input: string,
341 variables: { [key: string]: any },
342): string {
343 return input.replace(/\{(\w+)}/g, function (_match, variable) {
344 return variables.hasOwnProperty(variable)
345 ? variables[variable]
346 : `${variable}`;
347 });
348}
349
350export const ApiResponseCutText = `API response cut as it is too large (>20kb).`;
351

Callers 4

handlerFunction · 0.90
getUserMessageTextFunction · 0.90
utils.test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected