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

Function blankRanges

src/resolution/cpp-raw-strings.ts:172–184  ·  view source on GitHub ↗

`text` with spaces over each of `ranges`, which may overlap and may run past its end.

(text: string, ranges: Ranges)

Source from the content-addressed store, hash-verified

170
171/** `text` with spaces over each of `ranges`, which may overlap and may run past its end. */
172function blankRanges(text: string, ranges: Ranges): string {
173 ranges.sort((a, b) => a[0] - b[0]);
174 let out = '';
175 let at = 0;
176 for (const [start, end] of ranges) {
177 const from = Math.max(start, at);
178 const to = Math.min(end, text.length);
179 if (from >= to) continue;
180 out += text.slice(at, from) + ' '.repeat(to - from);
181 at = to;
182 }
183 return out + text.slice(at);
184}

Callers 1

cppLiteralsBlankedFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected