MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / intersectRange

Function intersectRange

src/mcp/explore-dedup.ts:117–128  ·  view source on GitHub ↗
(
  range: ExploreLineRange,
  served: ReadonlyArray<ExploreLineRange>,
)

Source from the content-addressed store, hash-verified

115
116/** The parts of `range` that `served` covers. */
117export function intersectRange(
118 range: ExploreLineRange,
119 served: ReadonlyArray<ExploreLineRange>,
120): ExploreLineRange[] {
121 const out: ExploreLineRange[] = [];
122 for (const s of served) {
123 const start = Math.max(range.start, s.start);
124 const end = Math.min(range.end, s.end);
125 if (end >= start) out.push({ start, end });
126 }
127 return mergeRanges(out);
128}
129
130/** The parts of `range` that `cut` does NOT cover. */
131export function subtractRange(

Callers 2

dedupeRangeFunction · 0.85

Calls 2

mergeRangesFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected