MCPcopy Index your code
hub / github.com/callstack/agent-device / resolveSourceValueDefinition

Function resolveSourceValueDefinition

src/utils/cli-option-schema.ts:116–136  ·  view source on GitHub ↗
(spec: OptionSpec)

Source from the content-addressed store, hash-verified

114}
115
116export function resolveSourceValueDefinition(spec: OptionSpec): FlagDefinition {
117 const explicitValueDefinition = spec.flagDefinitions.find(
118 (definition) => definition.setValue === undefined,
119 );
120 if (explicitValueDefinition) return explicitValueDefinition;
121
122 const baseDefinition = primaryFlagDefinition(spec);
123 if (baseDefinition.type === 'enum') {
124 const enumValues =
125 baseDefinition.enumValues ??
126 spec.flagDefinitions
127 .map((definition) => definition.setValue)
128 .filter((value): value is NonNullable<typeof value> => value !== undefined);
129 return {
130 ...baseDefinition,
131 setValue: undefined,
132 enumValues: enumValues as readonly string[],
133 };
134 }
135 return baseDefinition;
136}

Callers 2

Calls 1

primaryFlagDefinitionFunction · 0.85

Tested by

no test coverage detected