aboutsummaryrefslogtreecommitdiff
path: root/src/client/Utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/Utils')
-rw-r--r--src/client/Utils/Validation.elm8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/client/Utils/Validation.elm b/src/client/Utils/Validation.elm
index 0c1773e..b9bccb3 100644
--- a/src/client/Utils/Validation.elm
+++ b/src/client/Utils/Validation.elm
@@ -12,10 +12,12 @@ validateNonEmpty message str =
then Err message
else Ok str
-validateNumber : String -> String -> Result String Int
-validateNumber message str =
+validateNumber : String -> (Int -> Bool) -> String -> Result String Int
+validateNumber message numberForm str =
case readInt str of
Just number ->
- Ok number
+ if numberForm number
+ then Ok number
+ else Err message
Nothing ->
Err message