Ignoring the fact condition when the fact is not passed in
See original GitHub issueHi:
I would have liked the rule engine to ignore the fact condition if it is in “ANY” when the fact is not passed in, e.g.,
If my facts are these:
let facts = {
gameDuration: 40
};
And my rule is:
engine.addRule({
conditions: {
any: [{
fact: 'personalFoulCount',
operator: 'greaterThanInclusive',
value: 5
},
{
fact: 'gameDuration',
operator: 'equal',
value: 40
}]
},
event: { // define the event to fire when the conditions evaluate truthy
type: 'fouledOut',
params: {
message: 'Player has fouled out!'
}
}
});
I would have preferred the rule engine would not have errored out and ignore the fact that personalFoulCount is not there as it was in ANY condition clause.
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Rule 401. Test for Relevant Evidence - Law.Cornell.Edu
Evidence is relevant if: (a) it has any tendency to make a fact more or less ... Passing mention should be made of...
Read more >Writing a Statement of Facts in an Appellate Brief
Ignoring a harmful fact does not make it go away; it simply leaves the problem unexplained and undefended. • Emphasize the strengths and...
Read more >Why People Ignore Facts | Psychology Today
When it comes to reasoning, identity trumps truth.
Read more >Master List of Logical Fallacies
Fallacies are fake or deceptive arguments, "junk cognition," that is, arguments that seem irrefutable but prove nothing. Fallacies often seem superficially ...
Read more >How to force clips to ignore a certain fact for a rule?
I want to retract fact-1 and fact-3 because they include 1 and 5 uniquely. I'm trying to achieve it using a rule like...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@arsalans this feature is now available in
1.4.0
as anallowUndefinedFacts
engine option. Please see the updated docs@arsalans yep, we’re aligned. Any unregistered fact will simply be treated as a falsey condition. This could mean a rule still evaluates truthy, as in the
ANY
scenario you mentioned. I’ll attempt to come up with a better term thanignoreUnregisteredFacts
that better explains the behavior