Passed
Pull Request — master (#442)
by
unknown
06:24
created

src/Infrastructure/Tables/index.ts   A

Complexity

Total Complexity 2
Complexity/F 2

Size

Lines of Code 29
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 20
mnd 1
bc 1
fnc 1
dl 0
loc 29
rs 10
bpm 1
cpm 2
noi 0
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A Table.getColumnTexts 0 4 2
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