File tree Expand file tree Collapse file tree
packages/datasource-engine/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,6 +18,13 @@ function isObject(obj: unknown) {
1818}
1919
2020export const transformExpression = ( code : string , context : IDataSourceRuntimeContext ) => {
21+ // 补充异常情况兼容性
22+ if ( code === undefined ) {
23+ return function ( ) { } ;
24+ }
25+ if ( code === '' ) {
26+ return function ( ) { return '' ; } ;
27+ }
2128 try {
2229 return new Function ( `return (${ code } )` ) . call ( context ) ;
2330 } catch ( error ) {
@@ -26,6 +33,12 @@ export const transformExpression = (code: string, context: IDataSourceRuntimeCon
2633} ;
2734
2835export const transformFunction = ( code : string , context : IDataSourceRuntimeContext ) => {
36+ if ( code === undefined ) {
37+ return function ( ) { } ;
38+ }
39+ if ( code === '' ) {
40+ return function ( ) { return '' ; } ;
41+ }
2942 try {
3043 return new Function ( `return (${ code } )` ) . call ( context ) . bind ( context ) ;
3144 } catch ( error ) {
You can’t perform that action at this time.
0 commit comments