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

catbox-memory

Package Overview
Dependencies
Maintainers
3
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

catbox-memory - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

15

lib/index.js

@@ -72,2 +72,15 @@ // Load modules

// Clean up pending eviction timers.
if (this.cache) {
var segments = Object.keys(this.cache);
for (var i = 0, il = segments.length; i < il; ++i) {
var segment = segments[i];
var keys = Object.keys(this.cache[segment]);
for (var j = 0, jl = keys.length; j < jl; ++j) {
var key = keys[j];
clearTimeout(this.cache[segment][key].timeoutId);
}
}
}
this.cache = null;

@@ -91,3 +104,3 @@ this.byteSize = 0;

if (name.indexOf('\0') !== -1) {
if (name.indexOf('\u0000') !== -1) {
return new Error('Includes null character');

@@ -94,0 +107,0 @@ }

16

package.json
{
"name": "catbox-memory",
"description": "Memory adapter for catbox",
"version": "1.1.1",
"version": "1.1.2",
"repository": "git://github.com/hapijs/catbox-memory",
"main": "index",
"main": "lib/index.js",
"keywords": [

@@ -19,3 +19,3 @@ "cache",

"devDependencies": {
"catbox": "4.x.x",
"catbox": "6.x.x",
"lab": "5.x.x",

@@ -25,10 +25,6 @@ "code": "1.x.x"

"scripts": {
"test": "make test-cov"
"test": "lab -a code -v -L -t 100",
"test-cov-html": "lab -a code -r html -o coverage.html"
},
"licenses": [
{
"type": "BSD",
"url": "http://github.com/hapijs/catbox-memory/raw/master/LICENSE"
}
]
"license": "BSD-3-Clause"
}

@@ -161,6 +161,6 @@ // Load modules

expect(err).to.not.exist();
client.get(key, function (err, result) {
client.get(key, function (err, data) {
expect(err).to.equal(null);
expect(result.item).to.equal('345');
expect(data.item).to.equal('345');
done();

@@ -377,3 +377,3 @@ });

var client = new Catbox.Client(Memory);
var cache = new Catbox.Policy(config, client, 'a\0b');
var cache = new Catbox.Policy(config, client, 'a\u0000b');
};

@@ -384,2 +384,38 @@ expect(fn).to.throw(Error);

it('cleans up timers when stopped', { parallel: false }, function (done) {
var cleared;
var set;
var oldClear = clearTimeout;
clearTimeout = function (id) {
cleared = id;
return oldClear(id);
};
var oldSet = setTimeout;
setTimeout = function (fn, time) {
set = oldSet(fn, time);
return set;
};
var client = new Catbox.Client(Memory);
client.start(function (err) {
var key = { id: 'x', segment: 'test' };
client.set(key, '123', 500, function (err) {
client.stop();
clearTimeout = oldClear;
setTimeout = oldSet;
expect(err).to.not.exist();
expect(cleared).to.exist();
expect(cleared).to.equal(set);
done();
});
});
});
describe('start()', function () {

@@ -763,3 +799,3 @@

var memory = new Memory();
var result = memory.validateSegmentName('\0test');
var result = memory.validateSegmentName('\u0000test');

@@ -766,0 +802,0 @@ expect(result).to.be.instanceOf(Error);

Sorry, the diff of this file is not supported yet

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