Xema.Utils.has_key-question-mark

You're seeing just the function has_key-question-mark, go back to Xema.Utils module for more information.

Specs

has_key?(map() | keyword() | [{String.t(), any()}], any()) :: boolean()

Returns whether the given key exists in the given value.

Returns true if

  • value is a map and contains key as a key.
  • value is a keyword and contains key as a key.
  • value is a list of tuples with keyas the first element.

Example

  iex> alias Xema.Utils
  iex> Utils.has_key?(%{foo: 5}, :foo)
  true
  iex> Utils.has_key?([foo: 5], :foo)
  true
  iex> Utils.has_key?([{"foo", 5}], "foo")
  true