in Chapter 7 there’s the following def mapping keywords to a vector of error messages and error checking functions:
(def order-details-validations
{:name
["Please enter a name" not-empty]
:email
["Please enter an email address" not-empty
"Your email address doesn't look like an email address"
#(or (empty? %) (re-seq #"@" %))]})
Is there a reason that for :email
we check the whether the string is empty twice, by calling not-empty
as the validation function for the first error message and empty?
as part of the validation function for the second error message?