Skip to content

Commit

Permalink
Create format-endpoint-url.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
benStre authored Jan 30, 2024
1 parent bc1f4f6 commit f592092
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions utils/format-endpoint-url.ts
Original file line number Diff line number Diff line change
@@ -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("_", "-");
}

0 comments on commit f592092

Please sign in to comment.