List of validations with implicit transformations that can be applied to an outcome
For most validations:
Convert a tuple of singleton list to a tuple of String
Valid (["min"], ["max"]) |> asTuple -- Valid ("min", "max")Convert a String to a Float otherwise raise a warning
Valid "true" |> asBool -- Valid TrueConvert a String to a Float otherwise raise a warning
Valid "12.3" |> asFloat -- Valid 12.3Convert a String to an Int otherwise raise a warning
Valid "12" |> asInt -- Valid 12Convert a tuple of String to a tuple of Int otherwise raise a warning
Valid ("3", "5") |> asIntTuple -- Valid (3, 5)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)Enforce that the list to be unique
Valid ["alpha", "beta", "alpha"] |> asUnique -- Valid ["alpha", "beta"]Check that first value is strictly less than the second otherwise raise a warning
Valid (3, 5) |> asIntRange -- Valid (3, 5)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)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)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)Ensure that the list equal a given size otherwise raise a warning
Valid ["alpha", "beta"] |> listEqual 2 -- Valid ["alpha", "beta"]Ensure that the list equal or less than a given size otherwise raise a warning
Valid ["alpha", "beta"] |> listLessThan 2 -- Valid ["alpha", "beta"]Ensure that the list equal or more than a given size otherwise raise a warning
Valid ["alpha", "beta"] |> listMoreThan 2 -- Valid ["alpha", "beta"]Ensure that the list is strictly less than a given size otherwise raise a warning
Valid ["alpha", "beta"] |> listStrictlyLessThan 3 -- Valid ["alpha", "beta"]Ensure that the list is strictly more than a given size otherwise raise a warning
Valid ["alpha", "beta"] |> listStrictlyMoreThan 1 -- Valid ["alpha", "beta"]Check whether a string matches an absolute URL otherwise raise a warning
Valid "http://bbc.co.uk" |> matchAbsoluteUrl -- Valid "http://bbc.co.uk"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"Check that a string belong to an enumeration otherwise raise a warning
Valid ["alpha"] |> matchEnum ["beta", "alpha"] -- Valid ["alpha"]Check that a string is a normalized string
Valid "some string" |> matchNormalizedString -- Valid "some string"Check whether a string matches a regular expression otherwise raise a warning
Valid "abc" |> matchRegex "[a-z]+" -- Valid "abc"Check that a string contains a term otherwise raise a warning
Valid ["blue red green"] |> stringContains "red" -- Valid ["blue red green"]Check that a string starts with a prefix otherwise raise a warning
Valid ["ui:label"] |> stringStartsWith "ui:" -- Valid ["ui:label"]Check that a string ends with a suffix otherwise raise a warning
Valid ["image.jpg"] |> stringEndsWith ".jpg" -- Valid ["image.jpg"]Check that all the strings' number of characters are within a range otherwise raise a warning
Valid ["abc", "abcd"] |> withinListStringCharsRange (2, 7) -- Valid "abcd"Check that a string number of characters is within a range otherwise raise a warning
Valid "abcd" |> withinStringCharsRange (2, 7) -- Valid "abcd"
Convert a list with only one string to a single string.