From 98354918422b14c3b5d01e59307c6a127e1a4be3 Mon Sep 17 00:00:00 2001 From: Chris Keele Date: Sun, 13 Oct 2024 18:50:16 -0500 Subject: [PATCH] Simplify conditional download args. --- lib/kino/mermaid.ex | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/kino/mermaid.ex b/lib/kino/mermaid.ex index 8348c5d3..ece03cbf 100644 --- a/lib/kino/mermaid.ex +++ b/lib/kino/mermaid.ex @@ -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)