Detect a section start.
(input: string, lineNumber: number)
| 22 | |
| 23 | /** Detect a section start. */ |
| 24 | function isSection(input: string, lineNumber: number): boolean { |
| 25 | if (input.startsWith("[")) { |
| 26 | if (input.endsWith("]")) { |
| 27 | return true; |
| 28 | } |
| 29 | throw new SyntaxError( |
| 30 | `Unexpected end of INI section at line ${lineNumber}`, |
| 31 | ); |
| 32 | } |
| 33 | return false; |
| 34 | } |
| 35 | |
| 36 | function* readTextLines(text: string): Generator<string> { |
| 37 | let line = ""; |