gajus / table

Formats data into a string table.
Other
899 stars 77 forks source link

Regression: columns config cannot be an array #134

Closed aomarks closed 3 years ago

aomarks commented 3 years ago

Somewhere between versions 6.0.3 and 6.0.7, passing an array of column configs stopped working. A validation error is now raised. The workaround is to pass an object with numeric keys. I think the array form is more natural and should also be valid.

Input:

table(rows, {
  columns: [
    { alignment: 'right' }
  ]
});

Error:

errors [
  {
    dataPath: '/columns',
    message: 'should be object',
    params: { type: 'object' },
    schemaPath: '#/type'
  }
]

Workaround:

table(rows, {
  columns: {
    0: { alignment: 'right' }
  }
});
nam-hle commented 3 years ago

This issue is resolved. Please help me close it @gajus