Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;; Email
- (def ^:const
- +email-regex+
- #"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,63}$")
- (s/def ::email
- (s/with-gen
- (s/and string?
- #(re-matches +email-regex+ %))
- (fn []
- (gen/fmap
- (fn [[name host tld]]
- (str name "@" host "." tld))
- (gen/tuple
- (gen/not-empty (gen/string-alphanumeric))
- (gen/not-empty (gen/string-alphanumeric))
- (gen/fmap
- #(apply str %)
- (gen/vector (gen/char-alpha) 2 63)))))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement