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

qlobber

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

qlobber - npm Package Compare versions

Comparing version 1.5.0 to 1.6.0

20

aedes/qlobber-sub.js

@@ -10,2 +10,3 @@ /*jslint node: true */

Qlobber.call(this, options);
this.sub_count = 0;
}

@@ -17,2 +18,3 @@

{
this.sub_count += 1;
return {

@@ -26,2 +28,7 @@ topic: val.topic,

{
if (!existing.clientMap.has(val.clientId))
{
this.sub_count += 1;
}
existing.clientMap.set(val.clientId, val.qos);

@@ -60,6 +67,13 @@ };

{
if (existing.clientMap.has(val.clientId))
{
this.sub_count -= 1;
}
existing.clientMap.delete(val.clientId);
return existing.clientMap.size === 0;
};
// Returns whether client is last subscriber to topic
QlobberSub.prototype.test_values = function (existing, val)

@@ -77,2 +91,8 @@ {

QlobberSub.prototype.clear = function ()
{
this.sub_count = 0;
return Qlobber.prototype.clear.call(this);
};
module.exports = QlobberSub;

2

package.json
{
"name": "qlobber",
"description": "Node.js globbing for amqp-like topics",
"version": "1.5.0",
"version": "1.6.0",
"homepage": "https://github.com/davedoesdev/qlobber",

@@ -6,0 +6,0 @@ "author": {

@@ -12,2 +12,3 @@ /*jshint node: true, mocha: true */

var matcher = new QlobberSub();
expect(matcher.sub_count).to.equal(0);
matcher.add('foo.bar',

@@ -19,2 +20,3 @@ {

});
expect(matcher.sub_count).to.equal(1);
expect(matcher.match('foo.bar')).to.eql([

@@ -41,2 +43,3 @@ {

var matcher = new QlobberSub();
expect(matcher.sub_count).to.equal(0);
matcher.add('foo.bar',

@@ -48,2 +51,3 @@ {

});
expect(matcher.sub_count).to.equal(1);
matcher.add('foo.bar',

@@ -55,2 +59,3 @@ {

});
expect(matcher.sub_count).to.equal(1);
expect(matcher.match('foo.bar')).to.eql([

@@ -77,2 +82,3 @@ {

var matcher = new QlobberSub();
expect(matcher.sub_count).to.equal(0);
matcher.add('foo.bar',

@@ -84,2 +90,3 @@ {

});
expect(matcher.sub_count).to.equal(1);
matcher.add('foo.bar',

@@ -91,2 +98,3 @@ {

});
expect(matcher.sub_count).to.equal(2);
expect(matcher.match('foo.bar')).to.eql([

@@ -118,2 +126,3 @@ {

var matcher = new QlobberSub();
expect(matcher.sub_count).to.equal(0);
matcher.add('foo.bar',

@@ -125,2 +134,3 @@ {

});
expect(matcher.sub_count).to.equal(1);
matcher.add('foo.*',

@@ -132,2 +142,3 @@ {

});
expect(matcher.sub_count).to.equal(2);
expect(matcher.match('foo.bar')).to.eql([

@@ -169,2 +180,3 @@ {

var matcher = new QlobberSub();
expect(matcher.sub_count).to.equal(0);
matcher.add('foo.bar',

@@ -176,2 +188,3 @@ {

});
expect(matcher.sub_count).to.equal(1);
matcher.add('foo.bar',

@@ -183,2 +196,3 @@ {

});
expect(matcher.sub_count).to.equal(2);
matcher.remove('foo.bar',

@@ -189,2 +203,3 @@ {

});
expect(matcher.sub_count).to.equal(1);
expect(matcher.match('foo.bar')).to.eql([

@@ -211,2 +226,3 @@ {

var matcher = new QlobberSub();
expect(matcher.sub_count).to.equal(0);
matcher.add('foo.bar',

@@ -218,2 +234,3 @@ {

});
expect(matcher.sub_count).to.equal(1);
matcher.add('foo.*',

@@ -225,2 +242,3 @@ {

});
expect(matcher.sub_count).to.equal(2);
matcher.add('foo.bar',

@@ -232,2 +250,3 @@ {

});
expect(matcher.sub_count).to.equal(3);
expect(matcher.match('foo.bar')).to.eql([

@@ -265,5 +284,6 @@ {

it("removing value shouldn't care about topic", function ()
it("removing value shouldn't care about topic in value", function ()
{
var matcher = new QlobberSub();
expect(matcher.sub_count).to.equal(0);
matcher.add('foo.bar',

@@ -275,2 +295,3 @@ {

});
expect(matcher.sub_count).to.equal(1);
matcher.add('foo.bar',

@@ -282,2 +303,3 @@ {

});
expect(matcher.sub_count).to.equal(2);
matcher.remove('foo.bar',

@@ -288,2 +310,3 @@ {

});
expect(matcher.sub_count).to.equal(1);
matcher.remove('foo.bar',

@@ -294,2 +317,3 @@ {

});
expect(matcher.sub_count).to.equal(1);
expect(matcher.match('foo.bar')).to.eql([

@@ -311,3 +335,57 @@ {

})).to.equal(true);
matcher.remove('foo.bar',
{
clientId: 'test2',
topic: 'foo.bar2'
});
expect(matcher.sub_count).to.equal(0);
matcher.remove('foo.bar',
{
clientId: 'test2',
topic: 'foo.bar2'
});
expect(matcher.sub_count).to.equal(0);
});
it('should clear matcher', function ()
{
var matcher = new QlobberSub();
expect(matcher.sub_count).to.equal(0);
matcher.add('foo.bar',
{
clientId: 'test1',
topic: 'foo.bar',
qos: 1
});
expect(matcher.sub_count).to.equal(1);
expect(matcher.match('foo.bar')).to.eql([
{
clientId: 'test1',
topic: 'foo.bar',
qos: 1
}]);
expect(matcher.test('foo.bar',
{
clientId: 'test1',
topic: 'foo.bar'
})).to.equal(true);
expect(matcher.test('foo.bar',
{
clientId: 'test2',
topic: 'foo.bar'
})).to.equal(false);
matcher.clear();
expect(matcher.sub_count).to.equal(0);
expect(matcher.match('foo.bar')).to.eql([]);
expect(matcher.test('foo.bar',
{
clientId: 'test1',
topic: 'foo.bar'
})).to.equal(false);
expect(matcher.test('foo.bar',
{
clientId: 'test2',
topic: 'foo.bar'
})).to.equal(false);
});
});

@@ -59,6 +59,30 @@ /*globals rabbitmq_test_bindings: false,

matcher.clear();
expect(matcher.topic_count).to.equal(0);
matcher.clear();
expect(matcher.topic_count).to.equal(0);
expect(matcher.match('a.b.c').length).to.equal(0);
});
it('should not decrement count if entry does not exist', function ()
{
var matcher = new QlobberTopicCount();
expect(matcher.topic_count).to.equal(0);
matcher.add('foo.bar', 23);
expect(matcher.topic_count).to.equal(1);
matcher.remove('foo.bar', 24);
expect(matcher.topic_count).to.equal(1);
matcher.remove('foo.bar2', 23);
expect(matcher.topic_count).to.equal(1);
matcher.remove('foo.bar', 23);
expect(matcher.topic_count).to.equal(0);
matcher.remove('foo.bar', 24);
expect(matcher.topic_count).to.equal(0);
matcher.remove('foo.bar2', 23);
expect(matcher.topic_count).to.equal(0);
});
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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