getto-systems/elm-url/1.0.0

Getto.Url.Query.Decode

decode url query string

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


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

Definition

type alias Value =
List String

decode target : actually this is List String

type alias Decoder a =
Value -> Maybe a

decoder : Value -> Maybe a

Decoders

string : ValueDecoder String

string decoder

int : ValueDecoder Int

int decoder

Decode

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

decode entry

listAt : List String -> ValueDecoder a -> Value -> Maybe (List a)

decode list

boolAt : Value -> Decoder Bool

decode bool

Helper

split : String -> Value

query string to Value

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