( input: string, )
| 60 | } |
| 61 | |
| 62 | export function parseReferences( |
| 63 | input: string, |
| 64 | ): Array<{ id: number; match: string; index: number }> { |
| 65 | const referencePattern = |
| 66 | /\[(Pasted text|Image|\.\.\.Truncated text) #(\d+)(?: \+\d+ lines)?(\.)*\]/g |
| 67 | const matches = [...input.matchAll(referencePattern)] |
| 68 | return matches |
| 69 | .map(match => ({ |
| 70 | id: parseInt(match[2] || '0'), |
| 71 | match: match[0], |
| 72 | index: match.index, |
| 73 | })) |
| 74 | .filter(match => match.id > 0) |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * Replace [Pasted text #N] placeholders in input with their actual content. |
no outgoing calls
no test coverage detected