Skip to content

Instantly share code, notes, and snippets.

@TylerPachal
Last active January 21, 2019 16:58
Show Gist options
  • Select an option

  • Save TylerPachal/f963f099738e4ec873486e56a2eb3026 to your computer and use it in GitHub Desktop.

Select an option

Save TylerPachal/f963f099738e4ec873486e56a2eb3026 to your computer and use it in GitHub Desktop.
with {:width, {:ok, width}} <- {:width, Map.fetch(opts, :width)},
{:height, {:ok, height}} <- {:height, Map.fetch(opts, :height)}
do
{:ok, width * height}
else
{:width, :error} -> {:error, :missing_width}
{:height, :error} -> {:error, :missing_height}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment