MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / docstring

Function docstring

graph-ui/src/browser-ai/code-facts.ts:57–64  ·  view source on GitHub ↗

The first line of a docstring right after line `after`, as it is written (one or two lines).

(lines: readonly string[], after: number, indent: string)

Source from the content-addressed store, hash-verified

55
56/** The first line of a docstring right after line `after`, as it is written (one or two lines). */
57function docstring(lines: readonly string[], after: number, indent: string): string[] {
58 const at = lines.findIndex((line, index) => index > after && line.trim());
59 const first = at >= 0 ? lines[at].trim() : '';
60 if (!/^[rubRUB]{0,2}("""|''')/.test(first)) return [];
61 const bare = /^[rubRUB]{0,2}("""|''')$/.test(first);
62 const next = bare ? lines.slice(at + 1).find(line => line.trim())?.trim() : undefined;
63 return bare && next ? [`${indent}${first}`, `${indent}${bounded(next)}`] : [`${indent}${bounded(first)}`];
64}
65
66/** Where a docstring after line `after` ends, or `after` without one. */
67function docstringEnd(lines: readonly string[], after: number): number {

Callers 2

pythonFactsFunction · 0.85
moduleDocstringFunction · 0.85

Calls 1

boundedFunction · 0.70

Tested by

no test coverage detected