1 | import only from "only";
|
2 |
|
3 | /**
|
4 | * for example purpose
|
5 | * we build response in string format
|
6 | * send string back to client
|
7 | * usally you should build buffer
|
8 | */
|
9 |
|
10 | export default class Response {
|
11 | month = 0;
|
12 | date = 1;
|
13 | hour = 0;
|
14 | minute = 0;
|
15 | second = 0;
|
16 |
|
17 | constructor({ month, date, hour, minute, second }) {
|
18 | this.month = month;
|
19 | this.date = date;
|
20 | this.hour = hour;
|
21 | this.minute = minute;
|
22 | this.second = second;
|
23 | }
|
24 |
|
25 | /**
|
26 | * Return JSON representation.
|
27 | * We only bother showing settings.
|
28 | *
|
29 | * @return {Object}
|
30 | * @api public
|
31 | */
|
32 |
|
33 | toJSON() {
|
34 | return only(this, ["month", "date", "hour", "minute", "second"]);
|
35 | }
|
36 | }
|