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

Function valuesFromProperty

packages/cli/src/commands/keyframes.ts:396–410  ·  view source on GitHub ↗
(
  script: string,
  property: "targets" | "duration",
)

Source from the content-addressed store, hash-verified

394}
395
396function valuesFromProperty(
397 script: string,
398 property: "targets" | "duration",
399): Array<string | number> {
400 const values: Array<string | number> = [];
401 const quoted = property + "\\s*:\\s*([\"'`])([^\"'`]+)\\1";
402 const numeric = property + "\\s*:\\s*([0-9]+(?:\\.[0-9]+)?)";
403 const re = new RegExp(`${quoted}|${numeric}`, "g");
404 let match: RegExpExecArray | null;
405 while ((match = re.exec(script))) {
406 if (match[2] !== undefined) values.push(match[2]);
407 else if (match[3] !== undefined) values.push(Number(match[3]));
408 }
409 return values;
410}
411
412function animeAddTargets(script: string): string[] {
413 const values: string[] = [];

Callers 1

surfaceAnimeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected