Files
snk/packages/svg-creator/utils.ts
2020-11-01 14:06:17 +01:00

9 lines
270 B
TypeScript

export const h = (element: string, attributes: any) =>
`<${element} ${toAttribute(attributes)}/>`;
export const toAttribute = (o: any) =>
Object.entries(o)
.filter(([, value]) => value !== null)
.map(([name, value]) => `${name}="${value}"`)
.join(" ");