Validate v1.2.1 Validate.Util

Utilities to help with validation

Link to this section Summary

Functions

Turns an array of %Validate.Validator.Error{} structs into a keyed map of errors

Link to this section Functions

Link to this function

errors_to_map(errors)

Turns an array of %Validate.Validator.Error{} structs into a keyed map of errors

Examples

iex> {:error, errors} = Validate.validate(%{"name" => ""}, %{"name" => [required: true]})
iex> %{"name" => ["is required"]} == Validate.Util.errors_to_map(errors)