diff options
-rw-r--r-- | store/misc.go | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/store/misc.go b/store/misc.go index b72fa66..dd6ee40 100644 --- a/store/misc.go +++ b/store/misc.go @@ -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) +} |