summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandomChars <random@chars.jp>2021-10-02 17:39:38 +0900
committerRandomChars <random@chars.jp>2021-10-02 17:39:38 +0900
commit72a329a68c69d2513cbff1ab0ef014e0955a9f5c (patch)
tree59df62a084505d22a481bc9a6a267fcf246f991f
parentfd40f76936ded4a7792530803b243e80d300ab13 (diff)
functions for the methods that shouldn't have been methodsv1.3.2
-rw-r--r--store/misc.go18
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)
+}