Files
discord-decomp/_bundle/Module6450.js
T
2026-11-01 12:12:55 +02:00

30 lines
888 B
JavaScript

// Metro module 6450 (f6451).
export function getNumberOfUrlSegments(a0) {
return a0.split(/\\?\//).filter((item) => item.length > 0 && item !== ",").length;
}
export function getSanitizedUrlString({ protocol, host, path }) {
return `${protocol ? `${protocol}://` : ""}${host && host.replace(/^.*@/, "[filtered]:[filtered]@").replace(/(:80)$/, "").replace(/(:443)$/, "") || ""}${path}`;
}
export function parseUrl(a0) {
if (a0) {
const r6 = a0.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);
if (r6) {
const search = r6[6] || "";
const hash = r6[8] || "";
return {
host: r6[4],
path: r6[5],
protocol: r6[2],
search,
hash,
relative: r6[5] + search + hash
};
}
return {};
}
return {};
}
export function stripUrlQueryAndFragment(a0) {
return a0.split(/[?#]/, 1)[0];
}