Skip to content
Snippets Groups Projects
Commit 72a329a6 authored by Ophestra's avatar Ophestra
Browse files

functions for the methods that shouldn't have been methods

parent fd40f769
No related branches found
Tags v1.3.2
No related merge requests found
......@@ -19,15 +19,25 @@ var (
AlreadyExists = errors.New("store path already exists")
)
// These two really shouldn't be methods... Maybe change that for v2.
// MatchName determines if str is a valid name.
func (s *Store) MatchName(str string) bool {
func MatchName(str string) bool {
return nameRegex.MatchString(str)
}
// MatchURL determines if str is a valid URL.
func (s *Store) MatchURL(str string) bool {
func MatchURL(str string) bool {
u, err := url.Parse(str)
return err == nil && u.Scheme != "" && u.Host != ""
}
// These two really shouldn't be methods... Maybe change that for v2.
// MatchName determines if str is a valid name. As of v1, this just calls MatchName.
func (s *Store) MatchName(str string) bool {
return MatchName(str)
}
// MatchURL determines if str is a valid URL. As of v1, this just calls MatchURL.
func (s *Store) MatchURL(str string) bool {
return MatchURL(str)
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment