capital-weather-utils
v1.1.2
Published
A small JavaScript library to fetch and process current weather data for world capitals using the [Open-Meteo](https://open-meteo.com/) API. No external JSON files are required; capital data is included as a variable in the library.
Readme
Weather Utils Library
A small JavaScript library to fetch and process current weather data for world capitals using the Open-Meteo API. No external JSON files are required; capital data is included as a variable in the library.
Features
- Get general weather status of a capital.
- Check if it is raining in a capital.
- Get current wind speed in a capital.
- Get current temperature in a capital.
- Get current humidity in a capital.
- Get current UV index in a capital.
- Get full weather information for a capital (all available data).
Installation
npm i capital-weather-utilsUsage
import {
getFullWeather,
weatherStatus,
rainStatus,
windStatus,
temperatureStatus,
humidityStatus,
uvIndexStatus
} from 'capital-weather-utils';
const city = "Rome";
async function main() {
// Full weather data
const full = await getFullWeather(city);
console.log("Full weather for", city, ":", full);
// Weather status (sereno, nuvoloso, ecc.)
const weather = await weatherStatus(city);
console.log("Weather status for", city, ":", weather);
// Check if it is raining
const rain = await rainStatus(city);
console.log("Rain status for", city, ":", rain);
// Wind speed
const wind = await windStatus(city);
console.log("Wind status for", city, ":", wind);
// Temperature
const temp = await temperatureStatus(city);
console.log("Temperature for", city, ":", temp);
// Humidity
const humidity = await humidityStatus(city);
console.log("Humidity for", city, ":", humidity);
// UV Index
const uv = await uvIndexStatus(city);
console.log("UV Index for", city, ":", uv);
}
main().catch(console.error);5
License
This library uses weather data from Open-Meteo. Please check their terms of service for proper usage.
