1.0.0 • Published 5 months ago

weather-msn v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

A package to retrieve weather information for a specified location.

Example / usage :

/** If ESM */
import getWeather from "weather";
                or
import { getWeather } from "weather";

/** If CJS */
const { getWeather } = require("weather");

const location = "Singapore"; // can be any location name or zip code

const weatherData = await getWeather(location);
  .catch((error) => {
    console.log(error);
    return undefined;
  });

  if (!weatherData) return;

  . . . // do something with the weather data
// output from the above code

{
  humidity: '90',
  feelslike: '29',
  temperature: '26',
  location: 'Singapore',
  wind: '5 km/h Southeast',
  weather: 'Mostly cloudy',
  image: 'http://blob.weather.microsoft.com/static/weather4/en-us/law/27.gif'
}

Throws error if :

• WeatherData for the location is not found.
• MSN weather service does not return any valid results.
• Location is not specified or location name is too long ( > 50 ).

For support / query :

1. Join our discord https://codes-for.fun

2. Send me an email support@codes-for.fun

1.0.0

5 months ago