@@ -55,9 +55,9 @@ let arrayToList = a => {
5555 if i < 0 {
5656 res
5757 } else {
58- tolist (i - 1 , list {Array . unsafe_get (a , i ), ... res })
58+ tolist (i - 1 , list {a -> Js . Array2 . unsafe_get (i ), ... res })
5959 }
60- tolist (Array . length ( a ) - 1 , list {})
60+ tolist (a -> Js . Array2 . length - 1 , list {})
6161}
6262/* if we ever roll our own parser in the future, make sure you test all url combinations
6363 e.g. foo.com/?#bar
@@ -72,45 +72,45 @@ let pathParse = str =>
7272 list {}
7373 | raw =>
7474 /* remove the preceeding /, which every pathname seems to have */
75- let raw = Js .String .sliceToEnd (~from = 1 , raw )
75+ let raw = raw -> Js .String2 .sliceToEnd (~from = 1 )
7676 /* remove the trailing /, which some pathnames might have. Ugh */
77- let raw = switch Js .String .get (raw , Js .String .length ( raw ) - 1 ) {
78- | "/" => Js .String .slice (~from = 0 , ~to_ =- 1 , raw )
77+ let raw = switch raw -> Js .String2 .get (raw -> Js .String2 .length - 1 ) {
78+ | "/" => raw -> Js .String2 .slice (~from = 0 , ~to_ =- 1 )
7979 | _ => raw
8080 }
8181 /* remove search portion if present in string */
82- let raw = switch raw |> Js .String .splitAtMost ("?" , ~limit = 2 ) {
82+ let raw = switch raw -> Js .String2 .splitAtMost ("?" , ~limit = 2 ) {
8383 | [path , _ ] => path
8484 | _ => raw
8585 }
8686
87- raw |> Js .String .split ("/" ) |> Js .Array .filter (item => String . length ( item ) != 0 ) |> arrayToList
87+ raw -> Js .String2 .split ("/" )-> Js .Array2 .filter (item => item -> Js . String2 . length != 0 )-> arrayToList
8888 }
8989let path = (~serverUrlString = ?, ()) =>
9090 switch (serverUrlString , window ) {
9191 | (None , None ) => list {}
9292 | (Some (serverUrlString ), _ ) => pathParse (serverUrlString )
93- | (_ , Some (window : Dom .window )) => pathParse (window |> location |> pathname )
93+ | (_ , Some (window : Dom .window )) => pathParse (window -> location -> pathname )
9494 }
9595let hash = () =>
9696 switch window {
9797 | None => ""
9898 | Some (window : Dom .window ) =>
99- switch window |> location |> hash {
99+ switch window -> location -> hash {
100100 | ""
101101 | "#" => ""
102102 | raw =>
103103 /* remove the preceeding #, which every hash seems to have.
104104 Why is this even included in location.hash?? */
105- raw |> Js .String .sliceToEnd (~from = 1 )
105+ raw -> Js .String2 .sliceToEnd (~from = 1 )
106106 }
107107 }
108108let searchParse = str =>
109109 switch str {
110110 | ""
111111 | "?" => ""
112112 | raw =>
113- switch raw |> Js .String .splitAtMost ("?" , ~limit = 2 ) {
113+ switch raw -> Js .String2 .splitAtMost ("?" , ~limit = 2 ) {
114114 | [_ , search ] => search
115115 | _ => ""
116116 }
@@ -120,7 +120,7 @@ let search = (~serverUrlString=?, ()) =>
120120 switch (serverUrlString , window ) {
121121 | (None , None ) => ""
122122 | (Some (serverUrlString ), _ ) => searchParse (serverUrlString )
123- | (_ , Some (window : Dom .window )) => searchParse (window |> location |> search )
123+ | (_ , Some (window : Dom .window )) => searchParse (window -> location -> search )
124124 }
125125
126126let push = path =>
0 commit comments