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

Function readVarDefault

packages/sdk/src/engine/mutate.test.ts:61–66  ·  view source on GitHub ↗

Read the default value for a variable id from the parsed document.

(parsed: ReturnType<typeof parseMutable>, id: string)

Source from the content-addressed store, hash-verified

59
60/** Read the default value for a variable id from the parsed document. */
61function readVarDefault(parsed: ReturnType<typeof parseMutable>, id: string): unknown {
62 const raw = parsed.document.documentElement?.getAttribute("data-composition-variables");
63 if (!raw) return undefined;
64 const arr = JSON.parse(raw) as Array<{ id: string; default: unknown }>;
65 return arr.find((v) => v.id === id)?.default;
66}
67
68// ─── setStyle ────────────────────────────────────────────────────────────────
69

Callers 1

mutate.test.tsFile · 0.85

Calls 2

getAttributeMethod · 0.65
findMethod · 0.65

Tested by

no test coverage detected