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

cache-manager

Package Overview
Dependencies
Maintainers
1
Versions
110
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cache-manager - npm Package Compare versions

Comparing version 2.11.0 to 2.11.1

3

History.md

@@ -0,1 +1,4 @@

- 2.11.1 2020-02-03
- Bugfix: Preserve function prototypes in memory store (#133). -@ryanbecker
- 2.11.0 2020-01-31

@@ -2,0 +5,0 @@ - Use eslint instead of jshint/jscs; use nyc instead of istanbul; mocha/coveralls upgrades.

4

lib/stores/memory.js
/*eslint no-unused-vars:0*/
var Lru = require("lru-cache");
var deepmerge = require('deepmerge');
var cloneDeep = require('lodash.clonedeep');
var utils = require('../utils');

@@ -9,3 +9,3 @@ var isObject = utils.isObject;

if (typeof object === 'object' && object !== null) {
return deepmerge({}, object, {clone: true});
return cloneDeep(object);
}

@@ -12,0 +12,0 @@ return object;

{
"name": "cache-manager",
"version": "2.11.0",
"version": "2.11.1",
"description": "Cache module for Node.js",

@@ -23,4 +23,4 @@ "main": "index.js",

"dependencies": {
"lodash.clonedeep": "4.5.0",
"async": "1.5.2",
"deepmerge": "4.2.2",
"lru-cache": "4.0.0"

@@ -27,0 +27,0 @@ },

@@ -82,2 +82,19 @@ var assert = require('assert');

function getCachedObjectWithPrototype(name, cb) {
function Thing() {}
Thing.prototype.f = function() {
return 'foo';
};
cache.wrap(key, function(cacheCb) {
cacheCb(null, new Thing());
}, opts, cb);
}
function assertCachedObjectWithPrototype(result) {
assert.equal(typeof result, 'object');
var prototype = Object.getPrototypeOf(result);
assert.equal(typeof prototype.f, 'function', 'prototype does not have function f');
assert.equal(result.f(), 'foo', 'prototype function f does not return expected value');
}
beforeEach(function() {

@@ -154,4 +171,17 @@ cache = caching({store: 'memory', ttl: opts.ttl, ignoreCacheErrors: false});

});
it("preserves object prototype", function(done) {
getCachedObjectWithPrototype('foo', function(err, result) {
checkErr(err);
assertCachedObjectWithPrototype(result);
getCachedObjectWithPrototype('foo', function(err, result) {
checkErr(err);
assertCachedObjectWithPrototype(result);
done();
});
});
});
});
});
});
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