Skip to content

npow/airline-codes

Repository files navigation

Airline Codes

Docs

Airline codes (IATA) and information pulled from OpenFlights.org

Install

npm install airline-codes 

Usage

The list of airline codes is wrapped in a Backbone Collection, so have access to all normal collection methods like findWhere, at, and sort.

var airlines = require('airline-codes'); console.log(airlines.findWhere({ iata: 'WS' }).get('name')); //=> Westjet

If you'd like only the JSON list of airline codes, you can use either the Backbone Collection's toJSON method or import the json list directly:

require('airline-codes').toJSON(); require('airline-codes/airlines.json');

Update the list of Airline Codes

Data is synced automatically every week from jpatokal/openflights. To update manually:

$ wget https://raw.githubusercontent.com/jpatokal/openflights/master/data/airlines.dat $ node normalize.js # apply local corrections (country names, etc.) $ node convert.js # regenerate airlines.json from airlines.dat 

Adding corrections

Upstream data uses different conventions for some country names and contains occasional data quality issues. normalize.js maintains a COUNTRY_CORRECTIONS map that is applied automatically after every upstream fetch. To add a new correction, edit the map in normalize.js:

var COUNTRY_CORRECTIONS = { 'Macao': 'Macau', 'Republic of Korea': 'South Korea', // add new entries here ... };

After editing, re-run the pipeline above to apply the change.

Thanks

About

Lightweight npm dataset for airline IATA/ICAO code lookups.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors