Skip to content
This repository was archived by the owner on Apr 9, 2025. It is now read-only.

Commit d201670

Browse files
author
Daniel Requejo
committed
⁑ Align names and cleanup README
1 parent 17d521b commit d201670

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ The easy way of handling your vue forms
66
</div>
77

88
[![Build Status](https://github.com/mattphillips/deep-object-diff/actions/workflows/ci.yaml/badge.svg)](https://github.com/dbssman/vue-form-handler/actions/workflows/node.js.yml)
9-
[![version](https://img.shields.io/npm/v/deep-object-diff.svg?style=flat-square)](https://www.npmjs.com/package/deep-object-diff)
10-
[![downloads](https://img.shields.io/npm/dm/deep-object-diff.svg?style=flat-square)](http://npm-stat.com/charts.html?package=deep-object-diff&from=2016-11-23)
9+
[![version](https://img.shields.io/npm/v/deep-object-diff.svg?style=flat-square)](https://www.npmjs.com/package/vue-form-handler)
10+
[![downloads](https://img.shields.io/npm/dm/deep-object-diff.svg?style=flat-square)](http://npm-stat.com/charts.html?package=vue-form-handler&from=2023-01-20)
1111
[![MIT License](https://img.shields.io/npm/l/deep-object-diff.svg?style=flat-square)](https://github.com/dbssman/vue-form-handler/blob/master/License.md)
1212
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
1313

docs/tutorial.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ We can also pass a validation function and specify `validationMode: 'onSubmit'`
193193
<input type="password" v-bind="register('confirmPassword', {
194194
required: true,
195195
pattern: passwordRegExp,
196-
validations: {
196+
validate: {
197197
match: (value) => value === values.password || 'Passwords do not match'
198198
}
199199
})" />
@@ -244,7 +244,7 @@ If the submission fails it will call the error function we pass with the errors
244244
<input type="password" v-bind="register('confirmPassword', {
245245
required: true,
246246
pattern: passwordRegExp,
247-
validations: {
247+
validate: {
248248
match: (value) => value === values.password || 'Passwords do not match'
249249
}
250250
})" />

src/test/register.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ describe('Register function testing', () => {
4848
it('Registered validations work on update via handler', async () => {
4949
const { values, register, formState } = useFormHandler();
5050
const field = register('field', {
51-
validations: {
51+
validate: {
5252
error: (val) => val !== 'error' || 'Error with your field'
5353
}
5454
})
@@ -61,7 +61,7 @@ describe('Register function testing', () => {
6161
it('Registered validations work on update via setter', async () => {
6262
const { values, register, formState, setValue, triggerValidation } = useFormHandler();
6363
register('field', {
64-
validations: {
64+
validate: {
6565
error: (val) => val !== 'error' || 'Error with your field'
6666
}
6767
})

src/types/register.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ export interface RegisterOptions extends ValidationsConfiguration {
1818
/** Default value for the field */
1919
defaultValue?: any
2020

21-
/** Validations for the field */
22-
validations?: Validations
21+
/** Custom validations for the field */
22+
validate?: Validations
2323

2424
/** Set to true if you want to bind also dirty and touched states */
2525
withDetails?: boolean

src/useFormHandler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const useFormHandler: FormHandler = ({
5454
_validations: {
5555
...(!options.useNativeValidation
5656
&& transformValidations(options as ValidationsConfiguration)),
57-
...(options.validations || {})
57+
...(options.validate || {})
5858
},
5959
_defaultValue: options.defaultValue,
6060
_disabled: !!options.disabled,
@@ -218,7 +218,7 @@ const useFormHandler: FormHandler = ({
218218

219219
const register: Register = (name, options = {}) => {
220220
const {
221-
validations,
221+
validate,
222222
defaultValue,
223223
disabled,
224224
withDetails,

0 commit comments

Comments
 (0)