MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / intersectRanges

Function intersectRanges

src/cm/colorView.ts:223–236  ·  view source on GitHub ↗
(
	ranges: readonly DocRange[],
	bounds: readonly DocRange[],
)

Source from the content-addressed store, hash-verified

221}
222
223function 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
238function subtractRanges(
239 ranges: readonly DocRange[],

Callers 1

flushDecorationsMethod · 0.85

Calls 1

normalizeRangesFunction · 0.85

Tested by

no test coverage detected