Package

purescript-form-urlencoded

Repository
purescript-contrib/purescript-form-urlencoded
License
BSD-3-Clause
Uploaded by
thomashoneyman
Published on
2019-08-14T23:30:57Z

Latest release Build status Pursuit Maintainer: zudov Maintainer: thomashoneyman

A FormURLEncoded datatype represents an ordered list of key-value pairs with possible duplicates. encode function allows to transform FormURLEncoded into a Maybe String according to application/x-www-form-urlencoded. decode function transforms a string into a Maybe FormURLEncoded structure.

Documentation is available on Pursuit.

Example:

> import Data.FormURLEncoded (fromArray, encode)
> import Data.Maybe (Maybe(..))
> import Data.Tuple (Tuple(..))

> encode (fromArray [ Tuple "hey" Nothing
>                   , Tuple "Oh" (Just "Let's go!")
>                   ])
Just "hey&Oh=Let's%20go!"

> decode "a=aa&b=bb"
Just (FormURLEncoded [(Tuple "a" (Just "aa")),(Tuple "b" (Just "bb"))])

Contributing

Read the contribution guidelines to get started and see helpful related resources.