BigInt value is not working
nirmal25990 opened this issue · 0 comments
nirmal25990 commented
When we pass BigInt
value as fact. Getting this error.

Here is the sample code to reproduce this error.
/**
* Setup a new engine
*/
const engine = new Engine();
// define a rule for detecting the player has exceeded foul limits. Foul out any player who:
// (has committed 5 fouls AND game is 40 minutes) OR (has committed 6 fouls AND game is 48 minutes)
engine.addRule({
conditions: {
any: [
{
all: [
{
fact: 'revenue',
operator: 'greaterThan',
value: 5000,
},
],
},
],
},
event: {
// define the event to fire when the conditions evaluate truthy
type: 'fouledOut',
params: {
message: 'Revenue is higher than the expected!',
},
},
});
/**
* Define facts the engine will use to evaluate the conditions above.
* Facts may also be loaded asynchronously at runtime; see the advanced example below
*/
const facts = {
revenue: BigInt(5001),
};
// Define success and failure handlers
engine.on('success', () => {
console.log('success');
});
engine.on('failure', () => {
console.log('failure');
});
// Run the rule engine
await engine.run(facts);