Skip to content

Commit

Permalink
Add nil value for empty queue
Browse files Browse the repository at this point in the history
  • Loading branch information
shahryarjb committed Apr 25, 2024
1 parent 1241296 commit b77ed4d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/modules/queue_assistant.ex
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,9 @@ defmodule QueueAssistant do
# false
```
"""
@spec is_empty?(queue_type()) :: boolean()
@spec is_empty?(queue_type() | nil) :: boolean()
def is_empty?(nil), do: true

def is_empty?(queue) do
:queue.is_empty(queue)
end
Expand All @@ -279,7 +281,7 @@ defmodule QueueAssistant do
@doc """
For see more information, check `is_empty?/1`
"""
@spec empty?(queue_type()) :: boolean()
@spec empty?(queue_type() | nil) :: boolean()
def empty?(queue), do: is_empty?(queue)

@doc """
Expand All @@ -294,7 +296,7 @@ defmodule QueueAssistant do
"""
@spec is_queue?(queue_type()) :: boolean()
def is_queue?(queue) do
:queue.is_empty(queue)
:queue.is_queue(queue)
end

@doc """
Expand Down

0 comments on commit b77ed4d

Please sign in to comment.