( template: string, replacer: (match: string, index: number, template: string) => string )
| 142 | * Distinguishes < operator from < bracket using isLikelyReferenceSegment. |
| 143 | */ |
| 144 | export function replaceValidReferences( |
| 145 | template: string, |
| 146 | replacer: (match: string, index: number, template: string) => string |
| 147 | ): string { |
| 148 | const pattern = createReferencePattern() |
| 149 | |
| 150 | return template.replace(pattern, (match, _content, index) => { |
| 151 | if (!isLikelyReferenceSegment(match)) { |
| 152 | return match |
| 153 | } |
| 154 | return replacer(match, index, template) |
| 155 | }) |
| 156 | } |
nothing calls this directly
no test coverage detected