Socket
Socket
Sign inDemoInstall

dark-sky-api

Package Overview
Dependencies
13
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.3.1 to 0.3.2

75

dist/dark-sky-api.js

@@ -54,8 +54,2 @@ 'use strict';

this.initialize = function (position) {
_this.setPosition(position);
_this.initialized = true;
return _this;
};
this.setPosition = function (_ref) {

@@ -69,3 +63,3 @@ var latitude = _ref.latitude,

this.loadPositionAsync = WeatherApi.loadPositionAsync;
this.loadPositionAsync = DarkSkyApi.loadPositionAsync;

@@ -80,13 +74,20 @@ this.darkSkyApi = new _darkSkySkeleton2.default(apiKey, proxyUrl);

* @param {object} position - containing geo latitude and longitude
* @see WeatherApi.getNavigatorCoords
* @see DarkSkyApi.getNavigatorCoords
*/
/**
* Set dark sky api position data - Chainable
* @param {object} position - containing geo latitude and longitude
*/
_createClass(DarkSkyApi, [{
key: 'initialize',
value: function initialize(position) {
this.setPosition(position);
this.initialized = true;
return this;
}
/**
* Set dark sky api position data - Chainable
* @param {object} position - containing geo latitude and longitude
*/
_createClass(DarkSkyApi, [{
}, {
key: 'units',

@@ -142,8 +143,3 @@

var currently = _ref2.currently;
currently.windDirection = (0, _geoLocUtils.degreeToCardinal)(currently.windBearing);
if (currently.nearestStormBearing) {
currently.nearestStormDirection = (0, _geoLocUtils.degreeToCardinal)(currently.nearestStormBearing);
}
return currently;
return _this2.processWeatherItem(currently);
});

@@ -168,7 +164,34 @@ }

return val != 'daily';
}).join(',')).get().then(function (data) {
console.log(data); // eslint-disable-line no-console
}).join(',')).get().then(function (_ref3) {
var daily = _ref3.daily;
daily.data = daily.data.map(function (item) {
return _this3.processWeatherItem(item);
});
return daily;
});
}
/**
* Make response a bit more friendly
* @param {object} item - item to process
*/
}, {
key: 'processWeatherItem',
value: function processWeatherItem(item) {
item.windDirection = (0, _geoLocUtils.degreeToCardinal)(item.windBearing);
!item.nearestStormBearing ? null : item.nearestStormDirection = (0, _geoLocUtils.degreeToCardinal)(item.nearestStormBearing);
item.dateTime = _moment2.default.unix(item.time);
!item.sunriseTime ? null : item.sunriseDateTime = _moment2.default.unix(item.sunriseTime);
!item.sunsetTime ? null : item.sunsetDateTime = _moment2.default.unix(item.sunsetTime);
!item.temperatureMinTime ? null : item.temperatureMinDateTime = _moment2.default.unix(item.temperatureMinTime);
!item.temperatureMaxTime ? null : item.temperatureMaxDateTime = _moment2.default.unix(item.temperatureMaxTime);
!item.apparentTemperatureMinTime ? null : item.apparentTemperatureMinDateTime = _moment2.default.unix(item.apparentTemperatureMinTime);
!item.apparentTemperatureMaxTime ? null : item.apparentTemperatureMaxDateTime = _moment2.default.unix(item.apparentTemperatureMaxTime);
return item;
!item.precipIntensityMaxTime ? null : item.precipIntensityMaxDateTime = _moment2.default.unix(precipIntensityMaxTime);
}
/**

@@ -195,12 +218,12 @@ * Get units object showing units returned based on configured units

case 'us':
unitsObject = WeatherApi.getUsUnits();
unitsObject = DarkSkyApi.getUsUnits();
break;
case 'ca':
unitsObject = WeatherApi.getCaUnits();
unitsObject = DarkSkyApi.getCaUnits();
break;
case 'uk2':
unitsObject = WeatherApi.getUk2Units();
unitsObject = DarkSkyApi.getUk2Units();
break;
case 'si':
unitsObject = WeatherApi.getSiUnits();
unitsObject = DarkSkyApi.getSiUnits();
break;

@@ -245,3 +268,3 @@ }

var lang = language || this.language || '';
this._api = new WeatherApi(key, proxy, unit, lang);
this._api = new DarkSkyApi(key, proxy, unit, lang);
}

@@ -248,0 +271,0 @@

{
"name": "dark-sky-api",
"version": "0.3.1",
"version": "0.3.2",
"description": "a simple and robust dark sky api service for client-side js",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc