MCPcopy
hub / github.com/BlueWallet/BlueWallet / parseDataPath

Function parseDataPath

tests/unit/QRCode.test.tsx:37–45  ·  view source on GitHub ↗
(d: string)

Source from the content-addressed store, hash-verified

35
36type ParsedCell = { x: number; y: number; w: number; h: number };
37const 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
47let testCounter = 0;
48const uniqueValue = () => `test-value-${++testCounter}-${Math.random()}`;

Callers 1

QRCode.test.tsxFile · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected