Skip to content

Commit 54a9253

Browse files
committed
fix: falls back to raw value if value can’t be formatted
1 parent 39fb8f6 commit 54a9253

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/utils.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,13 @@ const formatRows = (rows, columns, spacing=1, maxWidth) => {
88
return columns.map(column => {
99
const { format, key } = column;
1010
const rawValue = row[key];
11-
const value = _.isFunction(format) ? format(rawValue) : rawValue;
1211

13-
return padEnd(value, lengths[key], !format);
12+
try {
13+
const value = _.isFunction(format) ? format(rawValue) : rawValue;
14+
return padEnd(value, lengths[key], !format);
15+
} catch (e) {
16+
return rawValue;
17+
}
1418
}).join(spaces(spacing));
1519
});
1620
};

0 commit comments

Comments
 (0)