Middlewares and some string util functions refactored. Added partial Documentation.
This commit is contained in:
19
internal/strings.go
Normal file
19
internal/strings.go
Normal file
@ -0,0 +1,19 @@
|
||||
package internal
|
||||
|
||||
// PreferFirst returns first non-empty string
|
||||
func PreferFirst(first string, second string) string {
|
||||
if first != "" {
|
||||
return first
|
||||
}
|
||||
return second
|
||||
}
|
||||
|
||||
// Contains checks whether []string Contains string
|
||||
func Contains(s []string, e string) bool {
|
||||
for _, a := range s {
|
||||
if a == e {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
Reference in New Issue
Block a user