1
Fork 0

skip falsy fields in validate()

This commit is contained in:
Conduitry 2022-07-23 10:34:11 -04:00
parent 4cc1c0afe9
commit 8040241d6b
1 changed files with 1 additions and 1 deletions

View File

@ -42,4 +42,4 @@ export const field = (validator, chill) => {
return action;
};
export const validate = (...fields) => fields.reduce((valid, field) => field.validate() && valid, true);
export const validate = (...fields) => fields.reduce((valid, field) => (!field || field.validate()) && valid, true);