diff --git a/lib/unicode_unihan.ex b/lib/unicode_unihan.ex index afaa359..f3bf5a1 100644 --- a/lib/unicode_unihan.ex +++ b/lib/unicode_unihan.ex @@ -57,12 +57,16 @@ defmodule Unicode.Unihan do end defp maybe_load_unihan(codepoint) do - unless :persistent_term.get(:unihan_codepoints, nil) do + unless already_loaded?() do load_unihan() unihan_get(codepoint) end end + defp already_loaded? do + :persistent_term.get(:unihan_codepoints, nil) + end + @spec unihan(binary | integer) :: any @doc """ Returns the Unihan database metadata for