-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
36 lines (32 loc) · 925 Bytes
/
Copy pathindex.js
File metadata and controls
36 lines (32 loc) · 925 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*!
* email validator
* Copyright(c) 2018 Supardyke
* ISC Licensed
*/
'use strict';
exports.check_email = check_email; // to send back to module user
let email; // name of variable
let email_status = false; // status to return true false
const valid_providers = ['gmail.com','yahoo.com','rocketmail.com','yahoo.co.uk']; // name of variable
function check_email(email){
let email_check = email.search('@');
if (email_check>0) {
let diff_providers = valid_providers.slice(',');
let email_provider = email.split('@');
email_provider = email_provider[1];
if (email_provider !== null) {
for(let a = 0;a < diff_providers.length;a++){
if (diff_providers[a] == email_provider) {
email_status = true;
};
}
if (email_status == false) {
let domain_check = email_provider.search('.com');
if (domain_check >0) {
email_status = true;
};
};
}
};
return email_status;
}