mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
36 lines
747 B
TypeScript
36 lines
747 B
TypeScript
import Email from "./Email";
|
|
import Typeof from "./Typeof";
|
|
|
|
export default class EmailWithName {
|
|
private _email: Email = new Email("noreply@oneuptime.com");
|
|
public get email(): Email {
|
|
return this._email;
|
|
}
|
|
public set email(v: Email | string) {
|
|
if (typeof v === Typeof.String) {
|
|
this._email = new Email(v.toString());
|
|
}
|
|
|
|
if (v instanceof Email) {
|
|
this._email = v;
|
|
}
|
|
}
|
|
|
|
private _name: string = "";
|
|
public get name(): string {
|
|
return this._name;
|
|
}
|
|
public set name(v: string) {
|
|
this._name = v;
|
|
}
|
|
|
|
public constructor(name: string, email: string | Email) {
|
|
this.email = email;
|
|
this.name = name;
|
|
}
|
|
|
|
public toString(): string {
|
|
return `"${this.name}" <${this.email}>`;
|
|
}
|
|
}
|