lib/irc: add formatURL

This commit is contained in:
Simon Ser 2023-04-19 11:43:45 +02:00
parent 57809be989
commit 57f64e9cc2
4 changed files with 18 additions and 16 deletions

View file

@ -839,6 +839,17 @@ export function parseURL(str) {
return { host, enttype, entity };
}
export function formatURL({ host, enttype, entity } = {}) {
host = host || "";
entity = entity || "";
let s = "irc://" + host + "/" + encodeURIComponent(entity);
if (enttype) {
s += ",is" + enttype;
}
return s;
}
export class CapRegistry {
available = new Map();
enabled = new Set();