MCPcopy Index your code
hub / github.com/thesysdev/openui / findPromptOptions

Function findPromptOptions

packages/openui-cli/src/commands/generate-worker.ts:100–120  ·  view source on GitHub ↗
(
  mod: Record<string, unknown>,
  exportName?: string,
)

Source from the content-addressed store, hash-verified

98}
99
100function findPromptOptions(
101 mod: Record<string, unknown>,
102 exportName?: string,
103): PromptOptions | undefined {
104 if (exportName) {
105 const val = mod[exportName];
106 return isPromptOptions(val) ? val : undefined;
107 }
108
109 // Check well-known names first
110 for (const name of ["promptOptions", "options"]) {
111 if (isPromptOptions(mod[name])) return mod[name] as PromptOptions;
112 }
113
114 // Check any export ending with "PromptOptions" or "promptOptions"
115 for (const [key, val] of Object.entries(mod)) {
116 if (/[Pp]rompt[Oo]ptions$/.test(key) && isPromptOptions(val)) return val;
117 }
118
119 return undefined;
120}
121
122async function main(): Promise<void> {
123 const args = process.argv.slice(2);

Callers 1

mainFunction · 0.85

Calls 1

isPromptOptionsFunction · 0.85

Tested by

no test coverage detected