If you try to override padding-left or padding-right TableOptions style with a CellOptions style with 'padding-left': 0 or 'padding-right': 0 there is no effect.
The 0 values in the cell also do not override the default padding in cli-table3.
The padding-left and padding-right set to 0 does work fine in the TableOptions however. The bug is only in overriding the Table options
constTable=require('cli-table3')lettable=newTable({'style': {'padding-left': 1,// default Table option is padding 1},})table.push([{content: 'a','style': {'padding-left': 5,// padding 5 👍 },},{content: 'b','style': {'padding-left': 1,// padding 1 👍 },},{content: 'c','style': {'padding-left': 0,// padding 0 :( no effect },},{content: 'd','style': {'padding-left': -1,// padding -1 kind of has 0 padding // but then has to offset with colWidths 2 to work},},])console.log(table.toString())Resulting table:

The tests do not cover a 0 case of padding here:
| it('if set will override tableOptions.style',function(){ |
This line is culprit:
| targetObj[nameA]=objA[nameA]||objA[nameB]||objB[nameA]||objB[nameB]; |
When padding-left in the Cell style options is a positive number (2) this is evaluating out as:
obj.paddingLeft=cellStyleObj.paddingLeft||// evaluates to undefinedcellStyleObj[padding-left]||// evaluates to 2tableStyleObj.paddingLeft||// evaluates to undefinedtableStyleObj.[padding-left]// evaluates to 1// paddingLeft = 2 yay!!
When padding-left in the Cell style options is 0 this is evaluating out as:
obj.paddingLeft=cellStyleObj.paddingLeft||// evaluates to undefinedcellStyleObj[padding-left]||// evaluates to 0tableStyleObj.paddingLeft||// evaluates to undefinedtableStyleObj.[padding-left]// evaluates to 1// paddingLeft = 1 oh no!!
I would love to submit a PR, but honestly I have no idea if I will have the time. Hopefully this is helpful!
If you try to override
padding-leftorpadding-rightTableOptions style with a CellOptions style with'padding-left': 0or'padding-right': 0there is no effect.The
0values in the cell also do not override the default padding in cli-table3.The
padding-leftandpadding-rightset to0does work fine in the TableOptions however. The bug is only in overriding the Table optionsResulting table:
The tests do not cover a
0case of padding here:cli-table3/test/cell-test.js
Line 150 in d22503b
This line is culprit:
cli-table3/src/cell.js
Line 334 in d22503b
When padding-left in the Cell style options is a positive number (2) this is evaluating out as:
When padding-left in the Cell style options is 0 this is evaluating out as:
I would love to submit a PR, but honestly I have no idea if I will have the time. Hopefully this is helpful!