Closed fran-worley closed 8 years ago
Thanks for reporting this and offering help with implementation. number?
won't need dry-types here, so it's only a matter of adding a new predicate. I'm wondering how to do it. In coercible we have crazy regexps for figuring out if a string represents a number, I guess we could just copy/paste those, but maybe there's a better (read: faster) way :)
Anyhow, a PR would be awesome, my time is very limited.
It would be useful if we could add some new predicates to the base set. I have some time at the end of this week so can raise a PR, though I will leave
number?
to you as I know you have plans and it's likely to involve something with dry-types...number? Useful when you aren't bothered what kind of number something is, just that it is a number (a bit like active records
numericality
validator).odd? & even? These options are built into active record validations and it doesn't seem unreasonable to include in base predicates.
We could probably make use of the ruby methods for
.odd?
and.even?
.