Current section
Files
Jump to
Current section
Files
lib/yemux/yaml.ex
defmodule Yemux.Yaml do
@moduledoc ~S"""
Yaml related helpers
"""
def missing_keys(yaml, keys) do
{values, missing} =
keys
|> Enum.reduce({[], []}, fn key, {values, missing} ->
case Map.get(yaml, key) do
nil -> {values, [key | missing]}
value -> {[value | values], missing}
end
end)
case {values, missing} do
{values, []} -> {:ok, values}
_ -> {:error, missing}
end
end
end
# SPDX-License-Identifier: Apache-2.0