show object constructor name in value explorer

This commit is contained in:
Dmitry Vasilev
2023-06-09 16:23:02 +03:00
parent 178d13d3a5
commit a3b98d198d

View File

@@ -121,13 +121,17 @@ export const header = object => {
} else if(has_custom_toString(object)) { } else if(has_custom_toString(object)) {
return object.toString() return object.toString()
} else { } else {
const prefix =
(object.constructor.name == null || object.constructor.name == 'Object')
? ''
: object.constructor.name + ' '
const inner = displayed_entries(object) const inner = displayed_entries(object)
.map(([k,v]) => { .map(([k,v]) => {
const value = stringify_for_header(v) const value = stringify_for_header(v)
return `${k}: ${value}` return `${k}: ${value}`
}) })
.join(', ') .join(', ')
return `{${inner}}` return `${prefix} {${inner}}`
} }
} else if(typeof(object) == 'function') { } else if(typeof(object) == 'function') {
// TODO clickable link, 'fn', cursive // TODO clickable link, 'fn', cursive