UNPKG

fabric

Version:

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

18 lines (17 loc) 494 B
//#region src/parser/parseStyleString.ts /** * Takes a style string and parses it in one that has only defined values * and lowercases properties * @param style * @param oStyle */ function parseStyleString(style, oStyle) { style.replace(/;\s*$/, "").split(";").forEach((chunk) => { if (!chunk) return; const [attr, value] = chunk.split(":"); oStyle[attr.trim().toLowerCase()] = value.trim(); }); } //#endregion export { parseStyleString }; //# sourceMappingURL=parseStyleString.mjs.map