Files
integreat/src/cljc/auto_ap/entities/shared.cljc
2018-06-16 18:57:33 -07:00

15 lines
489 B
Clojure

(ns auto-ap.entities.shared
(:require [clojure.spec.alpha :as s]
[clojure.string :as str]))
(def date-regex #"[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}")
(def money-regex #"[0-9]+(\.[0-9]{1,2})?$")
(s/def ::identifier (s/nilable string?))
(s/def ::date (s/and string? #(re-matches date-regex %)))
(s/def ::required-identifier (s/and string?
#(not (str/blank? %))))
(s/def ::money (s/and string?
#(re-matches money-regex %)))