21 lines
613 B
TypeScript
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}>]`;
|
|
}
|
|
}
|