KineticEcto (KineticEcto v1.2.0)
View SourceDocumentation for KineticEcto.
Summary
Functions
Returns true if the value would be considered empty.
| value type | result |
|---|---|
nil | true |
| binary | String.trim_leading(value) == "" |
| list | value == [] |
| tuple | tuple_size(value) == 0 |
| map | map_size(value) == 0 |
| Enumerable | Enum.empty?(value) |
| anything else | false |
nilis empty- non-struct maps are empty if
map_size/1is0 - lists are empty if they equal
[] - strings are empty if, when trimmed of leading spaces, they are equal to an
empty string (
"") - values implementing the
Enumerableprotocol are empty ifEnum.empty?/1returnstrue - all other values are not empty
Examples
iex> KineticEcto.empty?(nil)
true
iex> KineticEcto.empty?("")
true
iex> KineticEcto.empty?([])
true
iex> KineticEcto.empty?(" ")
true
iex> KineticEcto.empty?(" xyz ")
false
iex> KineticEcto.empty?(MapSet.new([]))
true
iex> KineticEcto.empty?([1])
false
iex> KineticEcto.empty?(1..1//1)
false
iex> KineticEcto.empty?(%{})
true
iex> KineticEcto.empty?(%{a: 1})
false
iex> KineticEcto.empty?({})
true
iex> KineticEcto.empty?({1})
false
Returns true if the value would not be considered empty. See empty?/1 for
details.
Examples
iex> KineticEcto.present?(nil)
false
iex> KineticEcto.present?("")
false
iex> KineticEcto.present?([])
false
iex> KineticEcto.present?(" ")
false
iex> KineticEcto.present?(" xyz ")
true
iex> KineticEcto.present?(MapSet.new([]))
false
iex> KineticEcto.present?([1])
true
iex> KineticEcto.present?(1..1//1)
true
iex> KineticEcto.present?(%{})
false
iex> KineticEcto.present?(%{a: 1})
true
iex> KineticEcto.present?({})
false
iex> KineticEcto.present?({1})
true