revalidate
revalidate copied to clipboard
Add props as extra argument to validators.
This is a proposed WIP change to add props as a third argument to validators. It is a fix for https://github.com/jfairbank/revalidate/issues/17.
This change allows you to depend on the props that redux-form passes along to the validate prop.
e.g.
return createValidator(
message => (value, allValues, props) => {
if (!allValues || value !== allValues[otherField] || props.forceFail) {
return message;
}
},
field => `${field} must match ${otherFieldLabel}`
);
Still TODO:
- Update
createValidatorWithMultipleErrors.js. - Update tests.
Looking for feedback from the project maintainer before continuing work on this.
Codecov Report
Merging #60 into master will not change coverage. The diff coverage is
100%.
@@ Coverage Diff @@
## master #60 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 30 30
Lines 225 225
Branches 62 62
=====================================
Hits 225 225
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/createValidator.js | 100% <100%> (ø) |
:arrow_up: |
| src/internal/internalCombineValidators.js | 100% <100%> (ø) |
:arrow_up: |
| src/internal/createValidatorWithSingleError.js | 100% <100%> (ø) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update fb3917d...c48e51d. Read the comment docs.