@@ -91,7 +91,12 @@ interface DirectiveOptions {
91
91
}
92
92
93
93
export interface Evaluate {
94
- ( entry : DirectiveEntry , ...args : any [ ] ) : any ;
94
+ (
95
+ entry : DirectiveEntry ,
96
+ options : {
97
+ invokeFunctions : boolean ;
98
+ }
99
+ ) : any ;
95
100
}
96
101
97
102
interface GetEvaluate {
@@ -231,7 +236,7 @@ const resolve = ( path: string, namespace: string ) => {
231
236
// Generate the evaluate function.
232
237
export const getEvaluate : GetEvaluate =
233
238
( { scope } ) =>
234
- ( entry , ... args ) => {
239
+ ( entry , options ) => {
235
240
let { value : path , namespace } = entry ;
236
241
if ( typeof path !== 'string' ) {
237
242
throw new Error ( 'The `value` prop should be a string path' ) ;
@@ -241,9 +246,10 @@ export const getEvaluate: GetEvaluate =
241
246
path [ 0 ] === '!' && ! ! ( path = path . slice ( 1 ) ) ;
242
247
setScope ( scope ) ;
243
248
const value = resolve ( path , namespace ) ;
244
- const result = typeof value === 'function' ? value ( ...args ) : value ;
249
+ const isFunction = typeof value === 'function' ;
250
+ const result = options ?. invokeFunctions && isFunction ? value ( ) : value ;
245
251
resetScope ( ) ;
246
- return hasNegationOperator ? ! result : result ;
252
+ return hasNegationOperator && ! isFunction ? ! result : result ;
247
253
} ;
248
254
249
255
// Separate directives by priority. The resulting array contains objects
0 commit comments