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

Function loopsAt

__tests__/branch-guards-languages.test.ts:340–344  ·  view source on GitHub ↗

The loop headers at the site, outermost first, as ` `.

(src: string, needle: string, language: Language)

Source from the content-addressed store, hash-verified

338describe('loops a site is written inside', () => {
339 /** The loop headers at the site, outermost first, as `<kind> <text>`. */
340 async function loopsAt(src: string, needle: string, language: Language) {
341 const line = lineOf(src, needle);
342 const column = src.split('\n')[line - 1]!.indexOf(needle);
343 return (await loopsInSource(src, language, line, column)).map((l) => `${l.kind} ${l.text}`);
344 }
345
346 it('reads a JS for-of and a while', async () => {
347 const src = `

Callers 1

Calls 3

loopsInSourceFunction · 0.90
mapMethod · 0.80
lineOfFunction · 0.70

Tested by

no test coverage detected