From 403d01f9462d1cfaa267b995266f6df6afc6b0c6 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Sun, 13 Dec 2015 10:30:56 +0000 Subject: [PATCH] Add exceptions to ```SplitCapitalize``` function like YouTube, GitHub, etc. --- utils/utils.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/utils/utils.go b/utils/utils.go index b41c1356..9fffe802 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -188,9 +188,21 @@ func Run(c *config.Config) { } } +var splitCapitalizeExceptions = map[string]string{ + "youtube": "YouTube", + "github": "GitHub", + "facebook": "Facebook", + "googleplus": "Google Plus", + "linkedin": "LinkedIn", +} + // SplitCapitalize splits a string by its uppercase letters and capitalize the // first letter of the string func SplitCapitalize(name string) string { + if val, ok := splitCapitalizeExceptions[strings.ToLower(name)]; ok { + return val + } + var words []string l := 0 for s := name; s != ""; s = s[l:] {