MCPcopy Index your code
hub / github.com/marijnh/Eloquent-JavaScript / representObj

Function representObj

src/client/sandbox.mjs:538–547  ·  view source on GitHub ↗
(val, space)

Source from the content-addressed store, hash-verified

536}
537
538function representObj(val, space) {
539 let string = typeof val.toString == "function" && val.toString(), m
540 if (!string || /^\[object .*\]$/.test(string))
541 return representSimpleObj(val, space)
542 if (val.call && (m = string.match(/^\s*(function[^(]*\([^)]*\))/)))
543 return span("fun", m[1] + "{…}")
544 let elt = span("etc", string)
545 elt.addEventListener("click", () => expandObj(elt, "obj", val))
546 return elt
547}
548
549function constructorName(obj) {
550 if (!obj.constructor) return null

Callers 1

representFunction · 0.70

Calls 3

spanFunction · 0.85
expandObjFunction · 0.85
representSimpleObjFunction · 0.70

Tested by

no test coverage detected