MCPcopy Create free account
hub / github.com/ICBNetwork/web3-Wallet / hideKeyFromUrl

Function hideKeyFromUrl

app/util/hideKeyFromUrl.ts:1–17  ·  view source on GitHub ↗
(url: string | undefined)

Source from the content-addressed store, hash-verified

1const hideKeyFromUrl = (url: string | undefined) => {
2 if (!url) return url;
3
4 const regex = /^(https?:\/\/)(.*)$/;
5 const match = url.match(regex);
6
7 if (match) {
8 const protocol = match[1];
9 let restOfUrl = match[2];
10
11 // eslint-disable-next-line no-useless-escape
12 restOfUrl = restOfUrl.replace(/\/[^\/]*$/, '');
13 return protocol + restOfUrl;
14 }
15
16 return url?.substring(0, url.lastIndexOf('/'));
17};
18
19export default hideKeyFromUrl;

Callers 4

index.jsFile · 0.85
formatNetworkRpcUrlFunction · 0.85
renderNetworkInfoFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected