1
mirror of https://gitlab.com/commento/commento.git synced 2025-06-29 22:56:37 -04:00

api: standardise strip fn names

This commit is contained in:
Adhityaa Chandrasekar
2018-07-24 12:30:45 +05:30
parent a8ecbd9717
commit c57bc6a39b
11 changed files with 16 additions and 16 deletions

View File

@ -8,7 +8,7 @@ var prePlusMatch = regexp.MustCompile(`([^@\+]*)\+?(.*)@.*`)
var periodsMatch = regexp.MustCompile(`[\.]`)
var postAtMatch = regexp.MustCompile(`[^@]*(@.*)`)
func stripEmail(email string) string {
func emailStrip(email string) string {
postAt := postAtMatch.ReplaceAllString(email, `$1`)
prePlus := prePlusMatch.ReplaceAllString(email, `$1`)
strippedEmail := periodsMatch.ReplaceAllString(prePlus, ``) + postAt
@ -19,7 +19,7 @@ func stripEmail(email string) string {
var https = regexp.MustCompile(`(https?://)`)
var trailingSlash = regexp.MustCompile(`(/*$)`)
func stripDomain(domain string) string {
func domainStrip(domain string) string {
noSlash := trailingSlash.ReplaceAllString(domain, ``)
noProtocol := https.ReplaceAllString(noSlash, ``)
@ -28,7 +28,7 @@ func stripDomain(domain string) string {
var pathMatch = regexp.MustCompile(`(https?://[^/]*)`)
func stripPath(url string) string {
func pathStrip(url string) string {
strippedPath := pathMatch.ReplaceAllString(url, ``)
return strippedPath