Replace local attr helpers

This commit is contained in:
2026-06-21 14:24:05 +02:00
parent 62f87b8ab4
commit 6a7a8c4288
7 changed files with 29 additions and 66 deletions

View File

@@ -1,6 +1,8 @@
defmodule BDS.Metadata do
@moduledoc false
import BDS.MapUtils, only: [attr: 2, attr: 3]
require Logger
alias BDS.Embeddings
@@ -674,19 +676,4 @@ defmodule BDS.Metadata do
defp maybe_backfill_embeddings(result, _project_id, _previous_state, _project_metadata),
do: result
defp attr(attrs, key) do
cond do
Map.has_key?(attrs, key) -> Map.get(attrs, key)
Map.has_key?(attrs, Atom.to_string(key)) -> Map.get(attrs, Atom.to_string(key))
true -> nil
end
end
defp attr(attrs, key, default) do
cond do
Map.has_key?(attrs, key) -> Map.get(attrs, key)
Map.has_key?(attrs, Atom.to_string(key)) -> Map.get(attrs, Atom.to_string(key))
true -> default
end
end
end