diff options
Diffstat (limited to 'src/Model')
-rw-r--r-- | src/Model/Edition/Edition.elm | 10 | ||||
-rw-r--r-- | src/Model/Edition/NameEdition.elm | 5 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/Model/Edition/Edition.elm b/src/Model/Edition/Edition.elm index 89a0b52..be7aa02 100644 --- a/src/Model/Edition/Edition.elm +++ b/src/Model/Edition/Edition.elm @@ -3,9 +3,11 @@ module Model.Edition.Edition , Kind(..) , newEdition , keyCodeToChar + , isEmpty ) where import Keyboard (KeyCode) +import String import Model.Id (..) import Model.Edition.NameEdition as NameEdition @@ -32,3 +34,11 @@ keyCodeToChar kind = case kind of Name -> NameEdition.keyCodeToChar Time -> TimeEdition.keyCodeToChar + +isEmpty : Edition -> Bool +isEmpty edition = + edition.chars + |> String.fromList + |> String.trim + |> String.length + |> (==) 0 diff --git a/src/Model/Edition/NameEdition.elm b/src/Model/Edition/NameEdition.elm index 18224ea..89e5441 100644 --- a/src/Model/Edition/NameEdition.elm +++ b/src/Model/Edition/NameEdition.elm @@ -12,4 +12,7 @@ keyCodeToChar : KeyCode -> Maybe Char keyCodeToChar = Just << Char.fromCode renderNameEdition : List Char -> String -renderNameEdition = String.fromList << List.reverse +renderNameEdition chars = + chars + |> List.reverse + |> String.fromList |