( vars: Map<string, unknown>, variableKey: string, )
| 123 | } |
| 124 | |
| 125 | export 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 | |
| 147 | type ParsedOptions = { |
| 148 | label?: string; |
no test coverage detected