You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
238 B
12 lines
238 B
2 years ago
|
export def parse_url url
|
||
|
throw "invalid url" if url === null
|
||
|
let get_url = do |s|
|
||
|
let url = new URL s
|
||
|
throw _ unless (url.host and url.href)
|
||
|
url
|
||
|
try
|
||
|
return get_url url
|
||
|
try
|
||
|
return get_url "https://{url}"
|
||
|
throw "invalid url"
|