The definitions at the outermost indent of the code: "class ArrayAgg", "def ordered".
(lines: readonly string[], fence: string)
| 141 | |
| 142 | /** The definitions at the outermost indent of the code: "class ArrayAgg", "def ordered". */ |
| 143 | function definitionsOf(lines: readonly string[], fence: string): string[] { |
| 144 | const code = lines.filter(line => line.trim() && !/^\s*(?:#|\/\/|\/\*|\*)/.test(line)); |
| 145 | const outer = Math.min(...code.map(indentOf)); |
| 146 | return code.filter(line => indentOf(line) === outer).flatMap(line => { |
| 147 | const match = (fence === 'python' ? PYTHON_DEFINITION : DEFINITION).exec(line.trim()); |
| 148 | return match ? [`${match[1]} ${match[2]}`] : []; |
| 149 | }); |
| 150 | } |
| 151 | |
| 152 | /** The first line of a Python module docstring. */ |
| 153 | function moduleDocstring(lines: readonly string[]): string | undefined { |
no test coverage detected