MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / viewBox

Function viewBox

__tests__/ui-export-svg.test.ts:184–188  ·  view source on GitHub ↗
(svg: string)

Source from the content-addressed store, hash-verified

182}
183
184function viewBox(svg: string): { width: number; height: number } {
185 const box = /viewBox="0 0 (\d+(?:\.\d+)?) (\d+(?:\.\d+)?)"/.exec(svg);
186 expect(box, 'no viewBox').toBeTruthy();
187 return { width: Number(box![1]), height: Number(box![2]) };
188}
189
190function rootSize(svg: string): { width: number; height: number } {
191 const w = /<svg[^>]*\bwidth="(\d+)"/.exec(svg);

Callers 1

Calls 1

execMethod · 0.65

Tested by

no test coverage detected