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

Function extractTimelineDefaults

packages/parsers/src/gsapParser.ts:427–442  ·  view source on GitHub ↗
(
  callNode: AstNode,
  scope: ScopeBindings,
)

Source from the content-addressed store, hash-verified

425}
426
427function extractTimelineDefaults(
428 callNode: AstNode,
429 scope: ScopeBindings,
430): TimelineDefaults | undefined {
431 const arg = callNode.arguments?.[0];
432 if (!arg || arg.type !== "ObjectExpression") return undefined;
433 const defaultsProp = arg.properties?.find(
434 (p: AstNode) => isObjectProperty(p) && propKeyName(p) === "defaults",
435 );
436 if (!defaultsProp?.value || defaultsProp.value.type !== "ObjectExpression") return undefined;
437 const record = objectExpressionToRecord(defaultsProp.value, scope);
438 const result: TimelineDefaults = {};
439 if (typeof record.ease === "string") result.ease = record.ease;
440 if (typeof record.duration === "number") result.duration = record.duration;
441 return Object.keys(result).length > 0 ? result : undefined;
442}
443
444function findTimelineVar(ast: AstNode, scope?: ScopeBindings): TimelineDetection {
445 let timelineVar: string | null = null;

Callers 2

visitVariableDeclaratorFunction · 0.70

Calls 4

isObjectPropertyFunction · 0.70
propKeyNameFunction · 0.70
objectExpressionToRecordFunction · 0.70
findMethod · 0.65

Tested by

no test coverage detected