weather.js

0.1.0 • Public • Published

Weather.js

Build Status npm GitHub license

About

There really should be a conclusive JavaScript weather library. Weather.js fetches data from OpenWeatherMap (no affiliation). Since other providers format their output differently, currently this is the only source provider.

Weather.js is still in early development so expect changes and please contribute! Among the features I hope to incorporate:

  • historical weather information
  • API key usage (but there is a beta version!)
  • more data sources
  • more conversions!

Install

Weather.js works in the browser and node.js. Take your pick. For the browser, download the most recent version on GitHub. For use in node, just install using NPM.

npm install -g weather.js

Usage

At the moment you can access the current weather conditions and the forecast for any city. By default it will use the closest match as returned by Open Weather Map.

Weather.getCurrent("Kansas City", function(current) {
  console.log(
    ["currently:",current.temperature(),"and",current.conditions()].join(" ")
  );
});
 
Weather.getForecast("Kansas City", function(forecast) {
  console.log("Forecast High in Kelvin: " + forecast.high());
  console.log("Forecast High in Fahrenheit" + Weather.kelvinToFahrenheit(forecast.high()));
  console.log("Forecast High in Celsius" + Weather.kelvinToCelsius(forecast.high()));
});

Readme

Keywords

Package Sidebar

Install

npm i weather.js

Weekly Downloads

398

Version

0.1.0

License

MIT

Last publish

Collaborators

  • noazark
  • randomlyknighted
  • pallasmedia