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

Function blankVarianceAnnotations

src/extraction/languages/typescript.ts:137–154  ·  view source on GitHub ↗
(source: string)

Source from the content-addressed store, hash-verified

135 * grammar reads.
136 */
137export function blankVarianceAnnotations(source: string): string {
138 if (!VARIANCE_HINT.test(source)) return source;
139 const blanks: Array<[number, number]> = [];
140 VARIANCE_HEAD.lastIndex = 0;
141 for (let head = VARIANCE_HEAD.exec(source); head; head = VARIANCE_HEAD.exec(source)) {
142 collectVarianceWords(source, VARIANCE_HEAD.lastIndex, blanks);
143 }
144 if (blanks.length === 0) return source;
145 blanks.sort((a, b) => a[0] - b[0]);
146 let out = '';
147 let at = 0;
148 for (const [start, end] of blanks) {
149 if (start < at) continue;
150 out += source.slice(at, start) + ' '.repeat(end - start);
151 at = end;
152 }
153 return out + source.slice(at);
154}
155
156/**
157 * The `in` and `out` modifiers of the type parameter list that opens just

Callers 2

typescript.tsFile · 0.85

Calls 2

collectVarianceWordsFunction · 0.85
execMethod · 0.65

Tested by

no test coverage detected