Skip to content

Commit

Permalink
Simplify conditional download args.
Browse files Browse the repository at this point in the history
  • Loading branch information
christhekeele committed Oct 13, 2024
1 parent 6ffc5dc commit 9835491
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/kino/mermaid.ex
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,15 @@ defmodule Kino.Mermaid do
def new(diagram, opts \\ []) do
opts = Keyword.validate!(opts, caption: false, download: true)

download =
if download = Keyword.fetch!(opts, :download) do
case download do
download = case Keyword.fetch!(opts, :download) do
true ->
@download_defaults

download_opts when is_list(download_opts) ->
Keyword.validate!(download_opts, @download_defaults)
end
|> Map.new()
_ -> false
end
|> Map.new()

caption = Keyword.fetch!(opts, :caption)

Expand Down

0 comments on commit 9835491

Please sign in to comment.