@haoyasser/flight-ticket-module 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Task1.js +4 -0
- package/flightTicket.module.js +53 -0
- package/package.json +9 -0
package/Task1.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
(function (definition, env) {
|
|
2
|
+
if (typeof module !== "undefined" && typeof module.exports !== "undefined") {
|
|
3
|
+
module.exports = definition(); // export directly
|
|
4
|
+
this.FlightTicket = definition(); // optional global
|
|
5
|
+
} else {
|
|
6
|
+
window.FlightTicket = definition();
|
|
7
|
+
}
|
|
8
|
+
})(function () {
|
|
9
|
+
|
|
10
|
+
class FlightTicket {
|
|
11
|
+
constructor(
|
|
12
|
+
id,
|
|
13
|
+
seatNumber,
|
|
14
|
+
flightNumber,
|
|
15
|
+
departureTime,
|
|
16
|
+
arrivalTime,
|
|
17
|
+
travelDate
|
|
18
|
+
) {
|
|
19
|
+
this.id = id;
|
|
20
|
+
this.seatNumber = seatNumber;
|
|
21
|
+
this.flightNumber = flightNumber;
|
|
22
|
+
this.departureTime = departureTime;
|
|
23
|
+
this.arrivalTime = arrivalTime;
|
|
24
|
+
this.travelDate = travelDate;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
display() {
|
|
28
|
+
console.log(`
|
|
29
|
+
Ticket ID: ${this.id}
|
|
30
|
+
Seat Number: ${this.seatNumber}
|
|
31
|
+
Flight Number: ${this.flightNumber}
|
|
32
|
+
Departure Time: ${this.departureTime}
|
|
33
|
+
Arrival Time: ${this.arrivalTime}
|
|
34
|
+
Travel Date: ${this.travelDate}
|
|
35
|
+
`);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
get() {
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
update(data) {
|
|
43
|
+
for (let key in data) {
|
|
44
|
+
if (this.hasOwnProperty(key)) {
|
|
45
|
+
this[key] = data[key];
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return FlightTicket;
|
|
52
|
+
|
|
53
|
+
}, this);
|
package/package.json
ADDED