Skip to content

Commit

Permalink
update guard clause to avoid expensive length check
Browse files Browse the repository at this point in the history
  • Loading branch information
jaeyson committed Jul 14, 2024
1 parent cb66ad6 commit 5aaa7aa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/ex_typesense/result_parser.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ defmodule ExTypesense.ResultParser do

@doc since: "0.1.0"
@spec hits_to_query(Enum.t(), module() | String.t()) :: Ecto.Query.t()
def hits_to_query(hits, schema_name) when length(hits) == 0 do
def hits_to_query(hits, schema_name) when hits == [] do
schema_name
|> where([i], i.id in [])
end
Expand Down

0 comments on commit 5aaa7aa

Please sign in to comment.