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

Function buildVarsObjectCode

packages/parsers/src/gsapWriterAcorn.ts:158–161  ·  view source on GitHub ↗

Serialize a vars record to an object-literal source: `{ k: v, ... }`.

(record: Record<string, number | string | boolean>)

Source from the content-addressed store, hash-verified

156
157/** Serialize a vars record to an object-literal source: `{ k: v, ... }`. */
158function buildVarsObjectCode(record: Record<string, number | string | boolean>): string {
159 const entries = Object.entries(record).map(([k, v]) => `${safeKey(k)}: ${valueToCode(v)}`);
160 return entries.length > 0 ? `{ ${entries.join(", ")} }` : "{}";
161}
162
163/** Overwrite a tween call's vars ObjectExpression with freshly-built source. */
164function overwriteVarsArg(ms: MagicString, call: TweenCallInfo, objCode: string): void {

Callers 1

Calls 3

safeKeyFunction · 0.85
valueToCodeFunction · 0.85
entriesMethod · 0.80

Tested by

no test coverage detected