Dead simple email validation library made for learning purpose
- Learn how to create a module in Node.js
- Learn how to test your modules using Mocha & Chai
- Learn how to publish a module on npm
- Learn how to use regex
npm install @ppamkcl/email-validator
https://www.npmjs.com/package/@ppamkcl/email-validator
// import the module
const validator = require("@ppamkcl/email-validator");
// Pass an email to validate function from validator
// returns an error if email is invalid
// returns null if email is valid
const error = validator.validate('[email protected]')
if (error) {
console.log(error);
} else {
console.log('Email is valid');
}
Pranjal Alone [email protected]