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( '[email protected]' );
// returns 'UPS'

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

const out = emailToInstitution( '[email protected]' );
// 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( '[email protected]', map );

Examples

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

let out = emailToInstitution( '[email protected]' );
// returns 'Carnegie Mellon University'

out = emailToInstitution( '[email protected]' );
// returns 'Goldman Sachs Group'

out = emailToInstitution( '[email protected]' );
// returns 'Kymetis'

out = emailToInstitution( '[email protected]' );
// 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