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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@we-ignite-tech/airline-data

v1.0.0

Published

A module to be used in a workshop on APIs and web services

Downloads

3

Readme

You've been asked by your team to make a module for the upcoming travel service.

The data for the service is ready, and has been downloaded to airlines.json. The team also knows what functions they need for the app, your job is to implement the functions for them.

To help you out, they've made a spec (a test) that will ensure your code works the way they need it to for the app.

You should definitely have some additional tests for the logic you implement so your team trusts your work and it's easy to make changes in the future!

It should find records by:

  • Airport code
    • findByCodes(airportCode, carrierCode)
      • airportCode and carrierCode are strings
      • Should return an object or undefined if the codes couldn't be found
  • Number of flight delays (more or less than a certain amount)
    • findByDelays(numberOfDelays, greaterThan)
      • numberOfDelays is a number
      • greaterThan is a boolean that defaults to true
      • Should always return an array - even if it's empty
  • Amount of total minutes delayed
    • findByMinutesDelayed(amountOfTime, greaterThan)
      • numberOfDelays is a number
      • greaterThan is a boolean that defaults to true
      • Should always return an array - even if it's empty

It should also be able to provide totals for airports:

  • getTotals(airports)
    • airports is an array of airport records
    • Should return an array of objects with the form: { airportCode: 'XXX', totalFlights: 000, totalDelays: 000, totalDelayMinutes: 000 }

Airline records

Here's an example record:

{
  "airport": {
    "code": "ATL",
    "name": "Atlanta, GA: Hartsfield-Jackson Atlanta International"
  },
  "statistics": {
    "flights": {
      "cancelled": 5,
      "delayed": 186,
      "diverted": 0,
      "onTime": 561
    },
    "numberOfDelays": {
      "weather": 28,
      "security": 2,
      "carrier": 34,
      "lateAircraft": 18,
      "nationalAviationSystem": 105
    },
    "minutesDelayed": {
      "weather": 1722,
      "carrier": 1367,
      "security": 139,
      "lateAircraft": 1269,
      "nationalAviationSystem": 3817
    }
  },
  "time": {
    "label": "2003/6",
    "year": 2003,
    "month": 6
  },
  "carrier": {
    "code": "AA",
    "name": "American Airlines Inc."
  }
}