List of validations with implicit transformations that can be applied to an outcome
For most validations:
asSingle : Bubblegum.Entity.Outcome.Outcome (List String) -> Bubblegum.Entity.Outcome.Outcome String
Convert a list with only one string to a single string.
Valid [ "alpha" ] |> asSingle -- Valid "alpha"
asTuple : Bubblegum.Entity.Outcome.Outcome ( List String, List String ) -> Bubblegum.Entity.Outcome.Outcome ( String, String )
Convert a tuple of singleton list to a tuple of String
Valid ( [ "min" ], [ "max" ] ) |> asTuple -- Valid ("min", "max")
asBool : Bubblegum.Entity.Outcome.Outcome String -> Bubblegum.Entity.Outcome.Outcome Basics.Bool
Convert a String to a Float otherwise raise a warning
Valid "true" |> asBool -- Valid True
asFloat : Bubblegum.Entity.Outcome.Outcome String -> Bubblegum.Entity.Outcome.Outcome Basics.Float
Convert a String to a Float otherwise raise a warning
Valid "12.3" |> asFloat -- Valid 12.3
asInt : Bubblegum.Entity.Outcome.Outcome String -> Bubblegum.Entity.Outcome.Outcome Basics.Int
Convert a String to an Int otherwise raise a warning
Valid "12" |> asInt -- Valid 12
asIntTuple : Bubblegum.Entity.Outcome.Outcome ( String, String ) -> Bubblegum.Entity.Outcome.Outcome ( Basics.Int, Basics.Int )
Convert a tuple of String to a tuple of Int otherwise raise a warning
Valid ( "3", "5" ) |> asIntTuple -- Valid (3, 5)
asFloatTuple : Bubblegum.Entity.Outcome.Outcome ( String, String ) -> Bubblegum.Entity.Outcome.Outcome ( Basics.Float, Basics.Float )
Convert a tuple of String to a tuple of Float otherwise raise a warning
Valid ( "3.5", "5.5" ) |> asFloatTuple -- Valid (3.5, 5.5)
asUnique : Bubblegum.Entity.Outcome.Outcome (List String) -> Bubblegum.Entity.Outcome.Outcome (List String)
Enforce that the list to be unique
Valid [ "alpha", "beta", "alpha" ] |> asUnique -- Valid ["alpha", "beta"]
asIntRange : Bubblegum.Entity.Outcome.Outcome ( Basics.Int, Basics.Int ) -> Bubblegum.Entity.Outcome.Outcome ( Basics.Int, Basics.Int )
Check that first value is strictly less than the second otherwise raise a warning
Valid ( 3, 5 ) |> asIntRange -- Valid (3, 5)
asFloatRange : Bubblegum.Entity.Outcome.Outcome ( Basics.Float, Basics.Float ) -> Bubblegum.Entity.Outcome.Outcome ( Basics.Float, Basics.Float )
Check that first value is strictly less than the second otherwise raise a warning
Valid ( 3.5, 5.5 ) |> asFloatRange -- Valid (3.5, 5.5)
withinIntRange : ( Basics.Int, Basics.Int ) -> Bubblegum.Entity.Outcome.Outcome ( Basics.Int, Basics.Int ) -> Bubblegum.Entity.Outcome.Outcome ( Basics.Int, Basics.Int )
Check a tuple of Int is within the range of a given range otherwise raise a warning
Valid ( 3, 5 ) |> withinIntRange ( 2, 7 ) -- Valid (3, 5)
withinFloatRange : ( Basics.Float, Basics.Float ) -> Bubblegum.Entity.Outcome.Outcome ( Basics.Float, Basics.Float ) -> Bubblegum.Entity.Outcome.Outcome ( Basics.Float, Basics.Float )
Check a tuple of Float is within the range of a given range otherwise raise a warning
Valid ( 3.5, 5.2 ) |> withinFloatRange ( 2.1, 7.2 ) -- Valid (3.5, 5.2)
listEqual : Basics.Int -> Bubblegum.Entity.Outcome.Outcome (List String) -> Bubblegum.Entity.Outcome.Outcome (List String)
Ensure that the list equal a given size otherwise raise a warning
Valid [ "alpha", "beta" ] |> listEqual 2 -- Valid ["alpha", "beta"]
listLessThan : Basics.Int -> Bubblegum.Entity.Outcome.Outcome (List String) -> Bubblegum.Entity.Outcome.Outcome (List String)
Ensure that the list equal or less than a given size otherwise raise a warning
Valid [ "alpha", "beta" ] |> listLessThan 2 -- Valid ["alpha", "beta"]
listMoreThan : Basics.Int -> Bubblegum.Entity.Outcome.Outcome (List String) -> Bubblegum.Entity.Outcome.Outcome (List String)
Ensure that the list equal or more than a given size otherwise raise a warning
Valid [ "alpha", "beta" ] |> listMoreThan 2 -- Valid ["alpha", "beta"]
listStrictlyLessThan : Basics.Int -> Bubblegum.Entity.Outcome.Outcome (List String) -> Bubblegum.Entity.Outcome.Outcome (List String)
Ensure that the list is strictly less than a given size otherwise raise a warning
Valid [ "alpha", "beta" ] |> listStrictlyLessThan 3 -- Valid ["alpha", "beta"]
listStrictlyMoreThan : Basics.Int -> Bubblegum.Entity.Outcome.Outcome (List String) -> Bubblegum.Entity.Outcome.Outcome (List String)
Ensure that the list is strictly more than a given size otherwise raise a warning
Valid [ "alpha", "beta" ] |> listStrictlyMoreThan 1 -- Valid ["alpha", "beta"]
matchAbsoluteUrl : Bubblegum.Entity.Outcome.Outcome String -> Bubblegum.Entity.Outcome.Outcome String
Check whether a string matches an absolute URL otherwise raise a warning
Valid "http://bbc.co.uk" |> matchAbsoluteUrl -- Valid "http://bbc.co.uk"
matchCompactUri : Bubblegum.Entity.Outcome.Outcome String -> Bubblegum.Entity.Outcome.Outcome String
Check whether a string matches an absolute URL otherwise raise a warning.
The prefix should not exceed 15 characters.
Valid "uri:a/b001/c" |> matchCompactUri -- Valid "uri:a/b001/c"
matchEnum : List String -> Bubblegum.Entity.Outcome.Outcome String -> Bubblegum.Entity.Outcome.Outcome String
Check that a string belong to an enumeration otherwise raise a warning
Valid [ "alpha" ] |> matchEnum [ "beta", "alpha" ] -- Valid ["alpha"]
matchNormalizedString : Bubblegum.Entity.Outcome.Outcome String -> Bubblegum.Entity.Outcome.Outcome String
Check that a string is a normalized string
Valid "some string" |> matchNormalizedString -- Valid "some string"
matchRegex : String -> Bubblegum.Entity.Outcome.Outcome String -> Bubblegum.Entity.Outcome.Outcome String
Check whether a string matches a regular expression otherwise raise a warning
Valid "abc" |> matchRegex "[a-z]+" -- Valid "abc"
stringContains : String -> Bubblegum.Entity.Outcome.Outcome String -> Bubblegum.Entity.Outcome.Outcome String
Check that a string contains a term otherwise raise a warning
Valid [ "blue red green" ] |> stringContains "red" -- Valid ["blue red green"]
stringStartsWith : String -> Bubblegum.Entity.Outcome.Outcome String -> Bubblegum.Entity.Outcome.Outcome String
Check that a string starts with a prefix otherwise raise a warning
Valid [ "ui:label" ] |> stringStartsWith "ui:" -- Valid ["ui:label"]
stringEndsWith : String -> Bubblegum.Entity.Outcome.Outcome String -> Bubblegum.Entity.Outcome.Outcome String
Check that a string ends with a suffix otherwise raise a warning
Valid [ "image.jpg" ] |> stringEndsWith ".jpg" -- Valid ["image.jpg"]
withinListStringCharsRange : ( Basics.Int, Basics.Int ) -> Bubblegum.Entity.Outcome.Outcome (List String) -> Bubblegum.Entity.Outcome.Outcome (List String)
Check that all the strings' number of characters are within a range otherwise raise a warning
Valid [ "abc", "abcd" ] |> withinListStringCharsRange ( 2, 7 ) -- Valid "abcd"
withinStringCharsRange : ( Basics.Int, Basics.Int ) -> Bubblegum.Entity.Outcome.Outcome String -> Bubblegum.Entity.Outcome.Outcome String
Check that a string number of characters is within a range otherwise raise a warning
Valid "abcd" |> withinStringCharsRange ( 2, 7 ) -- Valid "abcd"
floatLessThan : Basics.Float -> Bubblegum.Entity.Outcome.Outcome Basics.Float -> Bubblegum.Entity.Outcome.Outcome Basics.Float
Check that an int is equal or less than a given value otherwise raise a warning
Valid 12.4 |> floatLessThan 12.4 -- Valid 12.4
floatMoreThan : Basics.Float -> Bubblegum.Entity.Outcome.Outcome Basics.Float -> Bubblegum.Entity.Outcome.Outcome Basics.Float
Check that an int is equal or more than a given value otherwise raise a warning
Valid 12.4 |> floatMoreThan 5.0 -- Valid 12.4
floatStrictlyLessThan : Basics.Float -> Bubblegum.Entity.Outcome.Outcome Basics.Float -> Bubblegum.Entity.Outcome.Outcome Basics.Float
Check that an int is strictly less than a given value otherwise raise a warning
Valid 12.4 |> floatStrictlyLessThan 20 -- Valid 12.4
floatStrictlyMoreThan : Basics.Float -> Bubblegum.Entity.Outcome.Outcome Basics.Float -> Bubblegum.Entity.Outcome.Outcome Basics.Float
Check that an int is strictly more than a given value otherwise raise a warning
Valid 12.4 |> floatStrictlyMoreThan 5.3 -- Valid 12.4
intLessThan : Basics.Int -> Bubblegum.Entity.Outcome.Outcome Basics.Int -> Bubblegum.Entity.Outcome.Outcome Basics.Int
Check that an int is equal or less than a given value otherwise raise a warning
Valid 12 |> intLessThan 12 -- Valid 12
intMoreThan : Basics.Int -> Bubblegum.Entity.Outcome.Outcome Basics.Int -> Bubblegum.Entity.Outcome.Outcome Basics.Int
Check that an int is equal or more than a given value otherwise raise a warning
Valid 12 |> intMoreThan 12 -- Valid 12
intStrictlyLessThan : Basics.Int -> Bubblegum.Entity.Outcome.Outcome Basics.Int -> Bubblegum.Entity.Outcome.Outcome Basics.Int
Check that an int is strictly less than a given value otherwise raise a warning
Valid 12 |> intStrictlyLessThan 20 -- Valid 12
intStrictlyMoreThan : Basics.Int -> Bubblegum.Entity.Outcome.Outcome Basics.Int -> Bubblegum.Entity.Outcome.Outcome Basics.Int
Check that an int is equal or more than a given value otherwise raise a warning
Valid 12 |> intStrictlyMoreThan 5 -- Valid 12