 (ns spec-tools.core
-  (:refer-clojure :exclude [integer? int? double? keyword? boolean? uuid? inst?])
-  (:require [clojure.spec :as s]
+  (:refer-clojure :exclude [string? integer? int? double? keyword? boolean? uuid? inst?])
+  (:require
+    [clojure.spec :as s]
     #?@(:cljs [goog.date.UtcDateTime]))
   #?(:clj
      (:import [java.util Date UUID])))

        ::s/invalid))))

(defn -string->double [x]
  (if (string? x)
    (try
      #?(:clj  (Double/parseDouble x)
         :cljs (js/parseFloat x))

        ::s/invalid))))

(defn -string->keyword [x]
  (if (clojure.core/string? x)
    (keyword x)))

(defn -string->boolean [x]
  (if (clojure.core/string? x)
    (cond
      (= "true" x) true
      (= "false" x) false
      :else ::s/invalid)))

(defn -string->uuid [x]
  (if (clojure.core/string? x)
    (try
      #?(:clj  (UUID/fromString x)
         :cljs (uuid x))
