sparkpost v0.3.0
Washup
Tools for verifying and pruning Elixir structs before JSON serialisation.
Summary
Walk a possibly nested data structure, filtering out nil values
Walk a possibly nested data structure and raise an exception if a :required
is found
Functions
Walk a possibly nested data structure, filtering out nil values.
Example
iex> jenny = %{name: "Jennifer", age: 27, rank: "Captain", pets: nil}
iex> Washup.filter(jenny)
%{name: "Jennifer", age: 27, rank: "Captain"}
iex> Washup.filter("Plain String")
"Plain String"
Walk a possibly nested data structure and raise an exception if a :required
is found.
Example
iex> jenny = %{name: "Jennifer", age: 27, rank: "Captain", pets: [%{species: :required}]}
iex> Washup.verify(jenny)
** (Washup.RequiredError) pets->listidx->species required