Skip to content

Commit

Permalink
add conforms?/1 function
Browse files Browse the repository at this point in the history
  • Loading branch information
zoedsoupe committed Jun 17, 2024
1 parent 16cf116 commit 9a39ed8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/peri.ex
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,15 @@ defmodule Peri do
end
end

defguardp is_enumerable(data) when is_map(data) or is_list(data)

def conforms?(schema, data) do
case validate(schema, data) do
{:ok, _} -> true
{:error, _errors} -> false
end
end

@doc """
Validates a given data map against a schema.
Expand Down

0 comments on commit 9a39ed8

Please sign in to comment.