Skip to content

Commit

Permalink
Refactor for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
kipcole9 committed May 31, 2023
1 parent 103beb0 commit da3ae40
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/unicode_unihan.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit da3ae40

Please sign in to comment.