Skip to content

Commit

Permalink
Merge pull request #5 from MBXSystems/hotfix/has-children
Browse files Browse the repository at this point in the history
Fix has_children?
  • Loading branch information
rgtj2 authored May 6, 2024
2 parents 82d8af9 + 2501504 commit 2194f8d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions lib/nested_lines.ex
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,10 @@ defmodule NestedLines do
iex> NestedLines.new!(["1", "1.1", "1.1.1"]) |> NestedLines.has_children?(3)
false
iex> NestedLines.new!(["1", "2", "2.1"]) |> NestedLines.has_children?(1)
iex> NestedLines.new!(["1", "2", "2.1"]) |> NestedLines.has_children?(1)
false
iex> NestedLines.new!(["1", "1.1", "1.2"]) |> NestedLines.has_children?(2)
false
"""
Expand All @@ -242,7 +245,7 @@ defmodule NestedLines do

defp has_children?([_, [_]]), do: false
defp has_children?([_]), do: false
defp has_children?([_, _]), do: true
defp has_children?([a, b]), do: Enum.count(a) < Enum.count(b)

@doc """
Returns a tree representation of the input lines.
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule NestedLines.MixProject do
def project do
[
app: :nested_lines,
version: "0.1.3",
version: "0.1.4",
elixir: "~> 1.14",
start_permanent: Mix.env() == :prod,
description: description(),
Expand Down

0 comments on commit 2194f8d

Please sign in to comment.