First positional argument's value node of a call.
(call: SyntaxNode)
| 56 | |
| 57 | /** First positional argument's value node of a call. */ |
| 58 | function firstArgValue(call: SyntaxNode): SyntaxNode | null { |
| 59 | const args = getChildByField(call, 'arguments'); |
| 60 | if (!args) return null; |
| 61 | for (let i = 0; i < args.namedChildCount; i++) { |
| 62 | const arg = args.namedChild(i); |
| 63 | if (arg?.type !== 'argument') continue; |
| 64 | return getChildByField(arg, 'value'); |
| 65 | } |
| 66 | return null; |
| 67 | } |
| 68 | |
| 69 | /** Text of a string node's content, or an identifier's text. */ |
| 70 | function literalOrIdentifier(node: SyntaxNode | null, source: string): string | null { |