Use includes instead of indexOf

This commit is contained in:
Chocobozzz 2018-12-28 16:30:35 +01:00
parent 03535246a4
commit 5dbd259e01
No known key found for this signature in database
GPG key ID: 583A612D890159BE
2 changed files with 2 additions and 5 deletions

View file

@ -92,10 +92,7 @@
}; };
rules = { rules = {
required: value => !!value || 'Required.', required: value => !!value || 'Required.',
email: (value) => { email: (value) => value.includes('@') || 'Invalid e-mail.',
const pattern = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return pattern.test(value) || 'Invalid e-mail.';
},
}; };
user: any; user: any;

View file

@ -123,7 +123,7 @@
rules = { rules = {
password_length: value => value.length > 6 || 'Password must be at least 6 characters long', password_length: value => value.length > 6 || 'Password must be at least 6 characters long',
required: value => !!value || 'Required.', required: value => !!value || 'Required.',
email: (value: string) => value.indexOf('@') !== -1 || 'Invalid e-mail.', email: (value: string) => value.includes('@') || 'Invalid e-mail.',
}; };
resetState() { resetState() {