jruizgit / rules

Durable Rules Engine
MIT License
1.16k stars 206 forks source link

Wrong handling of OR and NEX operators in array #265

Open hea-lab opened 5 years ago

hea-lab commented 5 years ago

The following rule does not behave as expected

d.ruleset('test', function() {
    whenAll: m.array1.anyItem(~item.field1 || item.field2 == 3)
    run: console.log("test", JSON.stringify(m))
});

const json = JSON.parse('{"array1": [{"field2": 2}]}');
d.post('test', json);

I guess the above case is not related to #264, but I am not 100% sure

jruizgit commented 5 years ago

Hi, thanks for reporting this issue. I have pushed a fix for it. Please use version 2.0.14 published to npm.