tty-table
tty-table copied to clipboard
Automatic width not correct when using formatter
Problem Summary
I'm using a formatter function to add 'USD' to a money amount. The automatic column width is determined by the value before the formatter instead of the string returned by the formatter.
Expected Result (screen shot if possible)
Automatic column width should be wider.
Actual Result (screen shot if possible)
It's the width based on the original value before the formatter.
Steps to Reproduce
- Basic table code without specifying column widths
- formatter: (cellValue) => { return cellValue + ' USD' }
- Column is not wide enough.
Thanks for reporting. I don't really have time to add this feature at the moment, but I'd be happy to merge your pull request.
You can also set column widths to a fixed value or a percentage to remedy this.