npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

flight-ticket-module-mearn-r2

v1.0.1

Published

first flight ticket UMD module

Readme

Flight Ticket Module (UMD)

flight-ticket-module-mearn-r2 is a simple, lightweight UMD module to manage flight tickets in JavaScript. It is designed for both Node.js and browser environments.

It allows you to:

  • Create a flight ticket
  • Display ticket information
  • Update ticket details safely
  • Cancel tickets

The module uses private properties for encapsulation and includes input validation to prevent incorrect data.


Table of Contents


Installation

Install the module via npm:

npm install flight-ticket-module-mearn-r2

How it Works

  1. Import the FlightTicket class from the module.

  2. Create a new instance of FlightTicket.

  3. Use createTicket() to initialize ticket information.

  4. Access or modify ticket data using the available methods.

  5. Display ticket information using displayTicket().

All updates are validated and private properties prevent direct manipulation of internal data.


Usage Examples

Node.js Example

const FlightTicket = require("flight-ticket-module-mearn-r2");

const ticket = new FlightTicket();

ticket.createTicket({
  ticketId: "T1001",
  flightNumber: "MS202",
  seatNumber: "10A",
  departureAirport: "Cairo",
  arrivalAirport: "Dubai",
  travelDate: "2026-06-10",
  passengerName: "Omar Ezzat"
});

console.log(ticket.displayTicket());

// Update some details
ticket.updatePassengerName("Ahmed Ali");
ticket.updateSeat("12C");
ticket.updateDepartureAirport("Alexandria");

console.log(ticket.getTicketInfo());

// Cancel ticket
ticket.cancelTicket();
console.log(ticket.displayTicket());

Browser Example

<script src="flight.js"></script>
<script>
  const ticket = new FlightTicket();

  ticket.createTicket({
    ticketId: "T1002",
    flightNumber: "EK202",
    seatNumber: "15B",
    departureAirport: "Cairo",
    arrivalAirport: "London",
    travelDate: "2026-07-15",
    passengerName: "Omar Ezzat"
  });

  console.log(ticket.displayTicket());

  ticket.updatePassengerName("Ahmed Ali");
  ticket.updateSeat("16D");
</script>

FlightTicket Class Methods

| Method | Description | | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | | createTicket({ticketId, flightNumber, seatNumber, departureAirport, arrivalAirport, travelDate, passengerName, status}) | Initializes a ticket with all required information. Default status is "booked". Validates all inputs. | | getTicketInfo() | Returns an object containing all ticket details. | | updateSeat(newSeatNumber) | Updates the seat number if the ticket is not cancelled. Validates input. | | updatePassengerName(newName) | Updates passenger name if the ticket is not cancelled. Validates input. | | updateDepartureAirport(newAirport) | Updates the departure airport if the ticket is not cancelled. Validates input. | | updateArrivalAirport(newAirport) | Updates the arrival airport if the ticket is not cancelled. Validates input. | | updateTravelDate(newDate) | Updates travel date if the ticket is not cancelled. Validates input as a proper date. | | cancelTicket() | Changes ticket status to "cancelled". Throws an error if already cancelled. | | displayTicket() | Returns a formatted string representing the ticket information. |

Private Properties: All data fields (#ticketId, #flightNumber, #seatNumber, #departureAirport, #arrivalAirport, #travelDate, #passengerName, #status) are private and can only be modified using the methods above.


License

This project is licensed under the ISC License.
© 2026 Omar Ezzat