Skip to content

Commit

Permalink
Add SearchResults.mapMatches
Browse files Browse the repository at this point in the history
  • Loading branch information
hojberg committed Nov 6, 2024
1 parent edc03d3 commit 76d0d7b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Lib/SearchResults.elm
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module Lib.SearchResults exposing
, isEmpty
, length
, map
, mapMatches
, mapMatchesToList
, mapToList
, matchesToList
Expand Down Expand Up @@ -87,6 +88,16 @@ map f results =
SearchResults (f matches)


mapMatches : (a -> b) -> SearchResults a -> SearchResults b
mapMatches f results =
case results of
Empty ->
Empty

SearchResults (Matches matches) ->
SearchResults (Matches (Zipper.map f matches))


mapToList : (a -> Bool -> b) -> SearchResults a -> List b
mapToList f results =
case results of
Expand Down

0 comments on commit 76d0d7b

Please sign in to comment.