evancz / url-parser

Parse URLs into nicely structured data
http://package.elm-lang.org/packages/evancz/url-parser/latest/
BSD 3-Clause "New" or "Revised" License
114 stars 29 forks source link

Adds ability to parse repeated query parameters #48

Closed 97jaz closed 6 years ago

97jaz commented 7 years ago

Currently, if a query string contains a repeated URL parameter (e.g., ?id=1&id=2&id=3), UrlParser will only let you extract a single value for that parameter, namely the last one that occurs in the string. [Here's a working example].

This PR adds the additional functions:

stringParamValues : String -> QueryParser (List String -> a) a
intParamValues : String -> QueryParser (List Int -> a) a
customParamValues : String -> (List String -> a) -> QueryParser (a -> b) b

... to allow the user to extract all of the values.

process-bot commented 7 years ago

Thanks for the pull request! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

evancz commented 6 years ago

The next version of this package will make this possible in a different way, along with some API changes. Anyway, thank you for the suggestion on this!