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

Function definitionsOf

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

The definitions at the outermost indent of the code: "class ArrayAgg", "def ordered".

(lines: readonly string[], fence: string)

Source from the content-addressed store, hash-verified

141
142/** The definitions at the outermost indent of the code: "class ArrayAgg", "def ordered". */
143function definitionsOf(lines: readonly string[], fence: string): string[] {
144 const code = lines.filter(line => line.trim() && !/^\s*(?:#|\/\/|\/\*|\*)/.test(line));
145 const outer = Math.min(...code.map(indentOf));
146 return code.filter(line => indentOf(line) === outer).flatMap(line => {
147 const match = (fence === 'python' ? PYTHON_DEFINITION : DEFINITION).exec(line.trim());
148 return match ? [`${match[1]} ${match[2]}`] : [];
149 });
150}
151
152/** The first line of a Python module docstring. */
153function moduleDocstring(lines: readonly string[]): string | undefined {

Callers 1

codeSourceFactsFunction · 0.85

Calls 1

indentOfFunction · 0.85

Tested by

no test coverage detected