PassiveSupport.Blank protocol (passive_support v0.8.4)

Protocol enabling the functions PassiveSupport.Item.blank?/1, PassiveSupport.Item.present?/1, and PassiveSupport.Item.presence/1.

To ensure those functions behave properly with your own structs, simply define how they implement PassiveSupport.Blank.blank?/1. For instance, the implementation for strings is:

defimpl PassiveSupport.Blank, for: BitString do
  def blank?(<<>>), do: true
  def blank?(""<>string),
    do: String.match?(string, ~r/\A[[:space:]]*\z/u)
end

Link to this section Summary

Link to this section Types

Specs

t() :: term()

Link to this section Functions

Specs

blank?(Item.t()) :: boolean()