Headers in Table don't calculate the size correctly if using emoticons like "🧪"
- Dominant language
- TypeScript
- Stars
- 973
- Forks
- 81
- PR merge metrics
- No merged PRs in 30d
Description
For some reason with the following code :
```js
const baseColumns = [
["🧪aaaa", ""],
["A", "B"]
];
const config = {
spanningCells: [{ col: 0, row: 0, colSpan: 2 }]
};
console.log(table(baseColumns, config));
```
We get the following error from table :
subjectWidth: 6 , containerwidth:5
node_modules/table/dist/src/alignString.js
```
if (subjectWidth > containerWidth) {
throw new Error('Subject parameter value width cannot be greater than the container width.');
}
```
This does not repro if I remove the emoticon
```js
const baseColumns = [
["aaaaaaaaaaaaaaaaaaaaaa", ""],
["A", "B"]
];
const config = {
spanningCells: [{ col: 0, row: 0, colSpan: 2 }]
};
console.log(table(baseColumns, config));
```
output.
```
╔═══════╗
║ aaaaa ║
║ aaaaa ║
║ aaaaa ║
║ aaaaa ║
║ aa ║
╟───┬───╢
║ A │ B ║
╚═══╧═══╝
```
Note this also repros if I use colSpan instead of header.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.