Skip to content

Commit

Permalink
feat: added context information to validation functions
Browse files Browse the repository at this point in the history
  • Loading branch information
logaretm committed Nov 4, 2020
1 parent a048c90 commit 7e6675d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/vee-validate/src/validate.ts
Expand Up @@ -57,7 +57,10 @@ async function _validate(field: FieldValidationContext, value: any) {

// if a generic function, use it as the pipeline.
if (isCallable(field.rules)) {
const result = await field.rules(value);
const result = await field.rules(value, {
field: field.name,
form: field.formData,
});
const isValid = typeof result !== 'string' && result;
const message =
typeof result === 'string'
Expand Down

0 comments on commit 7e6675d

Please sign in to comment.