Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dimuska139/go-email-normalizer
Golang library for providing a canonical representation of email address.
https://github.com/dimuska139/go-email-normalizer
email go golang normalization
Last synced: 24 days ago
JSON representation
Golang library for providing a canonical representation of email address.
- Host: GitHub
- URL: https://github.com/dimuska139/go-email-normalizer
- Owner: dimuska139
- License: mit
- Created: 2020-08-21T23:13:04.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2024-01-08T08:36:31.000Z (5 months ago)
- Last Synced: 2024-04-17T23:57:14.482Z (about 1 month ago)
- Topics: email, go, golang, normalization
- Language: Go
- Homepage:
- Size: 30.3 KB
- Stars: 60
- Watchers: 1
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Lists
- awesome-go - go-email-normalizer - Golang library for providing a canonical representation of email address. (Email / Search and Analytic Databases)
- awesome-go - go-email-normalizer - Golang library for providing a canonical representation of email address. (Email / Search and Analytic Databases)
- awesome-go-cn - go-email-normalizer
- awesome-go-extra - go-email-normalizer - 08-21T23:13:04Z|2021-09-18T11:31:53Z| (Email / Advanced Console UIs)
- awesome-go - go-email-normalizer - Golang library for providing a canonical representation of email address. (Email / Search and Analytic Databases)
- awesome-go-cn - go-email-normalizer - email-normalizer) (电子邮件 / 检索及分析资料库)
- awesome-go - go-email-normalizer - Golang library for providing a canonical representation of email address. (Email / Search and Analytic Databases)
- awesome-go-projects - go-email-normalizer - Golang library for providing a canonical representation of email address. (Authentication and OAuth)
- awesome-go - go-email-normalizer - Golang library for providing a canonical representation of email address. (Authentication and OAuth)
- go-awesome-cn-star - go-email-normalizer
- awesome-go - go-email-normalizer - Golang library for providing a canonical representation of email address. (Email / Search and Analytic Databases)
- awesome-go-cn - go-email-normalizer - email-normalizer) (电子邮件 / 检索及分析资料库)
- awesome-go-stars - go-email-normalizer(stars: 60) - Golang library for providing a canonical representation of email address. (Email / Search and Analytic Databases)
- awesome-Char - go-email-normalizer - Golang library for providing a canonical representation of email address. (Authentication and OAuth / Contents)
- awesome-go-with-stars - go-email-normalizer - Golang library for providing a canonical representation of email address. (Email / Search and Analytic Databases)
- awesome-go - go-email-normalizer - Golang library for providing a canonical representation of email address. (Authentication and OAuth / Contents)
- repo-1316-awesome-go-cn - go-email-normalizer - email-normalizer) (电子邮件 / 检索及分析资料库)
- repo-1211-awesome-go-cn - go-email-normalizer - email-normalizer) (电子邮件 / 检索及分析资料库)
- Go-awesome - go-email-normalizer - Golang library for providing a canonical representation of email address. (Email / Search and Analytic Databases)
- awesome-go - go-email-normalizer - Golang library for providing a canonical representation of email address. (Email / Search and Analytic Databases)
- awesome-go - go-email-normalizer - Golang library for providing a canonical representation of email address. (Authentication and OAuth / Contents)
- awesome-go-zh - go-email-normalizer - email-normalizer) (电子邮件 / 检索及分析资料库)
- awesome-go - go-email-normalizer - Golang library for providing a canonical representation of email address. (Email / Search and Analytic Databases)
- awesome-go - go-email-normalizer - Golang library for providing a canonical representation of email address. (Email / Search and Analytic Databases)
README
# go-email-normalizer - email normalization for Go
[![Build Status](https://travis-ci.org/dimuska139/go-email-normalizer.svg?branch=master)](https://travis-ci.org/dimuska139/go-email-normalizer)
[![codecov](https://codecov.io/gh/dimuska139/go-email-normalizer/branch/master/graph/badge.svg)](https://codecov.io/gh/dimuska139/go-email-normalizer)
[![Go Report Card](https://goreportcard.com/badge/github.com/dimuska139/go-email-normalizer)](https://goreportcard.com/report/github.com/dimuska139/go-email-normalizer)
[![License](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/dimuska139/go-email-normalizer/blob/master/LICENSE)
[![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go)This is Golang library for providing a canonical representation of email address. It allows
to prevent multiple signups. `go-email-normalizer` contains some popular providers but you can easily append others.## Download
```shell
go get -u github.com/dimuska139/go-email-normalizer/v2
```## Usage
```go
package mainimport (
"fmt"
"strings"
normalizer "github.com/dimuska139/go-email-normalizer/v2"
)type customRule struct {}
func (rule *customRule) ProcessUsername(username string) string {
return strings.Replace(username, "-", "", -1)
}func (rule *customRule) ProcessDomain(domain string) string {
return domain
}func main() {
n := normalizer.NewNormalizer()
fmt.Println(n.Normalize("[email protected]")) // [email protected]
fmt.Println(n.Normalize("[email protected]")) // [email protected]
fmt.Println(n.Normalize("[email protected]")) // [email protected]
fmt.Println(n.Normalize("[email protected]")) // [email protected]
fmt.Println(n.Normalize("[email protected]")) // [email protected]
n.AddRule("customrules.com", &customRule{})
fmt.Println(n.Normalize(" [email protected].")) // [email protected]
}
```## Supported providers
* Apple
* Fastmail
* Microsoft
* Protonmail
* Rackspace
* Rambler
* Yahoo
* Yandex
* ZohoAlso you can integrate other rules using `AddRule` function (see an example above)