@@ -55,9 +55,9 @@ let arrayToList = a => {
55
55
if i < 0 {
56
56
res
57
57
} else {
58
- tolist (i - 1 , list {Array . unsafe_get (a , i ), ... res })
58
+ tolist (i - 1 , list {a -> Js . Array2 . unsafe_get (i ), ... res })
59
59
}
60
- tolist (Array . length ( a ) - 1 , list {})
60
+ tolist (a -> Js . Array2 . length - 1 , list {})
61
61
}
62
62
/* if we ever roll our own parser in the future, make sure you test all url combinations
63
63
e.g. foo.com/?#bar
@@ -72,45 +72,45 @@ let pathParse = str =>
72
72
list {}
73
73
| raw =>
74
74
/* 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 )
76
76
/* 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 )
79
79
| _ => raw
80
80
}
81
81
/* 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 ) {
83
83
| [path , _ ] => path
84
84
| _ => raw
85
85
}
86
86
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
88
88
}
89
89
let path = (~serverUrlString = ?, ()) =>
90
90
switch (serverUrlString , window ) {
91
91
| (None , None ) => list {}
92
92
| (Some (serverUrlString ), _ ) => pathParse (serverUrlString )
93
- | (_ , Some (window : Dom .window )) => pathParse (window |> location |> pathname )
93
+ | (_ , Some (window : Dom .window )) => pathParse (window -> location -> pathname )
94
94
}
95
95
let hash = () =>
96
96
switch window {
97
97
| None => ""
98
98
| Some (window : Dom .window ) =>
99
- switch window |> location |> hash {
99
+ switch window -> location -> hash {
100
100
| ""
101
101
| "#" => ""
102
102
| raw =>
103
103
/* remove the preceeding #, which every hash seems to have.
104
104
Why is this even included in location.hash?? */
105
- raw |> Js .String .sliceToEnd (~from = 1 )
105
+ raw -> Js .String2 .sliceToEnd (~from = 1 )
106
106
}
107
107
}
108
108
let searchParse = str =>
109
109
switch str {
110
110
| ""
111
111
| "?" => ""
112
112
| raw =>
113
- switch raw |> Js .String .splitAtMost ("?" , ~limit = 2 ) {
113
+ switch raw -> Js .String2 .splitAtMost ("?" , ~limit = 2 ) {
114
114
| [_ , search ] => search
115
115
| _ => ""
116
116
}
@@ -120,7 +120,7 @@ let search = (~serverUrlString=?, ()) =>
120
120
switch (serverUrlString , window ) {
121
121
| (None , None ) => ""
122
122
| (Some (serverUrlString ), _ ) => searchParse (serverUrlString )
123
- | (_ , Some (window : Dom .window )) => searchParse (window |> location |> search )
123
+ | (_ , Some (window : Dom .window )) => searchParse (window -> location -> search )
124
124
}
125
125
126
126
let push = path =>
0 commit comments