FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

v4.x: backport util.inspect.custom by addaleax · Pull Request #9688 · nodejs/node · GitHub

/ node Public

v4.x: backport util.inspect.custom - #9688

Closed
addaleax wants to merge 3 commits into
nodejs:v4.x-stagingfrom
addaleax:backport-8174
Closed

v4.x: backport util.inspect.custom#9688
addaleax wants to merge 3 commits into
nodejs:v4.x-stagingfrom
addaleax:backport-8174

Conversation

Copy link
Copy Markdown
Member
Checklist
  • make -j8 test (UNIX), or vcbuild test nosign (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

util

Description of change

Backport of #8174 (2 semver-minor commits) and #9289 to v4.x.

/cc @thealphanerd @nodejs/lts

addaleax and others added 3 commits November 18, 2016 22:58
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
MylesBorins added the semver-minor PRs that contain new features and should be released in the next minor version. label Nov 19, 2016

Copy link
Copy Markdown
Member Author

@thealphanerd What’s the process for this? Adding the lts-agenda label?

Copy link
Copy Markdown
Member Author

@MylesBorins This was cancelled on the last LTS meeting, right? If I’m understanding correctly, feel free to close

Copy link
Copy Markdown
Contributor

Good call!

Closing

addaleax deleted the backport-8174 branch January 12, 2017 20:29
This file contains hidden or 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
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants


Back | FazBrowse Home | New Git URL