MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / parseKeyLine

Function parseKeyLine

src/installer/targets/hermes.ts:207–211  ·  view source on GitHub ↗

` key: value` → its indent, decoded key and inline value ('' for a block). Not for `- item` lines.

(line: string)

Source from the content-addressed store, hash-verified

205
206/** ` key: value` → its indent, decoded key and inline value ('' for a block). Not for `- item` lines. */
207function parseKeyLine(line: string): { indent: number; key: string; value: string } | null {
208 const m = /^( *)("(?:[^"\\]|\\.)*"|'(?:[^']|'')*'|[^\s#'"\-?:,[\]{}][^:#]*?|-[^\s:#][^:#]*?)[ \t]*:(?=[ \t]|$)(.*)$/.exec(line);
209 if (!m) return null;
210 return { indent: m[1]!.length, key: unquote(m[2]!), value: stripComment(m[3]!) };
211}
212
213/** A column-0 key: its line, inline value, and where the next column-0 key starts. */
214function findTop(lines: string[], key: string): { line: number; value: string; end: number } | null {

Callers 2

findTopFunction · 0.85
childrenOfFunction · 0.85

Calls 3

stripCommentFunction · 0.85
unquoteFunction · 0.70
execMethod · 0.65

Tested by

no test coverage detected