diff --git a/atom.go b/atom.go index 8158efb..79ddffb 100644 --- a/atom.go +++ b/atom.go @@ -90,11 +90,7 @@ func isValidMediaType(m string) bool { } typeParts := strings.Split(mediaType, "/") - if len(typeParts) != 2 || typeParts[0] == "" || typeParts[1] == "" { - return false - } - - return true + return len(typeParts) == 2 && typeParts[0] != "" && typeParts[1] != "" } // isValidLanguageTag checks whether a LanguageTag is valid. It returns a bool. @@ -105,8 +101,7 @@ func isValidLanguageTag(languageTag string) bool { // isValidAttribute checks whether an Attribute is valid. It returns a bool. func isValidAttribute(attribute string) bool { - regex := regexp.MustCompile(`^[a-zA-Z0-9_]+="[^"]*"$`) - return regex.MatchString(attribute) + return regexp.MustCompile(`^[a-zA-Z0-9_]+="[^"]*"$`).MatchString(attribute) } // NewURN generates an new valid IRI based on a UUID. It returns an IRI.