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

@wjsc/hold-on

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wjsc/hold-on - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

2

package.json
{
"name": "@wjsc/hold-on",
"version": "1.0.3",
"version": "1.0.4",
"description": "Returns a function execution result or a cached version of it",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -58,5 +58,7 @@ ![Current Version](https://img.shields.io/npm/v/@wjsc/hold-on.svg)

const hold = require('@wjsc/hold-on');
const fetch = require('node-fetch); // Or any HTTP client
// Any HTTP client
const fetch = require('node-fetch');
const myFunction = () => fetch('https://httpstat.us/200');
const myFunction = () => fetch('https://httpstat.us/200')
.then(res => res.text());
const myOptimizedFunction = hold(myFunction, 5000);

@@ -66,5 +68,7 @@

for(let i = 0; i<50; i++){
console.log(myOptimizedFunction());
myOptimizedFunction()
.then(console.log);
}
// If you call the function after 5000 ms, the request will be executed again
// If you call the function after 5000 ms
// the request will be executed again

@@ -71,0 +75,0 @@ ```

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