Security News
The Push to Ban Ransom Payments Is Gaining Momentum
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
weather-forecaster
Advanced tools
Readme
weather-forecaster is a NPM module that will allow you to easily access the current and detailed weather conditions of any city in any country that you prefer!
npm install weather-forecaster
Field | Type | Unit | Description |
---|---|---|---|
date | object | The date that the observation pertains (both numeric and long date formats) | |
location | string | Name of the location (City, Country) | |
location_woeid | integer | Where On Earth ID | |
humidity_percentage | integer | percentage | |
weather_state | string | Name of the weather state | |
weather_state_iconURL | string | Icon of the weather state (SVG format) | |
air_pressure_hPa | float | hPa | |
wind_speed | object | kmh, mph | |
wind_direction | string | compass point | Compass point of the wind direction |
temp_celcius | object | centigrade | |
temp_fahrenheit | object | fahrenheit | |
visibility_range | object | km, miles | Measure of the distance which the weather state can be clearly discerned |
Since this package's structure is asynchronous you have to use "async-await" or ".then()" structures when using the module.
Example usages with these structures are given below.
const weather_forecast = require("weather-forecaster");
(async () => {
const data = await weather_forecast("san francisco");
// your code..
console.log(data);
})();
const weather_forecast = require("weather-forecaster");
weather_forecast("istanbul").then(data => {
// your code..
console.log(data);
});
const weather_forecast = require("weather-forecaster");
async function myWeatherData(query) {
const data = await weather_forecast(query);
// your code..
console.log(data);
};
myWeatherData("new york");
const weather_forecast = require("weather-forecaster");
async function myWeatherData(query) {
const data = await weather_forecast(query);
/*
this destructuring assignment will allow us to use
these parts of the data without using the data.<name> format
*/
const { weather_state, temp_celcius } = data;
// in this case the expected outputs will be the same
// example outputs:
console.log(weather_state); // Light Cloud
console.log(data.weather_state); // Light Cloud
/*
we can do that destructuring assignment once again with
the parts that we already destructured
*/
const { lowest, highest, current } = temp_celcius;
const first_array = [
lowest,
highest,
current
];
const second_array = [
temp_celcius.lowest,
temp_celcius.highest,
temp_celcius.current
];
const third_array = [
data.temp_celcius.lowest,
data.temp_celcius.highest,
data.temp_celcius.current
];
// in this case the expected outputs will be the same
// example outputs:
console.log(first_array); // [ 15.2, 23.2, 23.5 ]
console.log(second_array); // [ 15.2, 23.2, 23.5 ]
console.log(third_array); // [ 15.2, 23.2, 23.5 ]
};
myWeatherData("new york");
Licensed under The MIT License (MIT). For the full copyright and license information, please view the LICENSE file.
FAQs
A package that will help you obtain weather information
We found that weather-forecaster demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
Application Security
New SEC disclosure rules aim to enforce timely cyber incident reporting, but fear of job loss and inadequate resources lead to significant underreporting.
Security News
The Python Software Foundation has secured a 5-year sponsorship from Fastly that supports PSF's activities and events, most notably the security and reliability of the Python Package Index (PyPI).