Mate.Utils (Mate v0.1.5) View Source

This module contains some small helper utilities.

Link to this section Summary

Functions

Returns a boolean to determine if the given value is empty.

Returns the namespace Module name from the current Mix Project.

Returns the sanitized module name as a string.

Returns the otp app from the current Mix Project.

Returns a random id of any given length

Link to this section Functions

Specs

empty?(input :: nil | String.t() | list()) :: boolean()

Returns a boolean to determine if the given value is empty.

Examples: iex> Mate.Utils.empty?("") true

iex> Mate.Utils.empty?([]) true

iex> Mate.Utils.empty?(nil) true

iex> Mate.Utils.empty?("Hello") false

iex> Mate.Utils.empty?([1,2,3]) false

Specs

module() :: String.t()

Returns the namespace Module name from the current Mix Project.

Example:

iex> Mate.Utils.module()
"Mate"

Specs

module_name(module :: map() | atom() | String.t()) :: String.t()

Returns the sanitized module name as a string.

Example:

iex> Mate.Utils.module_name(Mate)
"Mate"

iex> Mate.Utils.module_name(%Mate.Pipeline{})
"Mate.Pipeline"

iex> Mate.Utils.module_name("Elixir.Mate")
"Mate"

Specs

otp_app() :: atom()

Returns the otp app from the current Mix Project.

Example:

iex> Mate.Utils.otp_app()
:mate

Specs

random_id(length :: integer()) :: String.t()

Returns a random id of any given length

Examples: iex> Mate.Utils.random_id() "3T440PTEM1IFD64I9R8MU2L2TIAGSF1TRQDH394HCUS5IRJHCGL0"

iex> Mate.Utils.random_id(6) "HGEE0AFSH0"