| 394 | } |
| 395 | |
| 396 | function 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 | |
| 412 | function animeAddTargets(script: string): string[] { |
| 413 | const values: string[] = []; |