UNPKG

fabric

Version:

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

13 lines (10 loc) 386 B
import { reNum } from '../../parser/constants'; import { normalizeWs } from './normalizeWhiteSpace'; const regex = new RegExp(`(${reNum})`, 'gi'); export const cleanupSvgAttribute = (attributeValue: string) => normalizeWs( attributeValue .replace(regex, ' $1 ') // replace annoying commas and arbitrary whitespace with single spaces .replace(/,/gi, ' '), );