Skip to content
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

util: use minimal object inspection with %s specifier #26927

Closed

Conversation

BridgeAR
Copy link
Member

@BridgeAR BridgeAR commented Mar 26, 2019

This improves util.format() by returning more meaningful results
when using %s as specifier and any object as value. Besides that
BigInt will also be represented with an n at the end to indicate
that it's of type BigInt.

@Trott @vsemozhetbyt the documentation does not seem very intuitive
and I fail to find brief words to describe everything properly. It would
be great if you could have a look to suggest improvements.

Most format or inspect changes are treated as patch but this could
be considered semver-major even though I doubt that it would break anything. I would like to get the opinion of others on that and I'll trigger CITGM to see if anything pops up.

CITGM https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/1777/

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added the util Issues and PRs related to the built-in util module. label Mar 26, 2019
This improves `util.format()` by returning more meaningful results
when using `%s` as specifier and any object as value. Besides that
`BigInt` will also be represented with an `n` at the end to indicate
that it's of type `BigInt`.
@BridgeAR BridgeAR force-pushed the improve-util-format-specifiers branch from f59c390 to cca384b Compare March 26, 2019 15:34
@nodejs-github-bot
Copy link
Collaborator

@vsemozhetbyt
Copy link
Contributor

Docs LGTM. Sorry, I cannot think of any better wording for now.

@BridgeAR
Copy link
Member Author

@nodejs/util PTAL

Copy link
Member

@targos targos left a comment

Choose a reason for hiding this comment

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

Maybe use "except" instead of "besides" in the documentation?

@BridgeAR
Copy link
Member Author

@targos I updated it as suggested. I also slightly changed the defaults used while inspecting (that will only have influence when inspecting objects that have lots of elements in the most outer object).

@BridgeAR BridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Mar 29, 2019
@nodejs-github-bot
Copy link
Collaborator

@targos
Copy link
Member

targos commented Mar 30, 2019

@nodejs/util

@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Mar 30, 2019

@BridgeAR
Copy link
Member Author

BridgeAR commented Apr 4, 2019

Landed in a9bf665 🎉

@BridgeAR BridgeAR closed this Apr 4, 2019
BridgeAR added a commit to BridgeAR/node that referenced this pull request Apr 4, 2019
This improves `util.format()` by returning more meaningful results
when using `%s` as specifier and any object as value. Besides that
`BigInt` will also be represented with an `n` at the end to indicate
that it's of type `BigInt`.

PR-URL: nodejs#26927
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
@addaleax addaleax added the semver-major PRs that contain breaking changes and should be released in the next major version. label Aug 27, 2019
@BridgeAR BridgeAR deleted the improve-util-format-specifiers branch January 20, 2020 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. semver-major PRs that contain breaking changes and should be released in the next major version. util Issues and PRs related to the built-in util module.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants