View Source DoIt.Helper (do_it v0.5.0)

DoIt helper functions.

Link to this section Summary

Functions

Validates if all allowed values are of the same type.

Link to this section Functions

Link to this function

validate_list_type(list, type)

View Source

Validates if all allowed values are of the same type.

examples

Examples

iex> DoIt.Helper.validate_list_type([0, 1, 2, 3], :integer)
true

iex> DoIt.Helper.validate_list_type([0, 1, 2.1, 3], :integer)
false

iex> DoIt.Helper.validate_list_type([0.1, 1.1, 2.1, 3.1], :float)
true

iex> DoIt.Helper.validate_list_type([0.1, 1.1, 2, 3.1], :float)
false

iex> DoIt.Helper.validate_list_type(["warn", "error", "info", "debug"], :string)
true

iex> DoIt.Helper.validate_list_type(["warn", "error", "info", 0], :string)
false

iex> DoIt.Helper.validate_list_type(["warn", "error", "info", "debug"], :unknown)
false