Skip to content

Commit

Permalink
Move helper functions to bottom of the module
Browse files Browse the repository at this point in the history
  • Loading branch information
fidel committed Mar 22, 2024
1 parent 1227afe commit c3a6fce
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions ruby_event_store-browser/elm/src/Search.elm
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ type Msg
| GoToStream Stream


emptyStreamName : Stream
emptyStreamName =
""


init : (Stream -> a) -> (Stream -> a) -> Model a
init onSelectMsg onQueryMsg =
{ streams = []
Expand All @@ -39,21 +34,6 @@ init onSelectMsg onQueryMsg =
}


onSelectCmd : (Stream -> a) -> Stream -> Cmd a
onSelectCmd onSelectMsg stream =
Task.perform onSelectMsg (Task.succeed stream)


onQueryChangedCmd : (Stream -> a) -> Stream -> Cmd a
onQueryChangedCmd onQueryMsg stream =
Task.perform onQueryMsg (Task.succeed stream)


hasAtLeastThreeChars : Stream -> Bool
hasAtLeastThreeChars stream =
String.length stream >= 3


update : Msg -> Model a -> ( Model a, Cmd a )
update msg model =
case msg of
Expand Down Expand Up @@ -115,6 +95,26 @@ viewList model =
]


emptyStreamName : Stream
emptyStreamName =
""


onSelectCmd : (Stream -> a) -> Stream -> Cmd a
onSelectCmd onSelectMsg stream =
Task.perform onSelectMsg (Task.succeed stream)


onQueryChangedCmd : (Stream -> a) -> Stream -> Cmd a
onQueryChangedCmd onQueryMsg stream =
Task.perform onQueryMsg (Task.succeed stream)


hasAtLeastThreeChars : Stream -> Bool
hasAtLeastThreeChars stream =
String.length stream >= 3


streamsPresent : Model a -> Bool
streamsPresent { streams } =
not <| List.isEmpty streams

0 comments on commit c3a6fce

Please sign in to comment.