UNPKG

fabric

Version:

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

13 lines (11 loc) 365 B
import type { TextStyle } from '../../shapes/Text/StyledText'; export const cloneStyles = (style: TextStyle): TextStyle => { const newObj: TextStyle = {}; Object.keys(style).forEach((key) => { newObj[key] = {}; Object.keys(style[key]).forEach((keyInner) => { newObj[key][keyInner] = { ...style[key][keyInner] }; }); }); return newObj; };