Skip to content

About

Lightweight npm dataset for airline IATA/ICAO code lookups.

Resources

Stars

52 stars

Watchers

3 watching

Forks

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.

For other field corrections, add an entry to ID_CORRECTIONS, keyed by the existing airline ID. For missing airlines, add a row to ADDITIONS with a stable, unique negative ID below -10000 and a source comment. These IDs are local to this package, not OpenFlights IDs. Normalization preserves historical records, avoids duplicate additions on repeated runs, and uses the upstream ID once an active airline with the same ICAO code and country appears upstream.

License

The software is licensed under the ISC License. The bundled OpenFlights airline database is licensed under ODbL 1.0; see that notice for attribution and upstream terms.

Thanks

About

Lightweight npm dataset for airline IATA/ICAO code lookups.

Resources

Stars

52 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages