email-valid-simple
v0.0.2
Published
email validation
Downloads
2
Maintainers
Readme
email-valid-simple
package to perform validation on email addresses.
Installation
npm install email-valid-simple
Usage
Single email validation with validate()
simply pass the validate
function an email string.
const email = require('email-valid-simple');
const result = email.validate('fö[email protected]');
console.log(result) // output: true
The validate
function will return a boolean result.
valid email format = true
invalid email format = false
const result = email.validate('@domain.com');
console.log(result) // output: false
Bulk validation with validateAll()
perform bulk validation on an array of emails.
The validateAll
function will return an object containing two arrays, valid and invalid.
const emailArr = ['fö[email protected]', '@domain.com'];
const result = email.validateAll(emailArr);
console.log(result);
output:
{
valid: [ 'fö[email protected]' ],
invalid: [ '@domain.com' ]
}
Tests
npm run test