MCPcopy Index your code
hub / github.com/devcontainers/cli / substitute0

Function substitute0

src/spec-common/variableSubstitution.ts:48–61  ·  view source on GitHub ↗
(replace: Replace, value: any)

Source from the content-addressed store, hash-verified

46type Replace = (match: string, variable: string, args: string[]) => string;
47
48function substitute0(replace: Replace, value: any): any {
49 if (typeof value === 'string') {
50 return resolveString(replace, value);
51 } else if (Array.isArray(value)) {
52 return value.map(s => substitute0(replace, s));
53 } else if (value && typeof value === 'object' && !URI.isUri(value)) {
54 const result: any = Object.create(null);
55 Object.keys(value).forEach(key => {
56 result[key] = substitute0(replace, value[key]);
57 });
58 return result;
59 }
60 return value;
61}
62
63const VARIABLE_REGEXP = /\$\{(.*?)\}/g;
64

Callers 3

substituteFunction · 0.70
containerSubstituteFunction · 0.70

Calls 1

resolveStringFunction · 0.85

Tested by

no test coverage detected