Skip to content

Latest commit

 

History

History
62 lines (42 loc) · 1.72 KB

README.md

File metadata and controls

62 lines (42 loc) · 1.72 KB

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'