Closed mauriciomaniglia closed 1 year ago
Currently, the library does not support lookup for numbers in arrays, only Strings.
As an example, the Rule and Data below works correctly when we try it on the JsonLogic website, but not in this library.
{ "if": [ { "some" : [ {"var" : ""}, { "and": [ { "==": [{ "var": "id" }, "123"] }, { "all" : [ { "map": [ {"var":"componentAttributes.options"}, { "var": "value"} ] }, { "in":[{"var":""}, [1, 2] ] } ] } ] } ] }, 5 ] }
[ { "id": "123", "componentAttributes":{ "options":[ { "value":1 }, { "value":2 } ] } } ]
I'm adding Integer and Double values support in the IN expression.
IN
@mauriciomaniglia Thanks for providing a fix for this!
@csknns, can you add a new tag with this fix?
@mauriciomaniglia Sure done! tag 1.2.3
Details
Currently, the library does not support lookup for numbers in arrays, only Strings.
As an example, the Rule and Data below works correctly when we try it on the JsonLogic website, but not in this library.
Rule
{ "if": [ { "some" : [ {"var" : ""}, { "and": [ { "==": [{ "var": "id" }, "123"] }, { "all" : [ { "map": [ {"var":"componentAttributes.options"}, { "var": "value"} ] }, { "in":[{"var":""}, [1, 2] ] } ] } ] } ] }, 5 ] }
Data
[ { "id": "123", "componentAttributes":{ "options":[ { "value":1 }, { "value":2 } ] } } ]
Fix
I'm adding Integer and Double values support in the
IN
expression.