-
Notifications
You must be signed in to change notification settings - Fork 93
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
Integer filter accepts non-numeric strings. #83
Comments
@bobjflong This would work for you I guess? #89 |
@jkogara looks like it! |
I've added a failing test case to demonstrate this issue. The root cause of the problem is here, where we perform a
This can lead to some unexpected behaviour, as the failing test demonstrates. I think that while #89 allows us to bypass that step if we pass a
rather than running the string through a regex and then a |
I like the idea of a strict by default integer filter, especially if it prevents strings like |
This implements the solution discussed in cypriss#83 (comment)
#99 now has a failing test and includes the proposed solution above. This is a breaking change so we could hold it for |
Hello from 2019! I understand this is an old thread but just curious whether there was any traction on this issue. IOW, did we add a |
This implements the solution discussed in cypriss#83 (comment)
Hi @abhitrivedi, I've refreshed #99 to bring it up to date. I agree with @patrickod that rather than adding a It's surprising that strings like How would you feel about bumping mutations to 1.0 and enforcing strict number parsing? I'm happy to help :-D (failing that we could introduce a |
ping: @cypriss @eugeneius |
Since this is still a zero major version gem, the public API doesn't need to be backward compatible. I suggest we keep the zero major version until the authors decide that the api is stable enough. |
Eg. '123foo' gets converted to 123, due to the use of
to_i
. I think that it would be preferable for the integer filter to do something like:Let me know what you think, I can cut a PR if you want.
The text was updated successfully, but these errors were encountered: