Comparing version 1.3.1 to 1.3.2
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("miniOwm",[],e):"object"==typeof exports?exports.miniOwm=e():t.miniOwm=e()}(window,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=3)}([function(t,e){},function(t,e){},function(t,e){},function(t,e,n){"use strict";n.r(e),n.d(e,"coords",(function(){return i.a})),n.d(e,"getAtts",(function(){return o.a})),n.d(e,"IMiniOwm",(function(){return c.a})),n.d(e,"default",(function(){return f})),n.d(e,"Units",(function(){return s}));var r=n(0),i=n.n(r),u=n(1),o=n.n(u),a=n(2),c=n.n(a),s={Standard:"",Metric:"metric",Imperial:"imperial"};function l(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var f=function(){function t(e,n,r,i,u,o){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._apiKey=e||"",this._latitude=n||0,this._longitude=r||0,this._exclude=i||"",this._units=u&&u.trim()?u.trim().toLowerCase():s.Metric,this._units===s.Standard&&(this._units=""),this._language=o&&o.trim()?o.trim().toLowerCase():""}var e,n,r;return e=t,(n=[{key:"apiKey",value:function(t){return this._apiKey=t,this}},{key:"latitude",value:function(t){return this._latitude=t,this}},{key:"longitude",value:function(t){return this._longitude=t,this}},{key:"exclude",value:function(t){return this._exclude=t,this}},{key:"standard",value:function(){return this._units=s.Standard,this}},{key:"metric",value:function(){return this._units=s.Metric,this}},{key:"imperial",value:function(){return this._units=s.Imperial,this}},{key:"language",value:function(t){return this._language=t&&t.trim()?t.trim().toLowerCase():"",this}},{key:"get",value:function(t){var e=this,n=this._latitude,r=this._longitude,i=this._exclude,u=this._apiKey,o=this._units,a=this._language,c=t||{},l=c.apiKey||u,f=c.coords?c.coords.latitude:n,d=c.coords?c.coords.longitude:r,p=c.language&&c.language.trim()?c.language.trim().toLowerCase():a,h=c.units&&c.units.trim()?c.units.trim().toLowerCase():o,y=c.exclude||i;if(!l||!f||!d)throw new Error("Missing required parameters for Open Weather Map api call.");var g="https://api.openweathermap.org/data/2.5/onecall?lat=".concat(f,"&lon=").concat(d,"&exclude=").concat(y,"&appid=").concat(l);return h&&h!==s.Standard&&(g="".concat(g,"&units=").concat(h)),p&&(g="".concat(g,"&lang=").concat(p)),fetch(g).then((function(t){return t.json()})).then((function(t){return t.current&&(t.current.rain=e.getPrecipitation(t.current.rain),t.current.snow=e.getPrecipitation(t.current.snow)),t.hourly&&(t.hourly=t.hourly.map((function(t){return t.rain=e.getPrecipitation(t.rain),t.snow=e.getPrecipitation(t.snow),t}))),t}))}},{key:"getPrecipitation",value:function(t){return t&&t["1h"]?t["1h"]:0}}])&&l(e.prototype,n),r&&l(e,r),t}()}]).default})); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("miniOwm",[],e):"object"==typeof exports?exports.miniOwm=e():t.miniOwm=e()}(window,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=3)}([function(t,e){},function(t,e){},function(t,e){},function(t,e,n){"use strict";n.r(e),n.d(e,"coords",(function(){return i.a})),n.d(e,"getAtts",(function(){return o.a})),n.d(e,"IMiniOwm",(function(){return c.a})),n.d(e,"default",(function(){return f})),n.d(e,"Units",(function(){return s}));var r=n(0),i=n.n(r),u=n(1),o=n.n(u),a=n(2),c=n.n(a),s={Standard:"",Metric:"metric",Imperial:"imperial"};function l(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var f=function(){function t(e,n,r,i,u,o){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._apiKey=e||"",this._latitude=n||0,this._longitude=r||0,this._exclude=i||"",this._units=u&&u.trim()?u.trim().toLowerCase():s.Metric,this._units===s.Standard&&(this._units=""),this._language=o&&o.trim()?o.trim().toLowerCase():""}var e,n,r;return e=t,(n=[{key:"apiKey",value:function(t){return this._apiKey=t,this}},{key:"latitude",value:function(t){return this._latitude=t,this}},{key:"longitude",value:function(t){return this._longitude=t,this}},{key:"exclude",value:function(t){return this._exclude=t,this}},{key:"standard",value:function(){return this._units=s.Standard,this}},{key:"metric",value:function(){return this._units=s.Metric,this}},{key:"imperial",value:function(){return this._units=s.Imperial,this}},{key:"language",value:function(t){return this._language=t&&t.trim()?t.trim().toLowerCase():"",this}},{key:"get",value:function(t){var e=this,n=this._latitude,r=this._longitude,i=this._exclude,u=this._apiKey,o=this._units,a=this._language,c=t||{},l=c.apiKey||u,f=c.coords?c.coords.latitude:n,d=c.coords?c.coords.longitude:r,p=c.language&&c.language.trim()?c.language.trim().toLowerCase():a,h=c.units&&c.units.trim()?c.units.trim().toLowerCase():o,y=c.exclude||i;if(!l||!f||!d)throw new Error("Missing required parameters for Open Weather Map api call.");var m="https://api.openweathermap.org/data/2.5/onecall?lat=".concat(f,"&lon=").concat(d,"&exclude=").concat(y,"&appid=").concat(l);return h&&h!==s.Standard&&(m="".concat(m,"&units=").concat(h)),p&&(m="".concat(m,"&lang=").concat(p)),fetch(m).then((function(t){return t.json()})).then((function(t){return t.current&&(t.current.rain=e.getPrecipitation(t.current.rain),t.current.snow=e.getPrecipitation(t.current.snow)),t.daily&&(t.daily=t.daily.map((function(t){return t.rain=t.rain||0,t.snow=t.snow||0,t}))),t.hourly&&(t.hourly=t.hourly.map((function(t){return t.rain=e.getPrecipitation(t.rain),t.snow=e.getPrecipitation(t.snow),t}))),t}))}},{key:"getPrecipitation",value:function(t){return t&&t["1h"]?t["1h"]:0}}])&&l(e.prototype,n),r&&l(e,r),t}()}]).default})); | ||
//# sourceMappingURL=index.js.map |
@@ -73,2 +73,9 @@ import Units from "./Units"; | ||
} | ||
if (res.daily) { | ||
res.daily = res.daily.map(item => { | ||
item.rain = item.rain || 0; | ||
item.snow = item.snow || 0; | ||
return item; | ||
}); | ||
} | ||
if (res.hourly) { | ||
@@ -75,0 +82,0 @@ res.hourly = res.hourly.map(item => { |
{ | ||
"name": "mini-owm", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"description": "Mini ES wrapper for OpenWeatherMap api", | ||
@@ -5,0 +5,0 @@ "author": "Dean Verleger", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
30245
193