0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-13 08:11:30 -05:00

Add email and string validators to schema ns.

This commit is contained in:
Andrey Antukh 2016-02-24 17:20:43 +02:00
parent cf905d77b1
commit 2fd5760aeb

View file

@ -47,10 +47,20 @@
[v]
(fn? v))
(def ^:const +email-re+
#"^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$")
(v/defvalidator email
"Validate if `v` is a valid email."
{:default-message-format "% must be a valid email."}
[v]
(clojure.core/boolean (re-seq +email-re+ v)))
(def required v/required)
(def number v/number)
(def integer v/integer)
(def boolean v/boolean)
(def string v/string)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Public Api