The first line of a Python module docstring.
(lines: readonly string[])
| 151 | |
| 152 | /** The first line of a Python module docstring. */ |
| 153 | function moduleDocstring(lines: readonly string[]): string | undefined { |
| 154 | const at = lines.findIndex(line => line.trim() && !line.trim().startsWith('#')); |
| 155 | const doc = at >= 0 ? docstring(lines, at - 1, '') : []; |
| 156 | const text = doc.at(-1)?.replace(/^[rubRUB]{0,2}("""|''')/, '').replace(/("""|''')$/, '').trim(); |
| 157 | return text || undefined; |
| 158 | } |
| 159 | |
| 160 | /** An open code file or marked code as facts read from it, for a short general question: what it |
| 161 | * is and how long, a module's docstring, its definitions, and the code facts of a single marked |
no test coverage detected