MCPcopy Index your code
hub / github.com/ComponentDriven/csf / includeConditionalArg

Function includeConditionalArg

src/includeConditionalArg.ts:32–43  ·  view source on GitHub ↗
(argType: InputType, args: Args, globals: Globals)

Source from the content-addressed store, hash-verified

30 * aka "conditional args"
31 */
32export 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};

Callers 1

Calls 2

countFunction · 0.85
testValueFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…