One registration reported once, even when two patterns both matched it.
(routes: SourceRoute[])
| 188 | |
| 189 | /** One registration reported once, even when two patterns both matched it. */ |
| 190 | function dedupe(routes: SourceRoute[]): SourceRoute[] { |
| 191 | const seen = new Set<string>(); |
| 192 | const out: SourceRoute[] = []; |
| 193 | for (const route of routes) { |
| 194 | const key = `${route.method ?? ''} ${route.path} ${route.line}`; |
| 195 | if (seen.has(key)) { |
| 196 | continue; |
| 197 | } |
| 198 | seen.add(key); |
| 199 | out.push(route); |
| 200 | } |
| 201 | return out; |
| 202 | } |