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

Function represent

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

Source from the content-addressed store, hash-verified

504}
505
506function represent(val, space) {
507 if (typeof val == "boolean") return span("bool", String(val))
508 if (typeof val == "number") return span("number", String(val))
509 if (typeof val == "string") return span("string", JSON.stringify(val))
510 if (typeof val == "symbol") return span("symbol", String(val))
511 if (val == null) return span("null", String(val))
512 if (Array.isArray(val)) return representArray(val, space)
513 else return representObj(val, space)
514}
515
516function representArray(val, space) {
517 space -= 2

Callers 4

outMethod · 0.70
representArrayFunction · 0.70
representSimpleObjFunction · 0.70
addPropFunction · 0.70

Calls 3

spanFunction · 0.85
representArrayFunction · 0.70
representObjFunction · 0.70

Tested by

no test coverage detected