MCPcopy Create free account
hub / github.com/chhoumann/quickadd / resolveExistingVariableKey

Function resolveExistingVariableKey

src/utils/valueSyntax.ts:125–145  ·  view source on GitHub ↗
(
	vars: Map<string, unknown>,
	variableKey: string,
)

Source from the content-addressed store, hash-verified

123}
124
125export function resolveExistingVariableKey(
126 vars: Map<string, unknown>,
127 variableKey: string,
128): string | null {
129 if (!variableKey) return null;
130
131 const candidates = [variableKey];
132 const baseKey = getValueVariableBaseName(variableKey);
133 if (baseKey !== variableKey) candidates.push(baseKey);
134
135 for (const candidate of candidates) {
136 if (vars.has(candidate) && vars.get(candidate) !== undefined) {
137 return candidate;
138 }
139
140 const match = findCaseInsensitiveMatch(vars, candidate);
141 if (match) return match;
142 }
143
144 return null;
145}
146
147type ParsedOptions = {
148 label?: string;

Callers 3

Calls 4

getValueVariableBaseNameFunction · 0.85
findCaseInsensitiveMatchFunction · 0.85
pushMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected