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 = {
required: value => !!value || 'Required.',
email: (value) => {
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.';
},
email: (value) => value.includes('@') || 'Invalid e-mail.',
};
user: any;

View File

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