From c3a6fcee59a6b97c595b633f6ce4403e0b35a7a0 Mon Sep 17 00:00:00 2001 From: Szymon Fiedler Date: Fri, 22 Mar 2024 10:33:47 +0100 Subject: [PATCH] Move helper functions to bottom of the module --- ruby_event_store-browser/elm/src/Search.elm | 40 ++++++++++----------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/ruby_event_store-browser/elm/src/Search.elm b/ruby_event_store-browser/elm/src/Search.elm index b54f90d32e..ff6a033600 100644 --- a/ruby_event_store-browser/elm/src/Search.elm +++ b/ruby_event_store-browser/elm/src/Search.elm @@ -25,11 +25,6 @@ type Msg | GoToStream Stream -emptyStreamName : Stream -emptyStreamName = - "" - - init : (Stream -> a) -> (Stream -> a) -> Model a init onSelectMsg onQueryMsg = { streams = [] @@ -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 @@ -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