Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const checkIfDisposableEmail = (email: string) => {
let isDisposable = false;
joiValidate(
{
email: Joi.string()
.email()
.required()
},
{ email }
);
const domain = email.split("@")[1];
if (disposableDomains.includes(domain)) throw new Error(DISPOSABLE_EMAIL);
const potentialMatches = wildcardDomains.filter(w => domain.includes(w));
potentialMatches.forEach(
d => (isDisposable = isDisposable || isMatch(email, `*.${d}`))
);
if (isDisposable) throw new Error(DISPOSABLE_EMAIL);
return;
};
export const checkIfDisposableEmail = (email: string) => {
let isDisposable = false;
joiValidate(
{
email: Joi.string()
.email()
.required()
},
{ email }
);
const domain = email.split("@")[1];
if (disposableDomains.includes(domain)) throw new Error(DISPOSABLE_EMAIL);
const potentialMatches = wildcardDomains.filter(w => domain.includes(w));
potentialMatches.forEach(
d => (isDisposable = isDisposable || isMatch(email, `*.${d}`))
);
if (isDisposable) throw new Error(DISPOSABLE_EMAIL);
return;
};