-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
29 lines (26 loc) · 888 Bytes
/
index.js
File metadata and controls
29 lines (26 loc) · 888 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
async function getList() {
try {
const response = await fetch('https://audience-boost.minutemediacdn.com/allowlist.json');
const list = await response.json();
return list;
} catch (error) {
console.error('Error fetching or parsing data:', error);
}
return null;
}
const validateEmailDomain = async (email) => {
const list = await getList();
const receivedEmailDomain = email.toLowerCase().split('@')[1];
if (list) {
const isValidDomain = list.emailDomain.includes(receivedEmailDomain);
return isValidDomain;
} return false;
};
const validateCountry = async (userCountry) => {
const list = await getList();
if (list) {
const isValidCountry = list.countries.includes(userCountry);
return isValidCountry;
} return false;
};
module.exports = {validateEmailDomain, validateCountry}