Use Map.filter now that minimum Elixir version is 1.13

This commit is contained in:
Mark Felder 2024-08-21 14:50:19 -04:00
parent 08a444f6c3
commit 010edcbcb5

View file

@ -20,15 +20,13 @@ defmodule Pleroma.Maps do
end end
def filter_empty_values(data) do def filter_empty_values(data) do
# TODO: Change to Map.filter in Elixir 1.13+
data data
|> Enum.filter(fn |> Map.filter(fn
{_k, nil} -> false {_k, nil} -> false
{_k, ""} -> false {_k, ""} -> false
{_k, []} -> false {_k, []} -> false
{_k, %{} = v} -> Map.keys(v) != [] {_k, %{} = v} -> Map.keys(v) != []
{_k, _v} -> true {_k, _v} -> true
end) end)
|> Map.new()
end end
end end