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

optimism

Package Overview
Dependencies
Maintainers
1
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

optimism - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

23

lib/index.js

@@ -11,4 +11,5 @@ "use strict";

function wrap(fn, options) {
function normalizeOptions(options) {
options = options || Object.create(null);
if (typeof options.makeCacheKey !== "function") {

@@ -18,5 +19,18 @@ options.makeCacheKey = defaultMakeCacheKey;

if (typeof options.max !== "number") {
options.max = Math.pow(2, 16);
}
return options;
}
function wrap(fn, options) {
options = normalizeOptions(options);
var cache = new LRU({
dispose: function (entry, key) {
// TODO
max: options.max,
dispose: function (key, entry) {
if (typeof entry.unsubscribe === "function") {
entry.unsubscribe.call(optimistic);
}
}

@@ -37,2 +51,5 @@ });

cache.set(key, entry = new Entry(fn, key, args));
if (typeof options.subscribe === "function") {
entry.unsubscribe = options.subscribe.apply(optimistic, args);
}
}

@@ -39,0 +56,0 @@

2

package.json
{
"name": "optimism",
"version": "0.2.0",
"version": "0.2.1",
"author": "Ben Newman <ben@benjamn.com>",

@@ -5,0 +5,0 @@ "description": "Composable reactive caching with efficient invalidation.",

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