stripity_stripe v2.0.0-alpha.1 Stripe.Util

Summary

Types

stripe_response()
stripe_response :: %{optional(String.t) => any}

Functions

drop_nil_keys(map)
get_date(m, k)
get_date(map, atom | String.t) :: DateTime.t | nil
map_keys_to_atoms(m)

Performs a root-level conversion of map keys from strings to atoms.

This function performs the transformation safely using String.to_existing_atom/1, but this has a possibility to raise if there is not a corresponding atom.

It is recommended that you pre-filter maps for known values before calling this function.

Examples

iex> map = %{ …> “a”=> %{ …> “b” => %{ …> “c” => 1 …> } …> } …> } iex> Stripe.Util.map_keys_to_atoms(map) %{ a: %{

"b" => %{
  "c" => 1
}

} }

string_map_to_atoms(string_key_map)
stripe_response_to_struct(struct, stripe_response)
stripe_response_to_struct(struct, stripe_response) :: struct