-
Notifications
You must be signed in to change notification settings - Fork 8
Closed
Description
The snippets' console output for logged objects is, quite frankly, a mess.
Objects that contain no circular references are obfuscated beyond recognition. Their structure is no longer obvious.
For example:
const x = {};
const y = [];
const obj = {
foo: x,
bar: x,
baz: {x, y},
wut: [x, y]
};
console.log(obj);
Now logs:
{
"foo": {},
"bar": /**ref:2**/,
"baz": {
"x": /**ref:2**/,
"y": []
},
"wut": [
/**ref:2**/,
/**ref:4**/
]
}
Instead of what you'd expect:
{
"foo": {},
"bar": {},
"baz": {
"x": {},
"y": []
},
"wut": [
{},
[]
]
}
What do these ref lines actually refer to? Why doesn't it just show the actual data?
I realize it's not trivial to detect the difference between circular and duplicate references, but frankly, I'd rather see a "Circular reference" error than the current state. In the current state, the object's structure is excessively obfuscated. You might as well not log it, as you'd still have to manually figure out what the object contains.
See also my report on Stack Overflow's Meta.
Metadata
Metadata
Assignees
Labels
No labels