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

Method parseNodeValue

packages/effect/src/unstable/encoding/Yaml.ts:415–436  ·  view source on GitHub ↗
(rawValue: string, parentIndent: number)

Source from the content-addressed store, hash-verified

413 }
414
415 private parseNodeValue(rawValue: string, parentIndent: number): unknown {
416 let value = rawValue
417 let anchor: string | undefined
418 const anchorMatch = /^&([^\s,[\]{}]+)(?:\s+(.*))?$/.exec(value)
419 if (anchorMatch !== null) {
420 anchor = anchorMatch[1]
421 value = anchorMatch[2] ?? ""
422 }
423
424 let parsed: unknown
425 if (value.length === 0) {
426 this.skipIgnored()
427 const next = this.lines[this.index]
428 parsed = next !== undefined && next.indent > parentIndent ? this.parseNode(next.indent) : null
429 } else if (/^[|>](?:[1-9]?[+-]?|[+-]?[1-9]?)$/.test(value)) {
430 parsed = this.parseBlockScalar(value, parentIndent)
431 } else {
432 parsed = this.parseInlineValue(value)
433 }
434 if (anchor !== undefined) this.anchors.set(anchor, parsed)
435 return parsed
436 }
437
438 private parseInlineValue(value: string): unknown {
439 if (value.startsWith("*")) {

Callers 2

parseMappingEntryMethod · 0.95
parseSequenceMethod · 0.95

Calls 6

skipIgnoredMethod · 0.95
parseNodeMethod · 0.95
parseBlockScalarMethod · 0.95
parseInlineValueMethod · 0.95
execMethod · 0.80
setMethod · 0.65

Tested by

no test coverage detected