-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
v4.x: backport util.inspect.custom #9688
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add a `util.inspect.custom` Symbol which can be used to customize `util.inspect()` output. Providing `obj[util.inspect.custom]` works like providing `obj.inspect`, except that the former allows avoiding name clashes with other `inspect()` methods. Fixes: nodejs#8071 PR-URL: nodejs#8174 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
If a custom inspection function returned `this`, use that value for further formatting instead of going into infinite recursion. This is particularly useful when combined with `util.inspect.custom` because returning `this` from such a method makes it easy to have an `inspect()` function that is ignored by `util.inspect` without actually having to provide an alternative for custom inspection. PR-URL: nodejs#8174 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
59714cb introduced the `util.inspect.custom` symbol, but it was exported as `customInspectSymbol` by `internal/util.js` and referenced as `inspectSymbol` by `buffer.js`. PR-URL: nodejs#9289 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
nodejs-github-bot
added
buffer
Issues and PRs related to the buffer subsystem.
util
Issues and PRs related to the built-in util module.
v4.x
labels
Nov 18, 2016
4 tasks
MylesBorins
added
the
semver-minor
PRs that contain new features and should be released in the next minor version.
label
Nov 19, 2016
@thealphanerd What’s the process for this? Adding the |
jasnell
approved these changes
Dec 5, 2016
MylesBorins
force-pushed
the
v4.x-staging
branch
from
December 21, 2016 19:34
d860f6e
to
c77ba8c
Compare
9 tasks
@MylesBorins This was cancelled on the last LTS meeting, right? If I’m understanding correctly, feel free to close |
Good call! Closing |
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
buffer
Issues and PRs related to the buffer subsystem.
semver-minor
PRs that contain new features and should be released in the next minor version.
util
Issues and PRs related to the built-in util module.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Checklist
make -j8 test
(UNIX), orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
util
Description of change
Backport of #8174 (2 semver-minor commits) and #9289 to v4.x.
/cc @thealphanerd @nodejs/lts