Repository navigation
util: unenumerable properties should be visible #1598
Description
Activity
- addedutilIssues and PRs related to the built-in util module.Issues and PRs related to the built-in util module.
on May 3, 2015 Though these views are not equivalent. The equivalent view in chrome is when you expand the properties and in that view the unenumerable properties are greyed out. Perhaps there should be some kind of enumerability marker in the util view as well?
True, one could do something like
[Getter/enumerable], but I think that could be too verbose.As I see it, everything is better than
{}.This is intentional, unenumerable properties need the
showHiddenflag set to show:> require('util').inspect(o, {showHidden: true}) '{ [a]: [Getter] }'although I guess whether or not this is desirable is up for discussion. Keep in mind on the REPL this would get obnoxious quick since arrays would show their length attribute.
Interesting. This is what Firefox does:
> var o = {}; Object.defineProperty(o, "a", {get: function(){}}) Object { , 1 more… } > var o = {}; Object.defineProperty(o, "a", {get: function(){}, enumerable:true}) Object { a: Getter }
Ping @silverwind, what is the status of this issue?
I think we could change
showHiddento default to true, with special handling to hide language builtin unenumerable properties. This would be pretty much what the Chrome console now does. If we agree on that, I can do a PR.-1 from me. I don't think we should try to replicate Chrome console
I think we could change showHidden to default to true
I'm not opposed to either making it default to true for the REPL/console only. Where ansi colors are enabled we should probably use them to indicate non-enumerability of properties as well.
Yeah, would keep it REPL-only. I could see property names colored blue as normal properties and magenta as unenumerable ones. Right now, we only color the value (yellow).
Decided against pursuing this further because having
showHiddenflipped just on the REPL to make this work seems wrong. Also, blue ansi color is unreadable on Windows according to a comment. If we ever decide to add 256 color support to inspect, we might be able to revisit this issue.
Same in Chrome:
cc: @monsanto