(node: any, opts?: any)
| 1 | import * as babelGenerator from '@babel/generator'; |
| 2 | |
| 3 | export function genCode(node: any, opts?: any): { code: string } { |
| 4 | const anyGen: any = babelGenerator as any; |
| 5 | const candidates = [anyGen?.default?.default, anyGen?.default, anyGen?.generate, anyGen]; |
| 6 | for (const cand of candidates) { |
| 7 | if (typeof cand === 'function') { |
| 8 | try { |
| 9 | return cand(node, opts || {}); |
| 10 | } catch { |
| 11 | /* try next */ |
| 12 | } |
| 13 | } |
| 14 | } |
| 15 | throw new Error('babel-generator unavailable'); |
| 16 | } |
no outgoing calls
no test coverage detected