UNPKG

fabric

Version:

Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.

19 lines (18 loc) 423 B
/** * Takes a style string and parses it in one that has only defined values * and lowercases properties * @param style * @param oStyle */ export function parseStyleString( style: string, oStyle: Record<string, any> ): void { style .replace(/;\s*$/, '') .split(';') .forEach((chunk) => { const [attr, value] = chunk.split(':'); oStyle[attr.trim().toLowerCase()] = value.trim(); }); }