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

Function valueToCode

packages/parsers/src/gsapWriterAcorn.ts:41–47  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

39// Object]", so keep this richer JSON fallback for that path. Keyframe values are
40// always number|string and use the shared serializeValue (recast parity).
41function valueToCode(value: unknown): string {
42 if (typeof value === "string" && value.startsWith("__raw:")) return value.slice(6);
43 if (typeof value === "string") return JSON.stringify(value);
44 if (typeof value === "number") return Number.isNaN(value) ? "0" : String(value);
45 if (typeof value === "boolean") return String(value);
46 return JSON.stringify(value);
47}
48
49function safeKey(key: string): string {
50 return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(key) ? key : JSON.stringify(key);

Callers 15

buildTweenStatementCodeFunction · 0.85
buildVarsObjectCodeFunction · 0.85
upsertPropFunction · 0.85
preservedEntriesFunction · 0.85
reconcileEditablePropsFunction · 0.85
overwritePositionFunction · 0.85
recordToCodeFunction · 0.85
collapseKeyframesToFlatFunction · 0.85
buildKeyframesVarsCodeFunction · 0.85
buildKeyframeObjectCodeFunction · 0.85
addLabelToScriptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected