crux_structs v0.1.0 Crux.Structs.Util View Source

Collection of util functions.

Link to this section Summary

Functions

Atomifies all keys in a passed list or map to avoid the mess of mixed string and atom keys the gateway sends

Converts a string, likely Discord snowflake, to an integer

Converts a list of raw api data to structs keyed under the passed key

Converts a string to an atom

Link to this section Functions

Link to this function atomify(input) View Source
atomify(input :: map() | list()) :: map() | list()

Atomifies all keys in a passed list or map to avoid the mess of mixed string and atom keys the gateway sends.

Link to this function id_to_int(str) View Source
id_to_int(id :: String.t() | integer() | nil) :: integer() | nil | no_return()

Converts a string, likely Discord snowflake, to an integer

Link to this function raw_data_to_map(data, target, key \\ :id) View Source
raw_data_to_map(data :: list(), target :: module(), key :: atom()) :: map()

Converts a list of raw api data to structs keyed under the passed key.

Link to this function string_to_atom(string) View Source
string_to_atom(string :: String.t() | atom()) :: atom()

Converts a string to an atom.

Returns an already converted atom as is instead of raising