func v0.4.1 Func.Presence

Summary

Functions

The opposite of present?

Checks the value is empty

The opposite of empty?

It returns the itself when the value is present, or returns nil

Checks the value is present

Functions

blank?(val)

The opposite of present?

iex> Func.Presence.blank?(nil)
true
iex> Func.Presence.blank?(false)
true
iex> Func.Presence.blank?("")
true
iex> Func.Presence.blank?(%{})
true
iex> Func.Presence.blank?([])
true
iex> Func.Presence.blank?(1)
false
empty?(val)
empty?(any) :: boolean

Checks the value is empty.

iex> Func.Presence.empty?([])
true
iex> Func.Presence.empty?(%{})
true
iex> Func.Presence.empty?("")
true
iex> Func.Presence.empty?(1)
false
non_empty?(val)
non_empty?(any) :: boolean

The opposite of empty?

iex> Func.Presence.non_empty?([])
false
iex> Func.Presence.non_empty?(%{})
false
iex> Func.Presence.non_empty?("")
false
iex> Func.Presence.non_empty?(1)
true
presence(val)

It returns the itself when the value is present, or returns nil.

iex> Func.Presence.presence(nil)
nil
iex> Func.Presence.presence(false)
nil
iex> Func.Presence.presence("")
nil
iex> Func.Presence.presence(%{})
nil
iex> Func.Presence.presence([])
nil
iex> Func.Presence.presence(1)
1
present?(val)
present?(any) :: boolean
present?(any) :: boolean

Checks the value is present.

iex> Func.Presence.present?(nil)
false
iex> Func.Presence.present?(false)
false
iex> Func.Presence.present?("")
false
iex> Func.Presence.present?(%{})
false
iex> Func.Presence.present?([])
false
iex> Func.Presence.present?(1)
true