Skip to content
This repository has been archived by the owner on Aug 3, 2022. It is now read-only.

Commit

Permalink
fix: get errors from about all validators
Browse files Browse the repository at this point in the history
  • Loading branch information
tkow committed Nov 5, 2018
1 parent 3e4c355 commit f987008
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,15 @@ class ValidationWatcher {
action: A;
}
) => {
return validators.some(validator => {
const invalid = !validator.validate(next, action) && prev !== undefined;
if (invalid) {
this.withError(validator.error);
}
return invalid;
});
return validators
.map(validator => {
const invalid = !validator.validate(next, action) && prev !== undefined;
if (invalid) {
this.withError(validator.error);
}
return invalid;
})
.some(result => result);
};

private _withValidateReducer = <T, Action>(
Expand Down

0 comments on commit f987008

Please # to comment.