0.2.1 • Published 4 years ago

normail v0.2.1

Weekly downloads
-
License
ISC
Repository
gitlab
Last release
4 years ago

ci pipeline

normail

Light library that tries to normalize emails

Usage

As a sipmple function

import { mormalize } from 'normail';

const normalized = await normalize('Some.email+extra@gmail.com')
// Output
// NormalizedEmail {
//     original: 'Some.email+extra@gmail.com',
//     normalized: 'someemail@gmail.com',
//     provider: 'google.com',
//     error: undefined
// }

Or you can create a new function that will cache the results

import { createNormalizer } from 'normail';

// create the normalizer only once
const normalize = createNormalizer({
    ttl: 300, // cache the results for 300 seconds
    max: 100  // max entries to keep on cache
})

// used it more times
const normalized = await normalize('Some.email+extra@gmail.com')
// Output as before

Different providers have different rules, for what this library supports you can check the provider rules


Credits

The rules were copied from https://github.com/gmr/email-normalize

0.2.1

4 years ago

0.2.0

4 years ago

0.0.1

4 years ago