Closed kwladyka closed 8 years ago
It's just convenient. Sometimes you'll want just the map of errors to, say, pass around to the client. Or you might want to pass the original map plus the errors, in which case you'd use the second element of the vector.
In the case where the validation is successful all you need to do is check that the first element is nil:
[nil {:age 32}]
That's exactly what the valid?
function does.
What is the point of repeating exactly the same data?
[{:age ("age must be present")} {:bouncer.core/errors {:age ("age must be present")}, :age nil}]
Like in this example
{:age ("age must be present")}.