MCPcopy Create free account
hub / github.com/massCodeIO/massCode / interpolateHttpVariables

Function interpolateHttpVariables

src/shared/httpVariables.ts:3–12  ·  view source on GitHub ↗
(
  template: string,
  variables: Record<string, string>,
)

Source from the content-addressed store, hash-verified

1const HTTP_VARIABLE_PATTERN = /\{\{\s*([\w.-]+)\s*\}\}/g
2
3export function interpolateHttpVariables(
4 template: string,
5 variables: Record<string, string>,
6): string {
7 return template.replace(HTTP_VARIABLE_PATTERN, (match, key: string) => {
8 return Object.prototype.hasOwnProperty.call(variables, key)
9 ? variables[key]
10 : match
11 })
12}

Callers 3

interpolateAuthFunction · 0.90
interpolateDraftFunction · 0.90
interpolateFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected