Closed patmonfort closed 5 years ago
@patmonfort thanks for helping me find some inconsistencies between the Javascript implementation and this one - can you create a list of everything you find instead of creating one-off issues? I will fix them all as part of a single PR.
@jamsesso Hello, of course, please find the list below. The lib is very helpfull, thanks for this job. Let me know if you need additional information.
'/' operator
'in' operator
The following rule returns the exception 'in expects the second argument to be either a string or an array", it returns false using jsonLogic Rule : { "in" : ["abc", 3] }
The following rule return the exception 'in expects exactly 2 arguments', should returns false according to json logic Rule: { "in" : ["Spring"] }
'Number' are considered alsways as Double in java lib (may impact custom operators)
Thanks @patmonfort. I'll take a look at these issues. Your last point about conversion to Double is done by design. In Javascript there are no integers, so this library attempts to convert all Integer inputs to Doubles to mimmic that behaviour. Without it, other bugs pop up.
Hello @jamsesso , this work is very appreciated, thanks for this development. That's understood for the issue around number/interger/double. I'll check when updates are available, let me know if you think I could help.
@patmonfort I've updated the PR - can you verify?
@jamsesso hello, that's perfect, many thanks.
Hello, Trying the following rule {"/":[8]} returns null on standard JSON logic (http://jsonlogic.com/play.html) but does return the value itself using the lib. (v1.0.2). Can you please check the 'evaluate' method of "MathExpression" and considering a special case for the '/' operator when the array of arguments contains one element? Or maybe this one is a fix to be provided in json logic 'official' js lib itself.