-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
Symbol key props visible in inspection by default #9726
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
Changes from 1 commit
903f353
192d79a
3ace6a9
8e73c95
3cbd847
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
Including test
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -372,7 +372,9 @@ function formatValue(ctx, value, recurseTimes) { | |
| var keys = Object.keys(value); | ||
| var visibleKeys = arrayToHash(keys); | ||
| var symbolKeys = Object.getOwnPropertySymbols(value); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I haven’t run this but right now this looks like this will include even *non-*enumerable Symbol properties?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup. That is how
I wouldn't mind changing it to exclude non-enumerable symbol-keyed props. Should I?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well… it seems a bit weird to list only enumerable string properties but all Symbol properties by default?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just don't know the reasons for not listing non-enumerable properties. For the sake of explaining my experience with the matter, I'll testify that I:
So, it may help that one with experience with the topic of enumerability and non-enumerability will share his thoughts. Also, the thoughts of one who knows the intention of symbols in this regard and why this is the behavior of |
||
| keys = keys.concat(symbolKeys); | ||
| var enumSymbolKeys = symbolKeys | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: This one can be |
||
| .filter((key) => value.propertyIsEnumerable(key)); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: I think we generally indent statement continuations by 4 spaces, not 2 |
||
| keys = keys.concat(enumSymbolKeys); | ||
|
|
||
| if (ctx.showHidden) { | ||
| keys = Object.getOwnPropertyNames(value).concat(symbolKeys); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the same result. The change is to not get the symbols twice. |
||
|
|
||
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.
I don't fully understand what goes on with
keysvs.visibleKeys, yet, this seems to work.