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 4.0.1 to 4.1.0

coverage/lcov-report/favicon.png

9

lib/qlobber.js

@@ -208,2 +208,4 @@ /**

- `{Boolean} match_empty_levels` If `true` then `wilcard_one` also matches an empty word in a topic. Defaults to `false`.
- `{Boolean|Map} cache_adds` Whether to cache topics when adding topic matchers. This will make adding multiple matchers for the same topic faster at the cost of extra memory usage. Defaults to `false`. If you supply a `Map` then it will be used to cache the topics (use this to enumerate all the topics in the qlobber).

@@ -224,2 +226,3 @@

this._max_wildcard_somes = options.max_wildcard_somes || 3;
this._match_empty_levels = options.match_empty_levels;
this._trie = new Map();

@@ -416,3 +419,3 @@ if (options.cache_adds instanceof Map)

if (word)
if (word || this._match_empty_levels)
{

@@ -503,3 +506,3 @@ st = sub_trie.get(this._wildcard_one);

if (word)
if (word || this._match_empty_levels)
{

@@ -572,3 +575,3 @@ st = sub_trie.get(this._wildcard_one);

if (word)
if (word || this._match_empty_levels)
{

@@ -575,0 +578,0 @@ st = sub_trie.get(this._wildcard_one);

{
"name": "qlobber",
"description": "Node.js globbing for amqp-like topics",
"version": "4.0.1",
"version": "4.1.0",
"homepage": "https://github.com/davedoesdev/qlobber",

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

"grunt-exec": "^3.0.0",
"mocha": "^6.2.2",
"mocha": "^7.0.0",
"chai": "^4.2.0",
"nyc": "^14.1.1",
"coveralls": "^3.0.7",
"nyc": "^15.0.0",
"coveralls": "^3.0.9",
"b": "git://github.com/davedoesdev/b.git",

@@ -53,0 +53,0 @@ "JSONStream": "^1.3.5",

@@ -226,2 +226,4 @@ # qlobber   [![Build Status](https://travis-ci.org/davedoesdev/qlobber.png)](https://travis-ci.org/davedoesdev/qlobber) [![Coverage Status](https://coveralls.io/repos/davedoesdev/qlobber/badge.png?branch=master)](https://coveralls.io/r/davedoesdev/qlobber?branch=master) [![NPM version](https://badge.fury.io/js/qlobber.png)](http://badge.fury.io/js/qlobber)

- `{Boolean} match_empty_levels` If `true` then `wilcard_one` also matches an empty word in a topic. Defaults to `false`.
- `{Boolean|Map} cache_adds` Whether to cache topics when adding topic matchers. This will make adding multiple matchers for the same topic faster at the cost of extra memory usage. Defaults to `false`. If you supply a `Map` then it will be used to cache the topics (use this to enumerate all the topics in the qlobber).

@@ -228,0 +230,0 @@

@@ -21,2 +21,14 @@ /*globals rabbitmq_test_bindings : false,

async function match(topic)
{
let r = [];
for await (let v of matcher.match_iterP(topic))
{
r.push(v);
}
return r;
}
beforeEach(function (done)

@@ -369,14 +381,2 @@ {

async function match(topic)
{
let r = [];
for await (let v of matcher.match_iterP(topic))
{
r.push(v);
}
return r;
}
for (const test of rabbitmq_expected_results_before_remove)

@@ -451,3 +451,45 @@ {

it('should recurse expected number of times', async function () {
it('should not match empty levels by default', async function () {
await matcher.addP('a.*.c', 'foo');
await matcher.addP('a.*', 'bar');
expect(await matcher.matchP('a.b.c')).to.eql(['foo']);
expect(await matcher.matchP('a..c')).to.eql([]);
expect(await matcher.matchP('a.b')).to.eql(['bar']);
expect(await matcher.matchP('a.')).to.eql([]);
expect(await match('a.b.c')).to.eql(['foo']);
expect(await match('a..c')).to.eql([]);
expect(await match('a.b')).to.eql(['bar']);
expect(await match('a.')).to.eql([]);
expect(await matcher.testP('a.b.c', 'foo')).to.equal(true);
expect(await matcher.testP('a..c', 'foo')).to.equal(false);
expect(await matcher.testP('a.b', 'bar')).to.equal(true);
expect(await matcher.testP('a.', 'bar')).to.equal(false);
});
it('should be able to match empty levels', async function () {
matcher = new Qlobber({ match_empty_levels: true });
await matcher.addP('a.*.c', 'foo');
await matcher.addP('a.*', 'bar');
expect(await matcher.matchP('a.b.c')).to.eql(['foo']);
expect(await matcher.matchP('a..c')).to.eql(['foo']);
expect(await matcher.matchP('a.b')).to.eql(['bar']);
expect(await matcher.matchP('a.')).to.eql(['bar']);
expect(await match('a.b.c')).to.eql(['foo']);
expect(await match('a..c')).to.eql(['foo']);
expect(await match('a.b')).to.eql(['bar']);
expect(await match('a.')).to.eql(['bar']);
expect(await matcher.testP('a.b.c', 'foo')).to.equal(true);
expect(await matcher.testP('a..c', 'foo')).to.equal(true);
expect(await matcher.testP('a.b', 'bar')).to.equal(true);
expect(await matcher.testP('a.', 'bar')).to.equal(true);
});
it('should recurse expected number of times', async function () {
this.timeout(10000);

@@ -454,0 +496,0 @@

@@ -24,2 +24,14 @@ /*globals rabbitmq_test_bindings : false,

function match(topic)
{
let r = [];
for (let v of matcher.match_iter(topic))
{
r.push(v);
}
return r;
}
beforeEach(function (done)

@@ -498,14 +510,2 @@ {

function match(topic)
{
let r = [];
for (let v of matcher.match_iter(topic))
{
r.push(v);
}
return r;
}
rabbitmq_expected_results_before_remove.forEach(function (test)

@@ -567,2 +567,44 @@ {

it('should not match empty levels by default', function () {
matcher.add('a.*.c', 'foo');
matcher.add('a.*', 'bar');
expect(matcher.match('a.b.c')).to.eql(['foo']);
expect(matcher.match('a..c')).to.eql([]);
expect(matcher.match('a.b')).to.eql(['bar']);
expect(matcher.match('a.')).to.eql([]);
expect(match('a.b.c')).to.eql(['foo']);
expect(match('a..c')).to.eql([]);
expect(match('a.b')).to.eql(['bar']);
expect(match('a.')).to.eql([]);
expect(matcher.test('a.b.c', 'foo')).to.equal(true);
expect(matcher.test('a..c', 'foo')).to.equal(false);
expect(matcher.test('a.b', 'bar')).to.equal(true);
expect(matcher.test('a.', 'bar')).to.equal(false);
});
it('should be able to match empty levels', function () {
matcher = new Qlobber({ match_empty_levels: true });
matcher.add('a.*.c', 'foo');
matcher.add('a.*', 'bar');
expect(matcher.match('a.b.c')).to.eql(['foo']);
expect(matcher.match('a..c')).to.eql(['foo']);
expect(matcher.match('a.b')).to.eql(['bar']);
expect(matcher.match('a.')).to.eql(['bar']);
expect(match('a.b.c')).to.eql(['foo']);
expect(match('a..c')).to.eql(['foo']);
expect(match('a.b')).to.eql(['bar']);
expect(match('a.')).to.eql(['bar']);
expect(matcher.test('a.b.c', 'foo')).to.equal(true);
expect(matcher.test('a..c', 'foo')).to.equal(true);
expect(matcher.test('a.b', 'bar')).to.equal(true);
expect(matcher.test('a.', 'bar')).to.equal(true);
});
it('should recurse expected number of times', function () {

@@ -569,0 +611,0 @@ if (!Qlobber.is_native) {

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

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