refactor options to be more generic

This commit is contained in:
Aine
2022-08-23 21:58:05 +03:00
parent 9eec8738f9
commit e5e9be528b
8 changed files with 157 additions and 241 deletions

View File

@@ -1,6 +1,9 @@
package utils
import "strings"
import (
"strconv"
"strings"
)
// Mailbox returns mailbox part from email address
func Mailbox(email string) string {
@@ -25,3 +28,8 @@ func Bool(str string) bool {
return (str == "1" || str == "true" || str == "yes")
}
// SanitizeBoolString converts string to boolean and back to string
func SanitizeBoolString(str string) string {
return strconv.FormatBool(Bool(str))
}