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

air-port-codes-node

v1.3.7

Published

The main javascript library for accessing the Air-port-codes API

Downloads

377

Readme

Air-port-codes API SDK

The SDK for accessing all 9000+ airport codes and airport data from Air-port-codes API data feed. Use the Air-port-codes service to help you quickly build an auto-complete form for your website or application.

Installation

  1. First login to your air-port-codes.com account and update your account settings by adding any domains that might need to access the API.
  2. Make a note of your API Key and your API Secret as you will need them for all requests to the API.
  3. Install the npm library
npm install air-port-codes-node

Need a PHP version? Here you go.

Integration

Consult the documentation for the appropriate config settings to use.

Also, you can view the Ionic Angular example code and live demo showing the API in practice.

import { autocomplete } from 'air-port-codes-node';

const apca = autocomplete({
	key : 'xxxxxxxxxxx', 
	secret : 'xxxxxxxxxxxxxxx', // Your API Secret Key: use this if you are not connecting from a web server
	limit : 15
});

Typically a key press would be used in an autocomplete form to make a new api request like this.

let term = 'new yo';
apca.request(term);

Then simply listen for the response

// SUCCESS we found some airports
apca.onSuccess = (data) => {
    console.log('data', data)
};

// FAIL no airports found
apca.onError = (data) => {
    console.log('onError', data.message);
};

Other Air-port-codes API endpoints can easily be accessed as well.

// The easiest way to build an airport autocomplete field
import { autocomplete } from 'air-port-codes-node';

// Finds a list of airports matching search term
import { multi } from 'air-port-codes-node';

// Finds a single airport matching an airport IATA code
import { single } from 'air-port-codes-node';

Retrieves all countries and their ISO (2 character alpha)values
import { countries } from 'air-port-codes-node';

// Retrieves all districts (states/provinces) of any country in the world
import { states } from 'air-port-codes-node';

You can also use an alias in your import to make using the library simpler to understand

import { autocomplete as apcAutoComplete } from 'air-port-codes-node';

const apca = apcAutoComplete({
	key : 'xxxxxxxxxxx', 
	secret : 'xxxxxxxxxxxxxxx',
	limit : 15
});

Ionic Angular Example Screenshot

View Live Demo

Ionic Angular Example Screenshot

License

MIT license | (c) 2016 AIR-PORT-CODES | Air-port-codes.com/legal/terms-of-use