Files
start-sdk/lib/mainFn/Origin.ts
2023-04-14 09:16:59 -06:00

19 lines
405 B
TypeScript

export class Origin {
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}`;
}
}