MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / getVariables

Function getVariables

packages/core/src/runtime/getVariables.ts:22–31  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20 * const { title = "Untitled", theme = "light" } = getVariables<MyVars>();
21 */
22export function getVariables<
23 T extends Record<string, unknown> = Record<string, unknown>,
24>(): Partial<T> {
25 if (typeof document === "undefined") return {} as Partial<T>;
26
27 const declaredDefaults = readDeclaredDefaults(document.documentElement);
28 const overrides = readOverrides();
29
30 return { ...declaredDefaults, ...overrides } as Partial<T>;
31}
32
33/**
34 * Extract `{id: default}` map from an element's `data-composition-variables`

Callers 1

Calls 2

readDeclaredDefaultsFunction · 0.85
readOverridesFunction · 0.85

Tested by

no test coverage detected