MCPcopy Create free account
hub / github.com/Effect-TS/effect / parseMapping

Method parseMapping

packages/effect/src/unstable/encoding/Yaml.ts:248–274  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

246 }
247
248 private parseMapping(): YamlRecord {
249 this.expect("{")
250 const output: YamlRecord = {}
251 this.skipWhitespace()
252 if (this.peek() === "}") {
253 this.index++
254 return output
255 }
256 while (true) {
257 const key = this.parseKey()
258 this.skipWhitespace()
259 this.expect(":")
260 if (hasOwn.call(output, key)) this.fail(`Duplicate key '${key}'`)
261 setProperty(output, key, this.parseValue())
262 this.skipWhitespace()
263 if (this.peek() === "}") {
264 this.index++
265 return output
266 }
267 this.expect(",")
268 this.skipWhitespace()
269 if (this.peek() === "}") {
270 this.index++
271 return output
272 }
273 }
274 }
275
276 private parseKey(): string {
277 this.skipWhitespace()

Callers 1

parseValueMethod · 0.95

Calls 7

expectMethod · 0.95
skipWhitespaceMethod · 0.95
peekMethod · 0.95
parseKeyMethod · 0.95
failMethod · 0.95
parseValueMethod · 0.95
setPropertyFunction · 0.85

Tested by

no test coverage detected