-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
driver / form / validator #221
Labels
Comments
or const loginValues = form('login').get()
const loginValues = form('login').get.validate()
const name = form('login').get.validate('name') // feel odd |
I think we can pass the validator on second function props .
|
with middleware support // test inputs (required/pattern)
const loginValues = form('login').get()
// test input "name" (required/pattern)
const name = form('login').get('name')
// test inputs (required/pattern + validator)
// - doesn't call the internal validator
const loginValues = form('login').get((values, next) => {
if (values.name.length > 10) return true
return { name: 'wrong_length' }
})
// - call the internal validator
const loginValues = form('login').get((values, next) => {
if (values.name.length > 10) return [{ name: 'wrong_length' }, ...next(values)]
return true
})
// test input "name" (required/pattern + validator)
const name = form('login').get('name', value => {
if (value.length > 10) return true
return 'wrong_length'
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
metadata
storeget
(as a callback)required
andpattern
required
andpattern
get should returns
undefined
if tests failed, anderrors
store is filled with errorsto set metadata:
The text was updated successfully, but these errors were encountered: