0.0.8 • Published 5 years ago

vanitizer v0.0.8

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

Vanity URL generator from email

Vanity urls are a way to segment your users in your web application, usually by organization or community, for the purposes of allowing group discovery and personalization.

These generally work utilizing wildcard records allowing organization names to be placed before the websites fully qualified domain name. These generally follow the format:

{testing}.mydomain.com

for example:

  • coke.koan.co
  • newrelic.koan.co

Vanitizer is a simple library of tools to support the creation of organization style vanity urls based on email address. Vaniztizer also has some small support for organization detection for Google App's SSO.

Install

vanitizer is available using npm:

npm install --save vanitizer

Usage

const {
  isGoogleEmail,
  isDisposableEmail,
  isFreeEmail,
  isWorkEmail,
  getDomains,
} = require('vanitizer');

// Returns domains based on email
const opts = {
 logger, // uses DEBUG lib by defaul
 wordWhitelist, // json object format: ({ "candidate_name": true })
 wordBlacklist, // json object format: ({ "candidate_name2": true })
 domainBlacklist, // json object format: ({ "candidate.com": true })
 domainWhitelist, // json object format: ({ "candidate2.com": true })
}; // can be undefined

getDomains(opts)('asdf@koan.co'); // returns { domains: [ 'koan', 'koan-co' ], status: true, err: null }
getDomains(opts)('asdf@product.koan.co'); // { domains: [ 'koan', 'koan-co' ], status: true, err: null }
getDomains('asdf@koan.co.uk'); // returns { domains: [ 'koan', 'koan-co-uk' ], status: true, err: null }
getDomains('koan.co'); //

// Is a work email address
isWorkEmail('asdf@koan.co'); // returns { status: true, error: null }
isWorkEmail('asdf@gmail.com'); // returns { status: false, error: null }
isWorkEmail('asdf@koan'); // returns { status: false, error: 'invalid_email' }

// Is a free email address
isFreeEmail('asdf@koan.co'); // returns { status: false, error: null }
isFreeEmail('asdf@gmail.com'); // returns { status: true, error: null }

// Is a disposable email address
isDisposableEmail('asdf@koan.co'); // returns { status: false, error: null }
isDisposableEmail('asdf@mailinator.com'); // returns { status: true, error: null }

// Is a ISP provided email address
isIspEmail('asdf@comcast.net'); // returns { status: true, error: null }
isIspEmail('asdf@comcast.com'); // returns { status: false, error: null }

// Is a google email address
isGoogleEmail('asdf@koan.co'); // returns { status: true, error: null }
isGoogleEmail('asdf@gmail.com'); // returns { status: true, error: null }

Credits & Content

0.0.8

5 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago