-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
Closed
Labels
questionIssues that look for answers.Issues that look for answers.utilIssues and PRs related to the built-in util module.Issues and PRs related to the built-in util module.
Description
- Version: v7.1.0
- Platform: Linux shahar-desktop 4.8.0-27-generic docs: added a the #29-Ubuntu SMP Thu Oct 20 21:03:13 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
- Subsystem: ?
I find it useful to be able to inspect the contents of an object by by looking at it in an interactive session. I'll call this the "debug representation". What is the correct term, please?
Now that we have symbols I'm experimenting with using them as object keys. I think it should reduce chance of accidental name collisions/overwrites, if done properly.
Thing is—while inspection of objects with "normal" keys is easy:
{ foo: undefined }
// { foo: undefined }
Inspection of objects with symbol keys is hard:
let obj = { [Symbol()]: undefined }
obj
// {}
While, obviously:
Object.getOwnPropertySymbols(obj)
// [ Symbol() ]
😢
I expect this:
obj
// { Symbol(): undefined }
It makes sense, doesn't it?
We already have this, so it makes sense to expect what I'm expecting, does’t it?
Symbol()
// Symbol()
Symbol('foo')
// Symbol(foo)
Metadata
Metadata
Assignees
Labels
questionIssues that look for answers.Issues that look for answers.utilIssues and PRs related to the built-in util module.Issues and PRs related to the built-in util module.