I know there's a lot of options to do this, and a lot of opinions too. I don't need something extremely secure, but still I want to be somewhat bullet-proof against wrong data.
What I do right now to check for int
and float
is :
mathFunctions = {
isInt: function (value) {
return ($.isNumeric(value) && value % 1 == 0);
},
isFloat: function (value) {
return ($.isNumeric(value) && value % 1 != 0);
}
};
Is this acceptable or I it's easily broken and I have to change/add more logic to it?