Last active
June 22, 2018 10:15
-
-
Save janmarsicek/dcfea8a192aa8be913359af81fd4e569 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let getListFromSearch = search => | |
search | |
|> Js.String.split("&") | |
|> Array.to_list; | |
let parseUrlSearch = (stringToBeFound, search) => | |
switch (search |> getListFromSearch |> List.find(stringToBeFound |> Js.String.startsWith)) { | |
| item => item |> Js.String.replace(stringToBeFound, "") | |
| exception Not_found => "" | |
}; | |
let emailString = "email="; | |
Js.log("foo&[email protected]&displayModal=1" |> parseUrlSearch(emailString)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment