Skip to content

Commit

Permalink
small parsing optimization (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
et1975 authored Oct 17, 2023
1 parent 57cd13e commit 7e08d41
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 4.0.3
* Small optimization in param parsing

## 4.0.2
* Log separately, only log subs if there are any, #65

Expand Down
14 changes: 8 additions & 6 deletions src/parser.fs
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@ let parsePath (parser: Parser<_,_>) (location: Location) =
path entirely.
*)
let parseHash (parser: Parser<_,_>) (location: Location) =
let hash, search =
let hash, queryParams =
let hash =
if location.hash.Length > 1 then location.hash.Substring 1
else ""
if hash.Contains("?") then
let h = hash.Substring(0, hash.IndexOf("?"))
h, hash.Substring(h.Length)
let pos = hash.IndexOf "?"
if pos >= 0 then
let path = hash.Substring(0,pos)
let search = hash.Substring(pos+1)
path, parseParams search
else
hash, "?"
hash, Map.empty

parse parser hash (parseParams search)
parse parser hash queryParams

0 comments on commit 7e08d41

Please sign in to comment.