Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export class Autor {
- private _id: number;
- private _imie: string;
- private _nazwisko: string;
- private _email: string;
- get imie() { return this._imie }
- set imie(wartosc: string) {
- this._imie = wartosc;
- }
- get nazwisko() { return this._nazwisko }
- set nazwisko(wartosc: string) {
- this._nazwisko = wartosc;
- }
- get email() { return this._email }
- set email(wartosc: string) {
- this._email = wartosc;
- }
- constructor(id: number, imie: string, nazwisko: string) {
- this._id = id;
- this._imie = imie;
- this._nazwisko = nazwisko;
- //this._email = email;
- }
- static stworz(id: number, imie: string, nazwisko: string): Autor {
- if (imie !== undefined && imie !== null && imie.trim().length > 0) {
- throw new Error("imie nie moze byc puste")
- }
- return new Autor(id, imie, nazwisko)
- }
- sprawdzEmail(email: string) {//zmien na static
- return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)
- //regexp
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement