fix: preserve zero values in formatTable

Fix formatTable to use null/undefined check instead of falsy check,
so numeric 0 values are correctly displayed instead of '-'.
This commit is contained in:
leo-jiqimao 2026-03-15 08:33:34 +08:00
parent d250d6efa7
commit 6d1a26a315

View File

@ -34,7 +34,8 @@ function formatTable(data, columns) {
data.forEach(row => {
output += '|';
columns.forEach(col => {
const value = String(row[col.key] || '-');
const cellValue = row[col.key];
const value = String(cellValue !== undefined && cellValue !== null ? cellValue : '-');
output += ` ${value.padEnd(widths[col.key] - 1)}|`;
});
output += '\n';