blob: 22479385b327b3501884cbe33aa2b3b16b373e98 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
import { FrameInterface } from '../interface/frameInterface';
export class Display implements FrameInterface {
rowdata: unknown[][] = [];
columns!: string[];
table(frame: FrameInterface): void {
const maxSizedArrayLength = frame.rowdata.reduce((acc, curr) => {
return acc.length > curr.length ? acc : curr;
}).length;
console.table(
frame.rowdata.map((row) => {
const rowobj: any = {};
for (let i = 0; i < maxSizedArrayLength; i++) {
rowobj[frame.columns[i]] = row[i] ? row[i] : null;
}
return rowobj;
})
);
}
}
|