MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / node

Function node

test/syntax-check.test.ts:25–33  ·  view source on GitHub ↗
(partial: Partial<TSNodeLike> & { type: string }, children: TSNodeLike[] = [])

Source from the content-addressed store, hash-verified

23}
24
25function node(partial: Partial<TSNodeLike> & { type: string }, children: TSNodeLike[] = []): TSNodeLike {
26 return {
27 childCount: children.length,
28 child: (i: number) => children[i] ?? null,
29 startPosition: { row: 0, column: 0 },
30 hasError: children.some(c => boolErr(c)) || partial.type === 'ERROR' || !!partial.isMissing,
31 ...partial,
32 } as TSNodeLike;
33}
34function boolErr(n: TSNodeLike): boolean {
35 const h = (n as any).hasError;
36 return typeof h === 'function' ? h() : !!h;

Callers 1

Calls 1

boolErrFunction · 0.85

Tested by

no test coverage detected