Function
firstChild
(
node: SyntaxNode,
grammarName: string | string[],
)
Source from the content-addressed store, hash-verified
| 12 | } |
| 13 | |
| 14 | function firstChild( |
| 15 | node: SyntaxNode, |
| 16 | grammarName: string | string[], |
| 17 | ): SyntaxNode | null { |
| 18 | if (Array.isArray(grammarName)) { |
| 19 | return ( |
| 20 | node.children.find((child) => grammarName.includes(child.type)) || null |
| 21 | ); |
| 22 | } |
| 23 | return node.children.find((child) => child.type === grammarName) || null; |
| 24 | } |
| 25 | |
| 26 | async function collapseChildren( |
| 27 | node: SyntaxNode, |
Tested by
no test coverage detected