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

Function findLibrary

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

Source from the content-addressed store, hash-verified

55}
56
57function findLibrary(mod: Record<string, unknown>, exportName?: string): Library | undefined {
58 if (exportName) {
59 const val = mod[exportName];
60 return isLibrary(val) ? val : undefined;
61 }
62
63 for (const name of ["library", "default"]) {
64 if (isLibrary(mod[name])) return mod[name];
65 }
66
67 for (const val of Object.values(mod)) {
68 if (isLibrary(val)) return val;
69 }
70
71 return undefined;
72}
73
74interface PromptOptions {
75 preamble?: string;

Callers 1

mainFunction · 0.85

Calls 1

isLibraryFunction · 0.85

Tested by

no test coverage detected