( ranges: readonly DocRange[], bounds: readonly DocRange[], )
| 221 | } |
| 222 | |
| 223 | function intersectRanges( |
| 224 | ranges: readonly DocRange[], |
| 225 | bounds: readonly DocRange[], |
| 226 | ): DocRange[] { |
| 227 | const intersections: DocRange[] = []; |
| 228 | for (const range of ranges) { |
| 229 | for (const bound of bounds) { |
| 230 | const from = Math.max(range.from, bound.from); |
| 231 | const to = Math.min(range.to, bound.to); |
| 232 | if (from <= to) intersections.push({ from, to }); |
| 233 | } |
| 234 | } |
| 235 | return normalizeRanges(intersections); |
| 236 | } |
| 237 | |
| 238 | function subtractRanges( |
| 239 | ranges: readonly DocRange[], |
no test coverage detected