(lines: ReadonlyArray<string>, pattern: ReadonlyArray<string>, start: number, eof = false)
| 158 | } |
| 159 | |
| 160 | function seek(lines: ReadonlyArray<string>, pattern: ReadonlyArray<string>, start: number, eof = false) { |
| 161 | if (pattern.length === 0) return -1 |
| 162 | for (const compare of [exact, rstrip, trim, normalized]) { |
| 163 | if (eof) { |
| 164 | const offset = lines.length - pattern.length |
| 165 | if (offset >= start && matches(lines, pattern, offset, compare)) return offset |
| 166 | } |
| 167 | for (let offset = start; offset <= lines.length - pattern.length; offset++) { |
| 168 | if (matches(lines, pattern, offset, compare)) return offset |
| 169 | } |
| 170 | } |
| 171 | return -1 |
| 172 | } |
| 173 | |
| 174 | function matches( |
| 175 | lines: ReadonlyArray<string>, |
no test coverage detected