I'm trying to validate in a method that is setup to create products in a basic inventory, but numbers representing currency ie, 99 or 99.95 run through check() and Match.test() throw an match fail or return false:
check(_data, {
name: String,
sku: String,
retail: Number,
cost: Number,
qty: Number
});
The mismatch makes sense when the field value is being passed as a string directly from the form field. The problem is that if I parseInt() or parseFloat() the field value and I enter a string like 'asdf' then these two functions discard the value making it look like nothing was entered.
How do I deal with Int and Float validation, including telling the user they have entered an invalid string instead of a number?