Skip to content

sefinek/email-validator

Repository files navigation

📨 Email address validator

This lightweight module facilitates precise email address validation, returning a Boolean value of true or false.

🟢 » Node.js

Installation via npm

npm install @sefinek/email-validator

Installation via yarn

yarn add @sefinek/email-validator

Example

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!`);
}

🌍 » Browser

jsdelivr.net

https://cdn.jsdelivr.net/npm/@sefinek/email-validator@1/dist/browser.min.js

Example

<!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>

Demo

https://sefinek.net/npm/email-validator/demo

⭐ » Thank you

If you find this module helpful, please consider giving the repository a star. For any questions or issues, please create a new Issue.

📑 » MIT License

Copyright 2023-2024 © by Sefinek. All Rights Reserved.