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

adsbexchange-js-utility

v1.0.1

Published

A tiny javascript utility to make api requests to adsbexchange api server

Downloads

12

Readme

adsbexchange-js-utility

Developers Guide

Build Status

Getting Started

  • Clone the application with git clone https://github.com/kenigbolo/adsbexchange-js-utility.git or use ssh git clone [email protected]:kenigbolo/adsbexchange-js-utility.git.

Dependencies

  • NPM 6.x
  • Node 8.x

Description

This is a tiny module that allows making requests to the adsbexchange.com api. The npm package exposes a tiny utility class called ADSBExchange. The utility class can be used to leverage making requests to the the adsbexchange api. This utility will be actively maintained in collaboration with the team at ADS-B Exchange to keep it up to date with the information available on ADS-B Exchange

NPM

This package has been published on NPM and is freely available according to the MIT license. To install via npm simply run npm install adsbexchange-js-utility and via yarn yarn add adsbexchange-js-utility.

NPM Package Usage


const ADSBExchange = require('adsbexchange-js-utility');
const adsbExchange = new ADSBExchange('put-your-api-key-here');

/* Request based on promise style */
adsbExchange.request('aircraft', 'json').then((response) => {
  // response contains the required data
  console.log(response);
});

/* Request based on async/await style */
const requestData = asyn () => {
  const response = await adsbExchange.request('aircraft', 'json');
  // response contains the required data
  console.log(response);
}
requestData();

The utility returns a resolved or rejected promise.

Available functions

The utility exposes two core functions request and reqQuery. Both functions accept two arguments namely endpoint and query however the methods differ purely on the format of the query argument that they take.

Accepted method arguments

  1. The endpoint {Required} - This refers to the endpoint to which the call should be made. The available option at the moment of this writing is aircraft. Kindly consult the official documentation for any endpoints not listed here, however the pluggin is flexible to support new endpoints without any changes needed whenever new endpoints are available. This is the same for both the request method and the reqQuery method.

Query for request function

  1. The query {Required} - The second argument taken by the request function is the query params. Kindly visit the official documentation to be sure what values are allowed in query construction. The query should strip (not contain) both the first and last / in them e.g. for a request like https://adsbexchange.com/api/aircraft/json/lat/37.16611/lon/-119.44944/dist/10/ the query part of this request will be json/lat/37.16611/lon/-119.44944/dist/10 and this is because aircraft is considered the endpoint to which the query is required.

Query for reqQuery function

  1. The query {Required} - This refers to a javascript object constructed to match the require params in a key - value format. Kindly visit the official documentation to be sure what values are allowed in query construction. The query should be constructed following the order in which they are specified in the api documentation e.g. for a request like below

From ADS-B Exchange

https://adsbexchange.com/api/aircraft/json/lat/37.16611/lon/-119.44944/dist/10/

will result a query params constructed as a javascript key-value pair thus

  {json: '', lat: 37.16611, lon: -119.44944, dist: 10}

as pointed out, aircraft is considered the endpoint. Also fields which are not preceeded with a value e.g. json, should be set to an empty string value in the query object.

Return type

The return type of the request method is a Promise which when resolved holds the data response.

Future Plans

I am currently volunteering to build open source tools for the team at ADS-B Exchange and will be adding utilities for both GoLang, Ruby and Python in the coming weeks/months/years. If there are any specific features you will like these utilities to have kindly let me know by creating an issue using the Github issue tracker. I'd be doing my best to help out. Also as an open source tool I'd be more than happy to have more contributors to help out the guys as ADS-B Exchange.