-
Notifications
You must be signed in to change notification settings - Fork 55
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
Validate array of object #16
Comments
const validateRules = {
firstname: { minlength: 2, maxlength: 15, required: true },
lastname: { minlength: 3, maxlength: 7, required: true },
email: { email: true, required: true },
password: { password: true, required: true },
phone: { minlength: 10, numbers: true, required: true},
rulesChecked: {true: true}
}
inputValidation = (fields) => {
const array = (typeof fields === 'string') ? [fields] : fields
array.map(field => {
this.validate({
[field]: validateRules[field]
})
})
}
and call like:
inputValidation(['input1', input2])
or
inputValidation('input1') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi this validation library is so easy to use, thank you for your effort.
Now I am looking for example of validation for array of object, but not found.
How to use this validation to validate array of object?
For example I have data array of users, how to validate it?
Thank you.
The text was updated successfully, but these errors were encountered: