https://github.com/athanclark/elm-param-parsing-2
Another url query param parser in elm
https://github.com/athanclark/elm-param-parsing-2
Last synced: 4 months ago
JSON representation
Another url query param parser in elm
- Host: GitHub
- URL: https://github.com/athanclark/elm-param-parsing-2
- Owner: athanclark
- Created: 2016-08-27T07:43:22.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-08-28T04:29:07.000Z (almost 10 years ago)
- Last Synced: 2025-07-07T17:44:17.735Z (11 months ago)
- Language: HTML
- Size: 222 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# elm-param-parsing-2
Ripped off from [jessitron's library](https://github.com/jessitron/elm-param-parsing) -
there were just a few subtleties I thought were left out.
## Query String Parsing
So this module parses URI query strings - specifically strings
that begin with the character `?`, and are a `&`-separated list
of substrings, which themselves may be split via a `=`. The string
in question should also be ASCII (check me on this), encoded as a
`x-www-urlencoded` MIME type.
To parse such a string, just feed it into `parseQuery`:
```elm
parseQuery "?foo=bar&baz&qux=1"
> [("foo", Just "bar"), ("baz", Nothing), ("qux", Just "1")]
```
I believe the type `List (String, Maybe String)` is more precise
than a `Dict` for a number of reasons, which I detail in the docs.
Happy hacking!