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

Method parseMappingEntry

packages/effect/src/encoding/Yaml.ts:1123–1139  ·  view source on GitHub ↗
(
    mapping: MappingBuilder,
    text: string,
    separator: number,
    indent: number,
    line: Line
  )

Source from the content-addressed store, hash-verified

1121 }
1122
1123 private parseMappingEntry(
1124 mapping: MappingBuilder,
1125 text: string,
1126 separator: number,
1127 indent: number,
1128 line: Line
1129 ): void {
1130 const fail = (message: string) => this.fail(line, message)
1131 const key = this.parseBlockKey(text.slice(0, separator), fail)
1132 const rawValue = trimWhiteStart(text.slice(separator + 1))
1133 // Bypass scalar parsing for empty values to reduce per-level stack use.
1134 const value = rawValue.length === 0
1135 ? this.parseBlockValue(indent, true)
1136 : this.parseNodeValue(rawValue, indent, true)
1137 if (isMergeKey(key)) mapping.merge(value, fail)
1138 else mapping.set(parseKey(key), value, fail)
1139 }
1140
1141 // The key's source text, from `raw` before the `:` separator.
1142 private parseBlockKey(raw: string, fail: (message: string) => never): string {

Callers 1

parseMappingMethod · 0.95

Calls 9

parseBlockKeyMethod · 0.95
parseBlockValueMethod · 0.95
parseNodeValueMethod · 0.95
trimWhiteStartFunction · 0.85
isMergeKeyFunction · 0.85
parseKeyFunction · 0.85
sliceMethod · 0.80
mergeMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected