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

Method asObject

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

Source from the content-addressed store, hash-verified

3814 const body = getChildByField(fnNode, 'body');
3815 if (!body) return null;
3816 const asObject = (n: SyntaxNode | null): SyntaxNode | null => {
3817 if (!n) return null;
3818 if (n.type === 'object' || n.type === 'object_expression') return n;
3819 if (n.type === 'parenthesized_expression') {
3820 for (let i = 0; i < n.namedChildCount; i++) {
3821 const inner = asObject(n.namedChild(i));
3822 if (inner) return inner;
3823 }
3824 }
3825 return null;
3826 };
3827 // `(set, get) => ({...})` — body is the (parenthesized) object directly.
3828 const direct = asObject(body);
3829 if (direct) return direct;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected