json-rules-engine-simplified
json-rules-engine-simplified copied to clipboard
BUG: "matches" predicate is throwing rgx.test is not a function
Matches predicate which helps to do regex check is throwing and rgx.test is not a function. Rule and whole Engine run I used:
var Engine = require("json-rules-engine-simplified").default let regexp = new RegExp('g') console.log(regexp, "regular expression") let rules = [{ conditions: { "firstName": { "matches": regexp } }, event: { "ignore": "fjbehdsj" } }]; let input = {"firstName": "ugvdfvgfd"} let engine = new Engine(rules) engine.run(input).then((events) => { console.log("events", events) })
Error :
TypeError: rgx.test is not a function in predicate/lib/predicates.js — line 182 at Object.curried (as matches) in predicate/lib/utils.js — line 22 in json-rules-engine-simplified/lib/checkField.js — line 39 at Array.every in ECMAScript