rename auto to field

This commit is contained in:
cupcakearmy
2019-10-19 08:45:14 +02:00
parent 0cf1b6e73b
commit 5d6a420283
8 changed files with 249 additions and 256 deletions

View File

@@ -88,10 +88,10 @@ export const useForm = <T, U extends { [key in keyof T]: useFormValidatorParamet
_validate(key, extracted)
}
const auto = (key: keyof T, opts: useFormOptions = {}) => ({
const field = (key: keyof T, opts: useFormOptions = {}) => ({
[opts.getter || options.getter || 'onChange']: update(key, opts.extractor),
[opts.setter || options.setter || 'value']: form[key] as any,
})
return { form, update, auto, errors, isValid }
return { form, update, field, errors, isValid }
}