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

Function sectionFor

__tests__/explore-exact-target.test.ts:47–56  ·  view source on GitHub ↗

The `**` `**` section, header through the line before the next file header.

(text: string, file: string)

Source from the content-addressed store, hash-verified

45
46/** The `**`<file>`**` section, header through the line before the next file header. */
47function sectionFor(text: string, file: string): string {
48 const lines = text.split('\n');
49 const start = lines.findIndex((l) => l.startsWith(`**\`${file}\`**`));
50 if (start < 0) return '';
51 let end = lines.length;
52 for (let i = start + 1; i < lines.length; i++) {
53 if (lines[i]!.startsWith('**`')) { end = i; break; }
54 }
55 return lines.slice(start, end).join('\n');
56}
57
58/** `n` filler statements, each a distinct line so nothing dedups or folds. */
59function filler(tag: string, n: number, indent = ' '): string {

Callers 1

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected