mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-22 22:49:45 +01:00
feat: better errors when server fails
This commit is contained in:
17
packages/core/utils/hostname.js
Normal file
17
packages/core/utils/hostname.js
Normal file
@@ -0,0 +1,17 @@
|
||||
export function extractHostname(url) {
|
||||
var hostname;
|
||||
//find & remove protocol (http, ftp, etc.) and get hostname
|
||||
|
||||
if (url.indexOf("//") > -1) {
|
||||
hostname = url.split("/")[2];
|
||||
} else {
|
||||
hostname = url.split("/")[0];
|
||||
}
|
||||
|
||||
//find & remove port number
|
||||
// hostname = hostname.split(":")[0];
|
||||
//find & remove "?"
|
||||
hostname = hostname.split("?")[0];
|
||||
|
||||
return hostname;
|
||||
}
|
||||
Reference in New Issue
Block a user