Skip to content

Instantly share code, notes, and snippets.

@vyuh
Created June 3, 2021 18:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vyuh/8fdc486400ced3a07c12bd69f860af59 to your computer and use it in GitHub Desktop.
Save vyuh/8fdc486400ced3a07c12bd69f860af59 to your computer and use it in GitHub Desktop.
IGNORE PATH AND GET QUERY PARAMETER
getExam : String -> Maybe String
getExam str = case Url.fromString str of
Nothing -> Nothing
Just u ->
Maybe.withDefault Nothing (Url.Parser.parse (Url.Parser.query (Url.Parser.Query.string "exam")) { u | path = "" })
extractSearchArgument : String -> Url -> Maybe String
extractSearchArgument key location =
{ location | path = "" }
|> Url.Parser.parse (Url.Parser.query (Url.Parser.Query.string key))
|> Maybe.withDefault Nothing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment