( lines: string[], context: string[], start: number, )
| 297 | } |
| 298 | |
| 299 | function findContextCore( |
| 300 | lines: string[], |
| 301 | context: string[], |
| 302 | start: number, |
| 303 | ): { newIndex: number; fuzz: number } { |
| 304 | if (context.length === 0) { |
| 305 | return { newIndex: start, fuzz: 0 } |
| 306 | } |
| 307 | |
| 308 | for (let i = start; i < lines.length; i += 1) { |
| 309 | if (equalsSlice(lines, context, i, (value) => value)) { |
| 310 | return { newIndex: i, fuzz: 0 } |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | for (let i = start; i < lines.length; i += 1) { |
| 315 | if (equalsSlice(lines, context, i, (value) => value.trimEnd())) { |
| 316 | return { newIndex: i, fuzz: 1 } |
| 317 | } |
| 318 | } |
| 319 | |
| 320 | for (let i = start; i < lines.length; i += 1) { |
| 321 | if (equalsSlice(lines, context, i, (value) => value.trim())) { |
| 322 | return { newIndex: i, fuzz: 100 } |
| 323 | } |
| 324 | } |
| 325 | |
| 326 | return { newIndex: -1, fuzz: 0 } |
| 327 | } |
| 328 | |
| 329 | function findContext( |
| 330 | lines: string[], |
no test coverage detected