getto-systems / elm-url / Getto.Url.Query.SafeDecode

decode url query string safety

value = "count=4&position[]=captain&admin" |> QuerySafeDecode.split

value |> QueryDecode.entryAt ["count"]    (QuerySafeDecode.int 0)
value |> QueryDecode.listAt  ["position"] (QuerySafeDecode.string "")
value |> QueryDecode.boolAt  ["admin"]

Definition


type alias Value =
Getto.Url.Query.Decode.Value

decode target : actually this is List String


type alias Decoder a =
Value -> a

decoder : Value -> Maybe a

Decoders

string : String -> ValueDecoder String

string decoder

int : Basics.Int -> ValueDecoder Basics.Int

int decoder

Decode

entryAt : List String -> ValueDecoder a -> Decoder a

decode entry

listAt : List String -> ValueDecoder a -> Decoder (List a)

decode list

boolAt : List String -> Decoder Basics.Bool

decode bool

Helper

split : String -> Value

query string to Value

"name=John&position=captain" |> QuerySafeDecode.split
-- [ "name=John", "position=captain" ]