MCPcopy
hub / github.com/microfeed/microfeed / removeHostFromUrl

Function removeHostFromUrl

common-src/StringUtils.js:109–117  ·  view source on GitHub ↗
(url)

Source from the content-addressed store, hash-verified

107}
108
109export function removeHostFromUrl(url) {
110 try {
111 const urlObj = new URL(url);
112 const path = urlObj.pathname + urlObj.search + urlObj.hash;
113 return path.replace(/^\/+/g, '')
114 } catch (e) {
115 return url;
116 }
117}
118
119export function urlJoin(...args) {
120 const parts = Array.from(Array.isArray(args[0]) ? args[0] : args);

Calls

no outgoing calls

Tested by

no test coverage detected