This lightweight module facilitates precise email address validation, returning a Boolean
value of true
or false
.
npm install @sefinek/email-validator
yarn add @sefinek/email-validator
const emailValidator = require('@sefinek/email-validator');
const testEmail = 'contact@sefinek.net';
if (emailValidator.test(testEmail)) {
console.log(`Email ${testEmail} is valid.`);
} else {
console.log(`Email ${testEmail} is NOT valid!`);
}
https://cdn.jsdelivr.net/npm/@sefinek/email-validator@1/dist/browser.min.js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>email-validator</title>
</head>
<body>
<h1>email-validator</h1>
<script src="https://cdn.jsdelivr.net/npm/@sefinek/email-validator@1/dist/browser.min.js"></script>
<script>
const email = 'contact@sefinek.net';
if (emailValidator.test(email)) {
console.log(`✔️ Email ${email} is valid.`);
} else {
console.log(`❎ Email ${email} is NOT valid!`);
}
</script>
</body>
</html>
If you find this module helpful, please consider giving the repository a star. For any questions or issues, please create a new Issue.
Copyright 2023-2024 © by Sefinek. All Rights Reserved.