Skip to content

Commit

Permalink
Fix a bug in XML.element/3 typespec
Browse files Browse the repository at this point in the history
  • Loading branch information
qcam committed Aug 10, 2022
1 parent 98e2c9e commit be744ff
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions lib/saxy/xml.ex
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,17 @@ defmodule Saxy.XML do
@spec element(
name :: term(),
attributes :: [{key :: term(), value :: term()}],
children :: list()
children :: term()
) :: element()

def element(name, attributes, children) when not is_nil(name) and is_list(children) do
def element(name, attributes, children) when not is_nil(name) do
{
to_string(name),
attributes(attributes),
children(children)
children(List.wrap(children))
}
end

def element(name, attributes, child) when not is_nil(name) do
element(name, attributes, [child])
end

@doc """
Builds characters in simple form.
"""
Expand Down

0 comments on commit be744ff

Please sign in to comment.