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

lru-cache-ext

Package Overview
Dependencies
Maintainers
0
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lru-cache-ext - npm Package Compare versions

Comparing version 4.0.0 to 4.1.0

8

lib/index.js

@@ -12,6 +12,6 @@ import assert from 'assert';

async memoize(key, valueFn) {
async memoize(key, valueFn, ...args) {
assert(typeof valueFn === 'function');
if (!this.has(key)) {
this.set(key, valueFn());
this.set(key, valueFn(args));
}

@@ -30,6 +30,6 @@ try {

memoizeSync(key, valueFn) {
memoizeSync(key, valueFn, ...args) {
assert(typeof valueFn === 'function');
if (!this.has(key)) {
const r = valueFn();
const r = valueFn(args);
assert(!(r instanceof Promise), 'Use memoize() instead');

@@ -36,0 +36,0 @@ this.set(key, r);

{
"name": "lru-cache-ext",
"type": "module",
"version": "4.0.0",
"version": "4.1.0",
"description": "Thin wrapper around lru-cache with extended functionality.",

@@ -6,0 +6,0 @@ "main": "lib/index.js",

@@ -35,3 +35,3 @@ # lru-cache-ext

### memoize(key: String, valueFn: function)
### memoize(key: String, valueFn: function, ...args)

@@ -46,3 +46,3 @@ Only when the key is not present in cache (or has expired), `valueFn` is called and placed into cache.

### memoizeSync(key: String, valueFn: function)
### memoizeSync(key: String, valueFn: function, ...args)

@@ -49,0 +49,0 @@ Similar to "memoize", when key is not present (or has expired), `valueFn` is called and placed into the cache.

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