Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class PreFlightService {
- goToGate(flight) {
- if (flight instanceof Flight !== true) throw new Error('Must be a flight')
- if (flight.atGate) throw new Error('Flight is already at the gate');
- return Object.assign({}, flight, {
- atGate: true
- });
- }
- refuel() {
- }
- restockFood() {
- }
- onBoardFlightTeam() {
- }
- onBoardPassengers() {
- }
- }
- class Flight {
- constructor() {
- this.passengers = [];
- this.team = [];
- this.food = [];
- this.refueled = false;
- this.atGate = false;
- }
- }
- let service = new PreFlightService;
- let flight = new Flight;
- flight.atGate = true;
- service.goToGate(flight)
Add Comment
Please, Sign In to add comment