Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@orzelius/weathermodule

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@orzelius/weathermodule

Weather API library

  • 2.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

WeatherModule

Install

npm i @orzelius/weathermodule

Use like this (uncached):

const { weatherApp } = require('@orzelius/weathermodule');

//Uncached verson
weatherApp.getData('York', 1)
    .then(data => console.log(data))
    .catch(err => {
        throw err;
});

First parameter is the name of the city and the second one is optional index, if more than one city is returned.

Or like this (cached):

const { weatherApp, DataCash } = require('@orzelius/weathermodule');

//Declare cache
const cachedWeatherApp = new DataCash(() => { return weatherApp.getData('York', 1) }, 0.05)
//Use cache
console.log(cachedWeatherApp.getData().then((data) => { console.log(!!data) }));
//Some timeouts to see it work
setTimeout(cachedWeatherApp.getData, 1000);
setTimeout(cachedWeatherApp.getData, 2000);
setTimeout(cachedWeatherApp.getData, 3000);
setTimeout(cachedWeatherApp.getData, 4000);
setTimeout(cachedWeatherApp.getData, 5000);
setTimeout(cachedWeatherApp.getData, 6000);

The 0.05 is cache ttl in minutes (3s in this case)

FAQs

Package last updated on 25 May 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc