New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Discrepancy between js and .net version in comparison operators #377
Comments
Trying to align their original implementation and this one is a continued headache. Their test suite is very basic, and they don't specify a lot of the behaviors. Alignment is the goal. |
I really wish they had an actual test suite or a spec. |
Found an interesting one: {"cat" : ["abc", {}]}
// returns "abc[object Object]" I don't think that's something I want to replicate. I think I'm okay throwing an error for this. |
@alexkharuk I think I got it all. Please download and play with it. If you notice anything out of place, please let me know. |
Hello @gregsdennis ! rule:
payload: js result: true |
thanks. I'll add it to the list. |
Looks like they're converting the empty string to 0. The
v4.0.1 incoming. |
Thanks @gregsdennis. Now it works in the same way! |
Hello! not sure is this is a bug, if not please feel free to update this issue.
Environment
Nuget Package: JsonLogic
Nuget Version: 3.3.1
OS: macOS
.Net Target: net6.0
Describe the bug
There are some discrepancy between js and .net version in comparison operators.
To Reproduce
i made some testing with https://jsonlogic.com/ and found that JS library allows such code.
comparison of the strings:
{"<" : ["abs", "123"]}
, result: true{">" : ["abs", "123"]}
, result: falseand some silly comparison that always have result: false. i am not good with JS, but probably this is because in following samples it is comparing NaN with number:
{">" : ["abs", 123]}
result: false{"<" : ["abs", 123]}
result: falseBut .Net lib in this cases trows errors.
What you think about add ability to compare strings in to .net version to remove discrepancy?
The text was updated successfully, but these errors were encountered: