View Source WuunderUtils.Presence (Wuunder Utils v0.9.0)

Acts as proxy module towards any? functions of String and Map

Summary

Functions

Checks if value is present

The inverse of any?

Optionally trims data

Types

Functions

@spec any?(t()) :: boolean()

Checks if value is present

Examples

iex> WuunderUtils.Presence.any?(nil)
false

iex> WuunderUtils.Presence.any?(%{})
false

iex> WuunderUtils.Presence.any?(%{value: 1200})
true

iex> WuunderUtils.Presence.any?("")
false

iex> WuunderUtils.Presence.any?("test")
true
@spec empty?(t()) :: boolean()

The inverse of any?

Examples

iex> WuunderUtils.Presence.empty?(nil)
true

iex> WuunderUtils.Presence.empty?(%{})
true

iex> WuunderUtils.Presence.empty?(%{value: 1200})
false

iex> WuunderUtils.Presence.empty?("")
true

iex> WuunderUtils.Presence.empty?("test")
false
@spec trim(any()) :: any()

Optionally trims data

Examples

iex> WuunderUtils.Presence.trim(" test ")
"test"

iex> WuunderUtils.Presence.trim(nil)
nil