Generic utilities for all Elixir terms
Summary
Functions
Evaluates if a value is blank.
Checks if the term is a pure map (i.e. not a struct)
Checks if the term is a struct as well as a map
Evaluates if a value is present.
Functions
Evaluates if a value is blank.
Returns true for nil, false, 0, empty strings, whitespace-only strings,
empty lists, and empty maps.
Examples
iex> blank?(0)
true
iex> blank?(nil)
true
iex> blank?(false)
true
iex> blank?("")
true
iex> blank?(" ")
true
iex> blank?([])
true
iex> blank?(%{})
true
iex> blank?([1])
false
iex> blank?("Hello")
false
Checks if the term is a pure map (i.e. not a struct)
Example
iex> ExUtils.Terms.is_pure_map?(%{a: 1, b: 2})
true
iex> ExUtils.Terms.is_pure_map?(%URI{})
false
Checks if the term is a struct as well as a map
Example
iex> ExUtils.Terms.is_struct?(:atom)
false
iex> ExUtils.Terms.is_struct?(%{a: 1})
false
iex> ExUtils.Terms.is_struct?(%URI{})
true
Evaluates if a value is present.
This is the opposite of blank?/1.
Examples
iex> present?("Hello")
true
iex> present?(nil)
false