Automattic / cli-table

Pretty unicode tables for the CLI with Node.JS
MIT License
2.28k stars 141 forks source link

.toString() throws error when new Table was instanciated with "head" prop as undefined. #178

Open latchy opened 1 year ago

latchy commented 1 year ago

The interface for TableOptions suggests that is it is valid to pass the constructor options head property as undefined, as if it were not passed at all - standard JS/TS practice.

Unfortunately this causes the .toString() method to throw an error since it does not appear to be checking whether the head options property isn't undefined.

I think this should just require a quick gaurd to ensure this is handled correctly?