Skip to content

Return an institution name corresponding to a supplied email address.

License

Notifications You must be signed in to change notification settings

isle-project/email-to-institution

Repository files navigation

Actions Status Coverage

Email to Institution

Return an institution name corresponding to a supplied email address.

Usage

const emailToInstitution = require( '@isle-project/email-to-institution' );

emailToInstitution( email[, customMap] )

Returns an institution name corresponding to a supplied email address.

const out = emailToInstitution( 'jane.doe@ups.com' );
// returns 'UPS'

If provided an email from a personal email service, the function will return 'Personal'.

const out = emailToInstitution( 'john.doe@hotmail.com' );
// returns 'Personal'

The function accepts an optional custom map of domain names to institution names. Entries in the map take precedence over the default map.

const map = {
    'ups.com': 'United Parcel Service'
};
const out = emailToInstitution( 'jane.doe@ups.com', map );

Examples

const emailToInstitution = require( '@isle-project/email-to-institution' );

let out = emailToInstitution( 'isle@stat.cmu.edu' );
// returns 'Carnegie Mellon University'

out = emailToInstitution( 'jane.doe@gs.com' );
// returns 'Goldman Sachs Group'

out = emailToInstitution( 'admin@kymetis.com' );
// returns 'Kymetis'

out = emailToInstitution( 'anton@hotmail.com' );
// returns 'Personal'

About

Return an institution name corresponding to a supplied email address.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published