Open kiaking opened 1 month ago
What do you mean by no decimals? Number.isInteger
will still recognise e.g. 1.0 (but not 1.1, etc) as a valid integer.
Isn't this essentially positiveInteger
?
That said, positiveInteger
and negativeInteger
are identical. Not sure if this was a heuristic choice...
Ah yeah we had positiveInteger... 🤔
What do you mean by no decimals? Number.isInteger will still recognise e.g. 1.0 (but not 1.1, etc) as a valid integer.
Good point. I think we can accept 1.0
. This rule should verify that the value can be treated as integer. In our case, in Go for example.
func main() {
var n int
n = 1
n = 1.0 // This works
n = 1.1 // This is not
fmt.Printf("%d", n)
}
Add validation rule to validate the given number is integer (no decimals). Vuelidate has this built in validator, but I guess it would be easy to implement our own with
Number.isInteger(v)
.