Total Complexity | 2 |
Complexity/F | 2 |
Lines of Code | 29 |
Function Count | 1 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import { HtmlColumn } from './HtmlColumn'; |
||
2 | |||
3 | type IColumn = string | HtmlColumn; |
||
4 | |||
5 | export interface ICell { |
||
6 | name: string; |
||
7 | renderHtml(): string; |
||
8 | renderText(): string; |
||
9 | } |
||
10 | |||
11 | export type Row = ICell[]; |
||
12 | |||
13 | export class Table { |
||
14 | constructor( |
||
15 | public readonly columns: IColumn[], |
||
16 | public readonly rows: Row[] |
||
17 | ) {} |
||
18 | |||
19 | public getColumnTexts(): string[] { |
||
20 | return this.columns.map(col => |
||
21 | col instanceof HtmlColumn ? col.text : col |
||
22 | ); |
||
23 | } |
||
24 | } |
||
25 | |||
26 | export class Inline { |
||
27 | constructor(public readonly columns: IColumn[], public readonly row: Row) {} |
||
28 | } |
||
29 |