Skip to content

Commit 402d948

Browse files
author
bietkul
committed
Added Email Auto Validator
1 parent 67e056f commit 402d948

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/utils/methods.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ export function getKeyboardType(textType) {
99
return 'numeric';
1010
default:
1111
return 'default';
12-
1312
}
1413
}
1514
export function autoValidate(field) {

src/utils/validators.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export function isEmpty(value) {
2+
return value.trim() === '';
3+
}
4+
export function isEmail(value) {
5+
const emailRegex = /^(([^<>()\[\]\\.,;:\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,}))$/;
6+
return emailRegex.test(value);
7+
}

0 commit comments

Comments
 (0)