Funx.Validator.Negative (funx v0.8.0)

View Source

Validates that a number is strictly negative (< 0).

Optional Options

  • :message - Custom error message callback (value -> String.t())

Examples

iex> Funx.Validator.Negative.validate(-5)
%Funx.Monad.Either.Right{right: -5}

iex> Funx.Validator.Negative.validate(0)
%Funx.Monad.Either.Left{left: %Funx.Errors.ValidationError{errors: ["must be negative"]}}

iex> Funx.Validator.Negative.validate(5)
%Funx.Monad.Either.Left{left: %Funx.Errors.ValidationError{errors: ["must be negative"]}}

Summary

Functions

validate(value)

validate(value, opts)