(code: string, context: IDataSourceRuntimeContext)
| 13 | } |
| 14 | |
| 15 | export const transformExpression = (code: string, context: IDataSourceRuntimeContext) => { |
| 16 | // 补充异常情况兼容性 |
| 17 | if (code === undefined) { |
| 18 | return () => {} |
| 19 | } |
| 20 | if (code === '') { |
| 21 | return () => '' |
| 22 | } |
| 23 | try { |
| 24 | return new Function(`return (${code})`).call(context) |
| 25 | } catch (error) { |
| 26 | console.error(`transformExpression error, code is ${code}, context is ${context}, error is ${error}`) |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | export const transformFunction = (code: string, context: IDataSourceRuntimeContext) => { |
| 31 | if (code === undefined) { |
no test coverage detected