Skip to content

demarches-simplifiees/email-butler

 
 

Repository files navigation

Email Butler

Install

npm install -save email-butler

API

Suggest

Suggest email if domain closly matches popular email domains. If no suggestion, returns undefined. Otherwise returns { address, domain, full }, where address is everything before @, domain is everything after, and full is the full suggestion. Method accepts an email and an option object, which overrides the default values to compare the email to. The different options are:

  • domains: string[], matches email to this list of emails (gmail.com)
  • topLevelDomains: string[], matches top level domains to this list of top level domains (com)
  • secondLevelDomains: string[], matches domains to this list of domains (gmail)
import { suggest } from "email-butler";

const suggestion = suggest("[email protected]");
console.log(suggestion.full); // [email protected]

const mySuggest = (email: string) => suggest(email, { domains: ["facebook.com"] });
const suggestionOne = mySuggest("[email protected]");
console.log(suggestionOne.full); // undefined

const suggestionTwo = mySuggest("[email protected]");
console.log(suggestionTwo.full); // facebook.com

Validate

import { validate } from "email-butler";

let isValid = validate("[email protected]");
console.log(isValid); // true

isValid = validate("test$gnail.com");
console.log(isValid); // false

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 100.0%