MCPcopy Create free account
hub / github.com/marijnh/Eloquent-JavaScript / representSimpleObj

Function representSimpleObj

src/run_tests.mjs:145–156  ·  view source on GitHub ↗
(val)

Source from the content-addressed store, hash-verified

143}
144
145function representSimpleObj(val) {
146 let out = "{", name = constructorName(val)
147 if (name) out = name + " " + out
148 let first = true
149 for (let prop in val) if (hop(val, prop)) {
150 if (out.length > 80) return out
151 if (first) first = false
152 else out += ", "
153 out += prop + ": " + represent(val[prop])
154 }
155 return out + "}"
156}
157
158function compareClipped(a, b) {
159 a = a.split("\n")

Callers 1

representObjFunction · 0.70

Calls 3

constructorNameFunction · 0.70
hopFunction · 0.70
representFunction · 0.70

Tested by

no test coverage detected