View Source DoIt.Helper (do_it v0.6.1)

DoIt helper functions.

Summary

Functions

Validates if all allowed values are of the same type.

Functions

Link to this function

validate_list_type(list, type)

View Source

Validates if all allowed values are of the same type.

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