MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / getHostname

Function getHostname

packages/common/server/parse-referrer.ts:5–15  ·  view source on GitHub ↗
(url: string | undefined)

Source from the content-addressed store, hash-verified

3import referrers from './referrers';
4
5function getHostname(url: string | undefined) {
6 if (!url) {
7 return '';
8 }
9
10 try {
11 return new URL(url).hostname;
12 } catch (e) {
13 return '';
14 }
15}
16
17export function parseReferrer(url: string | undefined) {
18 const hostname = getHostname(url);

Callers 1

parseReferrerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected