gajus / gajus/table

Corrupted table due to spanning and drawHorizontalLine

Open
#232 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
973
Forks
81
PR merge metrics
No merged PRs in 30d

Description

Consider the following code:

```ts
import { table } from "table";

console.log(
table([
["abc", "abc", " "],
[" ", "abc", " "],
[" ", "abc", " "],
[" ", "abc", "abc"],
],
{
spanningCells: [
{ row: 0, col: 0, rowSpan: 4 },
{ row: 0, col: 1, colSpan: 2 },
{ row: 1, col: 1, colSpan: 2 },
{ row: 2, col: 1, colSpan: 2 },
],
columns: {
0: { width: 3 },
1: { width: 3 },
2: { width: 3 },
},
drawHorizontalLine: (row) => [0, 3, 4].includes(row)
})
);
```

Actual output:

```
╔═════╤═══════════╗
║ abc │ abc ║
║ │ abc ║
║ │ abc ║
║├─────┬─────╢
║ │ abc │ abc ║
╚═════╧═════╧═════╝
```

Expectation:

```
╔═════╤═══════════╗
║ abc │ abc ║
║ │ abc ║
║ │ abc ║
║ ├─────┬─────╢
║ │ abc │ abc ║
╚═════╧═════╧═════╝
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.