UNPKG

460 BPlain TextView Raw
1class Contact {
2 private name: string = '';
3 private userAddress: string;
4
5 constructor (userAddress: string) {
6 this.userAddress = userAddress;
7 }
8
9 setName (name: string) {
10 this.name = name;
11 return this;
12 }
13
14 get Name() {
15 return this.name;
16 }
17
18 get UserAddress() {
19 return this.userAddress;
20 }
21
22 toJSON () {
23 return {
24 name: this.name ? this.name : '',
25 address: this.userAddress
26 }
27 }
28}
29
30export default Contact;
\No newline at end of file