1
0
Fork 0
freesewing/lib/attributes.ts

21 lines
387 B
TypeScript
Raw Normal View History

2018-07-14 16:04:39 +00:00
export class Attributes {
list: {name: string, value: string}[] = [];
/** Adds an attribute */
add(name: string, value: string): Attributes {
this.list.push({name, value});
return this;
}
/** Returns SVG code for attributes */
render(): string {
let svg = '';
for (let a of this.list) {
svg += ` ${a.name}="${a.value}"`;
}
return svg;
}
}