| 35 | |
| 36 | type ParsedCell = { x: number; y: number; w: number; h: number }; |
| 37 | const parseDataPath = (d: string): ParsedCell[] => { |
| 38 | const re = /M(-?\d+(?:\.\d+)?)\s+(-?\d+(?:\.\d+)?)h(-?\d+(?:\.\d+)?)v(-?\d+(?:\.\d+)?)h-(-?\d+(?:\.\d+)?)z/g; |
| 39 | const out: ParsedCell[] = []; |
| 40 | let m: RegExpExecArray | null; |
| 41 | while ((m = re.exec(d)) !== null) { |
| 42 | out.push({ x: parseFloat(m[1]), y: parseFloat(m[2]), w: parseFloat(m[3]), h: parseFloat(m[4]) }); |
| 43 | } |
| 44 | return out; |
| 45 | }; |
| 46 | |
| 47 | let testCounter = 0; |
| 48 | const uniqueValue = () => `test-value-${++testCounter}-${Math.random()}`; |