Simplify some functions
This commit is contained in:
parent
d8d0526a05
commit
089c573aed
9
atom.go
9
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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user