MCPcopy Create free account
hub / github.com/TailGrids/tailgrids / expandLineRanges

Function expandLineRanges

apps/docs/src/components/code-block.tsx:19–32  ·  view source on GitHub ↗
(ranges: HighlightLine[])

Source from the content-addressed store, hash-verified

17};
18
19function expandLineRanges(ranges: HighlightLine[]): Set<number> {
20 const lines = new Set<number>();
21 for (const range of ranges) {
22 if (typeof range === "number") {
23 lines.add(range);
24 } else {
25 const [start, end] = range;
26 for (let i = start; i <= end; i++) {
27 lines.add(i);
28 }
29 }
30 }
31 return lines;
32}
33
34function escapeRegExp(str: string): string {
35 return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");

Callers 1

CodeBlockFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected