Funx.Validator.NotBlank (funx v0.8.7)
View SourceValidates that a string is not blank (has content after trimming whitespace).
Optional Options
:message- Custom error message callback(value -> String.t())
Examples
iex> Funx.Validator.NotBlank.validate("hello")
%Funx.Monad.Either.Right{right: "hello"}
iex> Funx.Validator.NotBlank.validate(" hello ")
%Funx.Monad.Either.Right{right: " hello "}
iex> Funx.Validator.NotBlank.validate("")
%Funx.Monad.Either.Left{left: %Funx.Errors.ValidationError{errors: ["must not be blank"]}}
iex> Funx.Validator.NotBlank.validate(" ")
%Funx.Monad.Either.Left{left: %Funx.Errors.ValidationError{errors: ["must not be blank"]}}
iex> Funx.Validator.NotBlank.validate(42)
%Funx.Monad.Either.Left{left: %Funx.Errors.ValidationError{errors: ["must not be blank"]}}