File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -64,13 +64,11 @@ export function JsonView(params?: {}, method?: string): Function {
64
64
let transformer : Function = typeof method === "string" && method ? classTransformer [ method ] : classTransformer . classToPlain ;
65
65
let result : any = originalMethod . apply ( this , args ) ;
66
66
67
- if ( ! ! result && ( typeof result === "object" || typeof result === "function" ) && typeof result . then === "function" ) {
68
- // If result is an instance of Promise.
69
- return result . then ( ( data : any ) => transformer ( data , params ) ) ;
70
- }
67
+ let isPromise = ! ! result && ( typeof result === "object" || typeof result === "function" ) && typeof result . then === "function" ;
71
68
72
- result = transformer ( result , params ) ;
73
- return result ;
69
+ return isPromise ?
70
+ result . then ( ( data : any ) => transformer ( data , params ) ) :
71
+ transformer ( result , params ) ;
74
72
} ;
75
73
} ;
76
74
}
You can’t perform that action at this time.
0 commit comments