-
Notifications
You must be signed in to change notification settings - Fork 30.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update console.table docs. #20318
Update console.table docs. #20318
Conversation
PR-URL: #18137 Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
/ping @BridgeAR |
Commit message doesn't conform to the guidelines/conventions used, but especially for such a focused change, whoever is landing the code can certainly fix it. In case that person is not me and whoever it is doesn't want to think about it, here's a suggested commit log:
|
Leave a 👍 here if you are a Collaborator in favor of fast-tracking this. |
Should an example of a call without |
Also not sure if this is a typo: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with ignorable nits in comments)
@vsemozhetbyt Yes (although it doesn't have to be in this pull request if @sant123 just wants to get a quick correction in and not spend time perfecting the |
@Trott If I push my own commit, will not this mess up with |
If I had to guess, I wouldn't think so, but if you believe it might, you very well could be right! |
doc/api/console.md
Outdated
@@ -367,7 +367,7 @@ console.table(undefined); | |||
``` | |||
|
|||
```js | |||
console.table([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }]); | |||
console.table([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }], ['a', 'b']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parameter properties
is optional here.
The output is same even if ['a', 'b']
is not passed as properties
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me:
> console.table([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }]);
┌─────────┬──────────────────┐
│ (index) │ Values │
├─────────┼──────────────────┤
│ 0 │ { a: 1, b: 'Y' } │
│ 1 │ { a: 'Z', b: 2 } │
└─────────┴──────────────────┘
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are optional, but not with the same output it seems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vsemozhetbyt You're right. I just verified it with Node.js v10.0.0
My bad, earlier I'd verified it on Google Chrome v66 where the output was same even if ['a', 'b']
is not passed as properties
I've pushed under the OP username and email, this can be reverted if I am wrong. CI-lite: https://ci.nodejs.org/job/node-test-pull-request-lite/601/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should fix the bug not document the bugged behaviour
As noted in #17128 (comment) the method still appears in the inspector-only methods (line 508 on the new diff). Maybe we should take the opportunity to fix this? |
|
Checklist