chore: Add something

This commit is contained in:
BluJ
2023-04-14 09:16:59 -06:00
parent 556b1b03f1
commit df6f0c6efb
7 changed files with 30 additions and 16 deletions

View File

@@ -1,3 +1,18 @@
export class Origin {
constructor(readonly protocol: string, readonly address: string) {}
constructor(readonly protocol: string, readonly host: string) {}
withAuth(
origin?:
| {
password: string;
username: string;
}
| null
| undefined
) {
// prettier-ignore
const urlAuth = !!(origin) ? `${origin.username}:${origin.password}@` :
'';
return `${this.protocol}://${urlAuth}${this.host}`;
}
}