(argType: InputType, args: Args, globals: Globals)
| 30 | * aka "conditional args" |
| 31 | */ |
| 32 | export const includeConditionalArg = (argType: InputType, args: Args, globals: Globals) => { |
| 33 | if (!argType.if) return true; |
| 34 | |
| 35 | const { arg, global } = argType.if as any; |
| 36 | if (count([arg, global]) !== 1) { |
| 37 | throw new Error(`Invalid conditional value ${JSON.stringify({ arg, global })}`); |
| 38 | } |
| 39 | |
| 40 | const value = arg ? args[arg] : globals[global]; |
| 41 | // eslint-disable-next-line @typescript-eslint/no-non-null-assertion |
| 42 | return testValue(argType.if!, value); |
| 43 | }; |
no test coverage detected
searching dependent graphs…