EdgeVerve / feel

Expression Language for creating and executing business rules in decision table based on DMN 1.1 specification for conformance level 3
MIT License
93 stars 48 forks source link

Empty values in context #23

Closed AlexeiBaranov closed 3 years ago

AlexeiBaranov commented 3 years ago

Rule: 'a+b' context: {a:"", b"123"}

throws error " + 123 : operation invalid for one or more operands types".

Error can be fixed by this change to fn-generator.js: -const presence = (...args) => args.reduce((acc, arg) => acc && (arg || arg===0), true); +const presence = (...args) => args.reduce((acc, arg) => acc && (arg!=undefined), true);

As far as I understand, the main purpose of this function is to determine the presence of the necessary parameters. But with such implementation, only numeric values can be empty. Comparison with undefined solves the problem for other types.

deostroll commented 3 years ago

This is fixed and the update will be updated in the following week.