jamsesso / json-logic-java

A pure Java implementation of JsonLogic without using the Nashorn JS engine
MIT License
99 stars 50 forks source link

Truthy on double.Nan returns True (instead of false) #9

Closed patmonfort closed 5 years ago

patmonfort commented 5 years ago

Hello, While trying the 'truthy' method of JsonLogic (v1.0.2), we discover that calling this method with Double.NaN returns true instead of false. (https://developer.mozilla.org/en-US/docs/Glossary/Falsy) This seems to come the way 'Double' are checked in the 'truthy' method of JsonLogic.java. This method considers a Double as truthy if it's different to zero. Could you please add a check using Double.isNan((Number) value) also ? Thanks

jamsesso commented 5 years ago

@patmonfort Can you verify that the PR I put up fixes your issues?

patmonfort commented 5 years ago

@jamsesso hello, thanks a lot for your job and reactivity, those fixes are ok.