* Matches a function call if the name of the function is one of the given names * @param names The acceptable function names * @returns The function call node if the name matches otherwise null
(...names: string[])
| 101 | * @returns The function call node if the name matches otherwise null |
| 102 | */ |
| 103 | function functionNameBasedFinder(...names: string[]) { |
| 104 | return (node: SyntaxNode) => { |
| 105 | const functionCallNode = functionCallFinder(node); |
| 106 | if (functionCallNode == null) { |
| 107 | return null; |
| 108 | } |
| 109 | |
| 110 | const functionNode = getValueNodes(functionCallNode)[0]; |
| 111 | |
| 112 | return names.includes(functionNode?.text) ? functionCallNode : null; |
| 113 | }; |
| 114 | } |
| 115 | |
| 116 | function functionNameBasedMatcher(...names: string[]) { |
| 117 | return matcher(functionNameBasedFinder(...names)); |
no test coverage detected