graphviz-builder/lib/GraphNode.ts
Timo Hocker 6bf85f1605 init
2020-04-17 15:43:34 +02:00

21 lines
613 B
TypeScript

import { Node } from './Node';
export class GraphNode extends Node {
public label: string;
public is_table: boolean;
public table_contents: Array<Array<string>>;
private get serialized_table (): string {
const mapped_columns = this.table_contents
.map ((val) => `<td>${val.join ('</td><td>')}</td>`);
return `<table><tr>${mapped_columns.join ('</tr><tr>')}</tr></table>`;
}
// eslint-disable-next-line @typescript-eslint/naming-convention
public toString (): string {
return `${this.full_name}[label=<${this.is_table
? this._serialized_table
: this.label}>]`;
}
}