@nitro-land/airport-codes

1.0.4 • Public • Published

Airport Codes

Airport codes (IATA) and information pulled from OpenFlights.org Updated due to dependency vulnerabilities

Install

npm install @nitro-land/airport-codes

Usage

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

var airports = require('@nitro-land/airport-codes');

console.log(airports.findWhere({ iata: 'LAX' }).get('name'));
//=> Los Angeles Intl

console.log(airports.at(124).get('city'));;
//=> Sydney

console.log(airports.at(0).get('name'));
//=> Goroka
airports.comparator = 'city';
airports.sort();
console.log(airports.at(0).get('name'));
//=> 7 Novembre

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

require('@nitro-land/airport-codes').toJSON();
require('@nitro-land/airport-codes/airports.json');

Update the list of Airport Codes

Fetch Airport codes

$ wget https://raw.githubusercontent.com/jpatokal/openflights/master/data/airports.dat

Generate the list

Convert the list of airport codes from csv format to JSON.

node convert.js

Thanks

Dependencies (4)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @nitro-land/airport-codes

    Weekly Downloads

    257

    Version

    1.0.4

    License

    ISC

    Unpacked Size

    2.95 MB

    Total Files

    6

    Last publish

    Collaborators

    • 213edu