(lines: string[], replacements: Array<[number, number, string[]]>)
| 389 | } |
| 390 | |
| 391 | function applyReplacements(lines: string[], replacements: Array<[number, number, string[]]>): string[] { |
| 392 | // Apply replacements in reverse order to avoid index shifting |
| 393 | const result = [...lines] |
| 394 | |
| 395 | for (let i = replacements.length - 1; i >= 0; i--) { |
| 396 | const [startIdx, oldLen, newSegment] = replacements[i] |
| 397 | |
| 398 | // Remove old lines |
| 399 | result.splice(startIdx, oldLen) |
| 400 | |
| 401 | // Insert new lines |
| 402 | for (let j = 0; j < newSegment.length; j++) { |
| 403 | result.splice(startIdx + j, 0, newSegment[j]) |
| 404 | } |
| 405 | } |
| 406 | |
| 407 | return result |
| 408 | } |
| 409 | |
| 410 | function seekSequence(lines: string[], pattern: string[], startIndex: number): number { |
| 411 | if (pattern.length === 0) return -1 |
no outgoing calls
no test coverage detected