mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
console: fix console.table() display edge case
If the properties are not specified in `console.table()`, then we should make a best effort to determine them rather than put all values into a "Values" column. PR-URL: https://github.com/nodejs/node/pull/20323 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
65d97c96aa
commit
99d56a4749
2 changed files with 21 additions and 14 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue