Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions lib/console.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -363,9 +363,7 @@ Console.prototype.table = function(tabularData, properties) {
tabularData = previewSetIterator(tabularData);

const setlike = setIter || isSet(tabularData);
if (setlike ||
(properties === undefined &&
(isArray(tabularData) || isTypedArray(tabularData)))) {
if (setlike) {
const values = [];
let length = 0;
for (const v of tabularData) {
Expand Down
31 changes: 20 additions & 11 deletions test/parallel/test-console-table.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -41,13 +41,13 @@ test([1, 2, 3], `
`);

test([Symbol(), 5, [10]], `
┌─────────┬──────────┐
│ (index) │ Values │
├─────────┼──────────┤
│ 0 │ Symbol() │
│ 1 │ 5 │
│ 2 │ [ 10 ]
└─────────┴──────────┘
┌─────────┬────┬──────────┐
│ (index) │ 0 │ Values │
├─────────┼────┼──────────┤
│ 0 │ Symbol() │
│ 1 │ 5 │
│ 2 │ 10 │
└─────────┴────┴──────────┘
`);

test([undefined, 5], `
Expand DownExpand Up@@ -182,10 +182,10 @@ test({ a: undefined }, ['x'], `
`);

test([], `
┌─────────┬────────
│ (index) │ Values │
├─────────┼────────
└─────────┴────────
┌─────────┐
│ (index) │
├─────────┤
└─────────┘
`);

test(new Map(), `
Expand All@@ -194,3 +194,12 @@ test(new Map(), `
├───────────────────┼─────┼────────┤
└───────────────────┴─────┴────────┘
`);

test([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }], `
┌─────────┬─────┬─────┐
│ (index) │ a │ b │
├─────────┼─────┼─────┤
│ 0 │ 1 │ 'Y' │
│ 1 │ 'Z' │ 2 │
└─────────┴─────┴─────┘
`);