diff --git a/utils/format-endpoint-url.ts b/utils/format-endpoint-url.ts new file mode 100644 index 00000000..5ac0835c --- /dev/null +++ b/utils/format-endpoint-url.ts @@ -0,0 +1,12 @@ +import { Endpoint, Institution, Person } from "../types/addressing.ts"; + +export function formatEndpointURL(endpoint:Endpoint) { + const domainName = normalizeDomainName(endpoint.name); + if (endpoint instanceof Institution) return `${domainName}.unyt.app` + else if (endpoint instanceof Person) return `${domainName}.unyt.app` // TODO: unyt.me? + else return `${domainName}.unyt.app` +} + +function normalizeDomainName(name: string) { + return name.replaceAll("_", "-"); +}