` key: value` → its indent, decoded key and inline value ('' for a block). Not for `- item` lines.
(line: string)
| 205 | |
| 206 | /** ` key: value` → its indent, decoded key and inline value ('' for a block). Not for `- item` lines. */ |
| 207 | function 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. */ |
| 214 | function findTop(lines: string[], key: string): { line: number; value: string; end: number } | null { |
no test coverage detected