# airport-data-api-wrapper

> A wrapper for the Airport-data.com API. Works in Browser or Node.

Latest version **1.1.1** (published 2018-02-13) · ISC license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install airport-data-api-wrapper
pnpm add airport-data-api-wrapper
yarn add airport-data-api-wrapper
bun add airport-data-api-wrapper
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2018-02-13 |
| First published | 2018-02-12 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 20.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Ryan Burnette |
| Maintainers | ryanburnette |

## Links

- npm: https://www.npmjs.com/package/airport-data-api-wrapper
- Repository: https://github.com/ryanburnette/airport-data-api-wrapper
- Issues: https://github.com/ryanburnette/airport-data-api-wrapper/issues
- npm.io page: https://npm.io/package/airport-data-api-wrapper

## Dependencies (1)

- [node-fetch](https://npm.io/package/node-fetch.md) ^2.0.0

## Recent versions

- 1.1.1 (latest) — 2018-02-13
- 1.1.0 — 2018-02-13
- 1.0.1 — 2018-02-12
- 1.0.0 — 2018-02-12

## README

# airport-data-api-wrapper

- An [Airport-data.com](http://www.airport-data.com) API wrapper for Node or
  Browser.
- Be familiar with [Airport-data.com's API][1].
- Use it in the browser globally on window, with require, or with AMD.
- See [browser limitations](#browser-limitations) if using in the browser.

## Usage

```javascript
import AirportDataApiWrapper from 'airport-data-api-wrapper'
import fetch from 'node-fetch'
const aiportData = new AirportDataApiWrapper({fetch})
airportData.acThumb('n1180m').then(res => console.log(res))
airportData.airportInfo('kcrg').then(res => console.log(res))
```

## API

### `new AirportDataApiWrapper([options])`

- `options` An object of [options](#constructor-options).

#### Constructor Options

- `fetch` If a fetch method isn't globally available as it would be in
  browser, pass node-fetch in here.
- `responseHandler` You can override the method that handles the first Promise
  returned by the fetch. You might want to get back info from the headers such
  as rate limit info.

```javascript
const responseHandler = (res) => res.body
const airportData = new AirportDataApiWrapper({fetch,responseHandler})
```

### `acThumb(registration[,options])`

- `registration` An aircraft registration if passed as a string. Options if passed as an object.
- `options` Other options as an object. See [Airport-Data.com API reference][1]

### `airportInfo(icao[,options])`

- `icao` An ICAO identifier as a string. Options if given an object.
- `options` Other options as an object. See [Airport-Data.com API reference][1]

## Browser Limitations

- Requires window.fetch or fetch polyfill
- Requires support for Promises
- Airport-data.com currently only serves over HTTP. Unless they start serving
  over HTTPS, this library will only function in-browser over HTTP.

[1]: http://www.airport-data.com/api/doc.php

---
_Source: https://npm.io/package/airport-data-api-wrapper · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
