Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

airly

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

airly - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

readme.md

44

dist/index.js

@@ -14,3 +14,2 @@ 'use strict';

ow_1.default(key, ow_1.default.string);
ow_1.default(language, ow_1.default.optional.string.minLength(2).maxLength(2));
this.baseUrl = 'https://airapi.airly.eu/v2';

@@ -30,4 +29,2 @@ this.config = {

async idData(id) {
// Validate id
ow_1.default(id, ow_1.default.number);
const response = await got_1.default(`${this.baseUrl}/measurements/installation?installationId=${id}`, this.config);

@@ -41,4 +38,2 @@ return response.body;

async idInfo(id) {
// Validate id
ow_1.default(id, ow_1.default.number);
const response = await got_1.default(`${this.baseUrl}/installations/${id}`, this.config);

@@ -50,5 +45,7 @@ return response.body;

* @param {number} lng Longitude - Geographical coordinate
* @param {number} maxDistanceKM All the returned installations must be located within this limit from the given point (in km); negative value means no limit (default: 3)
* @param {number} maxResults Maximum number of installations to return; negative value means no limit (default: -1)
* @returns {Promise<object[]>} Info about 3 nearest installations
*/
async nearestInstallations(lat, lng) {
async nearestInstallations(lat, lng, maxDistanceKM, maxResults) {
/*

@@ -60,5 +57,36 @@ Validate latitude & longitude

ow_1.default(lng, ow_1.default.number.is(x => x >= -180.0 && x <= 180.0));
const search = await got_1.default(`${this.baseUrl}/installations/nearest?lat=${lat}&lng=${lng}&maxResults=3&maxDistanceKM=-1`, this.config);
return search.body;
const response = await got_1.default(`${this.baseUrl}/installations/nearest?lat=${lat}&lng=${lng}&maxDistanceKM=${maxDistanceKM || 3}&maxResults=${maxResults || -1}`, this.config);
return response.body;
}
/**
* @param {number} lat Latitude - Geographical coordinate
* @param {number} lng Longitude - Geographical coordinate
* @param {number} maxDistanceKM All the returned installations must be located within this limit from the given point (in km); negative value means no limit (default: 3)
* @returns {Promise<object[]>} Returns measurements for an installation closest to a given location.
*/
async nearestIdMeasurements(lat, lng, maxDistanceKM) {
/*
Validate latitude & longitude
See https://developer.airly.eu/docs#general.coordinates
*/
ow_1.default(lat, ow_1.default.number.is(x => x >= -90.0 && x <= 90.0));
ow_1.default(lng, ow_1.default.number.is(x => x >= -180.0 && x <= 180.0));
const response = await got_1.default(`${this.baseUrl}/measurements/nearest?lat=${lat}&lng=${lng}&maxDistanceKM=${maxDistanceKM || 3}`, this.config);
return response.body;
}
/**
* @param {number} lat Latitude - Geographical coordinate
* @param {number} lng Longitude - Geographical coordinate
* @returns {Promise<object[]>} Returns measurements for any geographical location. Measurement values are interpolated by averaging measurements from nearby sensors (up to 1,5km away from the given point).
*/
async nearestAverageMeasurements(lat, lng) {
/*
Validate latitude & longitude
See https://developer.airly.eu/docs#general.coordinates
*/
ow_1.default(lat, ow_1.default.number.is(x => x >= -90.0 && x <= 90.0));
ow_1.default(lng, ow_1.default.number.is(x => x >= -180.0 && x <= 180.0));
const response = await got_1.default(`${this.baseUrl}/measurements/point?lat=${lat}&lng=${lng}`, this.config);
return response.body;
}
}

@@ -65,0 +93,0 @@ module.exports = Airly;

6

package.json
{
"name": "airly",
"version": "1.1.0",
"version": "1.2.0",
"description": "Simple wrapper for Airly API",

@@ -48,3 +48,3 @@ "license": "MIT",

"devDependencies": {
"@akepinski/tsconfig": "0.0.1",
"@akepinski/tsconfig": "0.0.2",
"@types/got": "^9.4.3",

@@ -56,3 +56,3 @@ "@typescript-eslint/eslint-plugin": "^1.7.0",

"ts-node": "^8.1.0",
"typescript": "^3.4.4",
"typescript": "^3.4.5",
"xo": "*"

@@ -59,0 +59,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc