* Returns true if the given CallExpression is a `console.X(...)` call * where X is one of log, warn, error, info, debug.
(node: ts.CallExpression)
| 36 | * where X is one of log, warn, error, info, debug. |
| 37 | */ |
| 38 | function isConsoleCall(node: ts.CallExpression): boolean { |
| 39 | const expr = node.expression; |
| 40 | if (!ts.isPropertyAccessExpression(expr)) { |
| 41 | return false; |
| 42 | } |
| 43 | if (!ts.isIdentifier(expr.expression) || expr.expression.text !== 'console') { |
| 44 | return false; |
| 45 | } |
| 46 | return CONSOLE_METHODS.has(expr.name.text); |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Creates the guard expression: `globalThis.runtime?.isLoggingEnabled` |
no test coverage detected