Every line inside the value of line `at`; a list may start at its key's own indent.
(lines: readonly Line[], at: number)
| 50 | |
| 51 | /** Every line inside the value of line `at`; a list may start at its key's own indent. */ |
| 52 | function inside(lines: readonly Line[], at: number): number[] { |
| 53 | const parent = lines[at], found: number[] = []; |
| 54 | for (let index = at + 1; index < lines.length; index++) { |
| 55 | const line = lines[index]; |
| 56 | if (line.keyIndent <= parent.keyIndent || (line.dash && line.indent < parent.keyIndent)) break; |
| 57 | found.push(index); |
| 58 | } |
| 59 | return found; |
| 60 | } |
| 61 | /** The direct children of line `at`: the lines inside it at their smallest key indent. */ |
| 62 | function children(lines: readonly Line[], at: number): number[] { |
| 63 | const found = inside(lines, at); |
no test coverage detected