(lines: string[], replacements: Array<[number, number, string[]]>)
| 396 | } |
| 397 | |
| 398 | function applyReplacements(lines: string[], replacements: Array<[number, number, string[]]>): string[] { |
| 399 | // Apply replacements in reverse order to avoid index shifting |
| 400 | const result = [...lines] |
| 401 | |
| 402 | for (let i = replacements.length - 1; i >= 0; i--) { |
| 403 | const [startIdx, oldLen, newSegment] = replacements[i] |
| 404 | |
| 405 | // Remove old lines |
| 406 | result.splice(startIdx, oldLen) |
| 407 | |
| 408 | // Insert new lines |
| 409 | for (let j = 0; j < newSegment.length; j++) { |
| 410 | result.splice(startIdx + j, 0, newSegment[j]) |
| 411 | } |
| 412 | } |
| 413 | |
| 414 | return result |
| 415 | } |
| 416 | |
| 417 | // Normalize Unicode punctuation to ASCII equivalents (like Rust's normalize_unicode) |
| 418 | function normalizeUnicode(str: string): string { |
no outgoing calls
no test coverage detected