Files
start-sdk/lib/mainFn/Origin.ts

19 lines
406 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}`;
}
}