MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / mappingOf

Function mappingOf

graph-ui/src/browser-ai/workflow-facts.ts:112–119  ·  view source on GitHub ↗

The keys at `level`, each with the lines below it as its value; an item's own "- key" line leads.

(lines: readonly Line[], indexes: readonly number[], level: number)

Source from the content-addressed store, hash-verified

110}
111/** The keys at `level`, each with the lines below it as its value; an item's own "- key" line leads. */
112function mappingOf(lines: readonly Line[], indexes: readonly number[], level: number): YamlValue {
113 const keys = indexes.filter((index, at) => lines[index].keyIndent === level && lines[index].key !== undefined && (at === 0 || !lines[index].dash));
114 return { kind: 'map', entries: keys.map((key, at): [string, YamlValue] => {
115 const body = indexes.filter(index => index > key && index < (keys[at + 1] ?? Infinity));
116 const line = lines[key];
117 return [line.key!, line.value ? scalarOf(line.value) : valueOf(lines, body)];
118 }) };
119}
120/** The whole file as values, for an outline read from it (C7). */
121export function yamlTree(text: string): YamlValue | undefined {
122 const lines = linesOf(text);

Callers 1

valueOfFunction · 0.85

Calls 2

scalarOfFunction · 0.85
valueOfFunction · 0.70

Tested by

no test coverage detected