-
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
util: use constructor name #14886
util: use constructor name #14886
Conversation
lib/util.js
Outdated
} else if (Array.isArray(value)) { | ||
if (constructor) | ||
return ctx.stylize(`[${constructor.name}]`, 'special'); | ||
if (Array.isArray(value)) |
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.
Note: this check is redundant as soon as #14881 has landed. Right now Arrays set the constructor to null and the check has to be done again.
Commit message nit: doesn't this apply to objects that exceed the depth limit rather than circular objects? Or both? |
d43d928
to
d76998e
Compare
@TimothyGu you are absolutely right! Fixed |
PTAL I changed the commit message and this could land otherwise. |
I would like to land this after #14881 as that one would otherwise not cleanly land on 8.x. Otherwise I would have already landed that. Marking this as blocked because of that. |
When reaching the depth limit util.inspect always prints [Array] or [Object] no matter if it is a subclass or not. This fixes it by showing the actual constructor name instead.
d76998e
to
572f1ef
Compare
Rebased. PTAL, I would like to land this very soon. |
Landed in b1c8f15 |
When reaching the depth limit util.inspect always prints [Array] or [Object] no matter if it is a subclass or not. This fixes it by showing the actual constructor name instead. PR-URL: #14886 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
When reaching the depth limit util.inspect always prints [Array] or [Object] no matter if it is a subclass or not. This fixes it by showing the actual constructor name instead. PR-URL: nodejs/node#14886 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
When reaching the depth limit util.inspect always prints [Array] or [Object] no matter if it is a subclass or not. This fixes it by showing the actual constructor name instead. PR-URL: nodejs/node#14886 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
For circular references util.inspect always prints Array
or Object not matter if it is a subclass or not.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
util