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

Method asObject

src/extraction/tree-sitter.ts:3647–3657  ·  view source on GitHub ↗
(n: SyntaxNode | null)

Source from the content-addressed store, hash-verified

3645 const body = getChildByField(fnNode, 'body');
3646 if (!body) return null;
3647 const asObject = (n: SyntaxNode | null): SyntaxNode | null => {
3648 if (!n) return null;
3649 if (n.type === 'object' || n.type === 'object_expression') return n;
3650 if (n.type === 'parenthesized_expression') {
3651 for (let i = 0; i < n.namedChildCount; i++) {
3652 const inner = asObject(n.namedChild(i));
3653 if (inner) return inner;
3654 }
3655 }
3656 return null;
3657 };
3658 // `(set, get) => ({...})` — body is the (parenthesized) object directly.
3659 const direct = asObject(body);
3660 if (direct) return direct;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected