1.0.13 • Published 4 years ago

email-butler v1.0.13

Weekly downloads
41
License
MIT
Repository
github
Last release
4 years ago

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("test@gnail.com");
console.log(suggestion.full); // test@gmail.com

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

const suggestionTwo = mySuggest("test@facbook.com");
console.log(suggestionTwo.full); // facebook.com

Validate

import { validate } from "email-butler";

let isValid = validate("test@gnail.com");
console.log(isValid); // true

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

4 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago