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:
parent
cf905d77b1
commit
2fd5760aeb
1 changed files with 10 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue