further separates contexts within Form for performance reasons

This commit is contained in:
James
2020-07-07 21:41:34 -04:00
parent 0930063219
commit ac5caf4da2
21 changed files with 156 additions and 144 deletions

View File

@@ -4,7 +4,7 @@ const optionsToValidatorMap = {
number: (value, options = {}) => {
const parsedValue = parseInt(value, 10);
if (value && (typeof parsedValue !== 'number' || Number.isNaN(parsedValue))) {
if ((value && typeof parsedValue !== 'number') || (options.required && Number.isNaN(parsedValue))) {
return 'Please enter a valid number.';
}