Skip to content

Conversation

@umuoy1
Copy link
Contributor

@umuoy1 umuoy1 commented Jun 19, 2023

improve readability of example code output

@nodejs-github-bot nodejs-github-bot added the doc Issues and PRs related to the documentations. label Jun 19, 2023
@VoltrexKeyva
Copy link
Member

Node.js passes the arguments of console.log() to a formatter which is util.formatWithOptions() that passes objects to util.inspect() which in turn are formatted very well and are much more readable than JSON.stringify().

JSON.stringify() can't serialize everything (such as bigints) and omit things like classes, methods, and anything that can't be represented in a JSON, and also won't contain any colors unlike console.log()'s output, so this change makes it way less readable.

Copy link
Member

@jasnell jasnell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with the review that this isn't an approvement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc Issues and PRs related to the documentations.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants