From d6f96c246da08517f098d9cfa54ac825a9a5b259 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 22 Sep 2016 22:33:04 +0300 Subject: [PATCH] Add `uuid-str?` predicate. --- src/uxbox/util/data.cljs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/uxbox/util/data.cljs b/src/uxbox/util/data.cljs index 5de55e0ce6..5cb81915c9 100644 --- a/src/uxbox/util/data.cljs +++ b/src/uxbox/util/data.cljs @@ -80,6 +80,16 @@ (disj s v) (conj s v))) +;; --- String utils + +(def +uuid-re+ + #"^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$") + +(defn uuid-str? + [v] + (and (string? v) + (re-seq +uuid-re+ v))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Numbers Parsing ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;