Skip to content

Commit

Permalink
Add Search.isEmptyResults
Browse files Browse the repository at this point in the history
  • Loading branch information
hojberg committed Oct 2, 2024
1 parent 19611f6 commit d870e0a
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/Lib/Search.elm
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module Lib.Search exposing
, fromResult
, hasSubstantialQuery
, isEmptyQuery
, isEmptyResults
, isSearching
, queriesEquals
, query
Expand Down Expand Up @@ -182,6 +183,25 @@ isEmptyQuery =
query >> String.isEmpty


isEmptyResults : Search a -> Maybe Bool
isEmptyResults s =
case s of
NotAsked _ ->
Nothing

Searching _ (Just r) ->
Just (SearchResults.isEmpty r)

Searching _ Nothing ->
Nothing

Success _ r ->
Just (SearchResults.isEmpty r)

Failure _ _ ->
Nothing


isSearching : Search a -> Bool
isSearching search_ =
case search_ of
Expand Down

0 comments on commit d870e0a

Please sign in to comment.