File tree 2 files changed +3
-3
lines changed
2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -24,8 +24,8 @@ class Engine extends EventEmitter {
24
24
this . rules = [ ]
25
25
this . allowUndefinedFacts = options . allowUndefinedFacts || false
26
26
this . pathResolver = options . pathResolver || defaultPathResolver
27
- const interpolation = options . interpolation || defaultInterpolation ;
28
- this . interpolation = typeof interpolation === 'string' ? new RegExp ( interpolation ) : interpolation ;
27
+ this . interpolation = options . interpolation || defaultInterpolation ;
28
+ if ( ! ( this . interpolation instanceof RegExp ) || ! this . interpolation . global ) throw new Error ( ' interpolation option must be a global regexp' )
29
29
this . operators = new Map ( )
30
30
this . facts = new Map ( )
31
31
this . status = READY
Original file line number Diff line number Diff line change 1
1
export interface EngineOptions {
2
2
allowUndefinedFacts ?: boolean ;
3
3
pathResolver ?: PathResolver ;
4
- interpolation ?: RegExp | string ;
4
+ interpolation ?: RegExp ;
5
5
}
6
6
7
7
export interface EngineResult {
You can’t perform that action at this time.
0 commit comments