From e69c0c3e27005a98dff5c48db2880e5c74cde061 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 16 Apr 2025 09:51:55 +0200 Subject: [PATCH] :sparkles: Make schema uuid parsing fns private --- common/src/app/common/schema.cljc | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/common/src/app/common/schema.cljc b/common/src/app/common/schema.cljc index b6f1a49c48..cb84052d03 100644 --- a/common/src/app/common/schema.cljc +++ b/common/src/app/common/schema.cljc @@ -390,17 +390,16 @@ (register! :merge (mu/-merge)) (register! :union (mu/-union)) -(def uuid-rx - #"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$") - -(defn parse-uuid +(defn- parse-uuid [s] - (try - (uuid/parse s) - (catch #?(:clj Exception :cljs :default) _cause - s))) + (if (str/empty? s) + nil + (try + (uuid/parse s) + (catch #?(:clj Exception :cljs :default) _cause + s)))) -(defn encode-uuid +(defn- encode-uuid [v] (when (uuid? v) (str v)))