(code: string, context: IDataSourceRuntimeContext)
| 28 | } |
| 29 | |
| 30 | export const transformFunction = (code: string, context: IDataSourceRuntimeContext) => { |
| 31 | if (code === undefined) { |
| 32 | return () => {} |
| 33 | } |
| 34 | if (code === '') { |
| 35 | return () => '' |
| 36 | } |
| 37 | try { |
| 38 | return new Function(`return (${code})`).call(context).bind(context) |
| 39 | } catch (error) { |
| 40 | console.error(`transformFunction error, code is ${code}, context is ${context}, error is ${error}`) |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | export const transformBoolStr = (str: string) => { |
| 45 | return str !== 'false' |
no test coverage detected