SolarEdge.Transform (solar_edge v0.0.1)

Data transformation conveniences

Summary

Functions

Convert a DateTime to a string, without timezone information

Transform API data into a structure where Map keys are snake-cased and atomized

Functions

Link to this function

datetime_to_api_string(dt)

Convert a DateTime to a string, without timezone information

Link to this function

symbolize(data)

Transform API data into a structure where Map keys are snake-cased and atomized

iex> SolarEdge.Transform.symbolize("a") :a

iex> SolarEdge.Transform.symbolize("aBc") :a_bc

Keys are transformed to snake only when the transformation is reversible

iex> SolarEdge.Transform.symbolize("aBC") :aBC

iex> SolarEdge.Transform.symbolize({1, "a"}) {1, "a"}

iex> SolarEdge.Transform.symbolize(%{"a" => 1}) %{a: 1}

iex> SolarEdge.Transform.symbolize(["a"]) ["a"]

iex> SolarEdge.Transform.symbolize(%{"a" => [%{"b" => "c"}]}) %{a: [%{b: "c"}]}