diff options
author | Joris Guyonvarch | 2015-03-22 17:13:04 +0100 |
---|---|---|
committer | Joris Guyonvarch | 2015-03-22 17:13:04 +0100 |
commit | b3076f37700291221ededbaf996a065b006cf42d (patch) | |
tree | 26535eb8756329565529f2c5383701aa41c06c17 /src/Model/Edition/Edition.elm | |
parent | e7237e9f2a01197890d85b6ecc223e4022630cb8 (diff) |
Do not add more than one space when editing name
Diffstat (limited to 'src/Model/Edition/Edition.elm')
-rw-r--r-- | src/Model/Edition/Edition.elm | 10 |
1 files changed, 10 insertions, 0 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 |