MCPcopy Create free account
hub / github.com/BCsabaEngine/svelteesp32 / interpolateString

Function interpolateString

src/commandLine.ts:281–286  ·  view source on GitHub ↗
(value: string)

Source from the content-addressed store, hash-verified

279
280 // Interpolation function
281 const interpolateString = (value: string): string => {
282 // Match $npm_package_ followed by field name (stops at _ + uppercase)
283 // This allows: version, repository_type, but stops at _STATIC
284 const regex = /\$npm_package_[\dA-Za-z]+(?:_[a-z][\dA-Za-z]*)*/g;
285 return value.replaceAll(regex, (match: string) => getNpmPackageVariable(packageJson, match) ?? match);
286 };
287
288 // Create new config with interpolated values
289 const result: IRcFileConfig = { ...config };

Callers 1

interpolateNpmVariablesFunction · 0.85

Calls 1

getNpmPackageVariableFunction · 0.85

Tested by

no test coverage detected