Skip to content

BUG: "matches" predicate is throwing rgx.test is not a function #40

@bhaskarkaranam

Description

@bhaskarkaranam

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions