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

Function parseObj

src/pseudo_json.mjs:45–58  ·  view source on GitHub ↗
(stream)

Source from the content-addressed store, hash-verified

43}
44
45function parseObj(stream) {
46 stream.ahead(1)
47 let obj = {}
48 for (;;) {
49 if (stream.next == 125) break
50 let prop = parseWord(stream, true)
51 if (stream.next != 58) stream.err("Expected ':'")
52 stream.ahead(1)
53 obj[prop] = parseValue(stream)
54 if (stream.next == 44) stream.ahead(1)
55 }
56 stream.ahead(1)
57 return obj
58}
59
60function parseArr(stream) {
61 stream.ahead(1)

Callers 1

parseValueFunction · 0.85

Calls 4

parseWordFunction · 0.85
parseValueFunction · 0.85
aheadMethod · 0.80
errMethod · 0.80

Tested by

no test coverage detected