
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Node.js globbing for amqp-like topics.
Example:
var Qlobber = require('qlobber').Qlobber;
var matcher = new Qlobber();
matcher.add('foo.*', 'it matched!');
assert.deepEqual(matcher.match('foo.bar'), ['it matched!']);
The API is described here.
qlobber is implemented using a trie, as described in the RabbitMQ blog posts here and here.
npm install qlobber
A more advanced example using topics from the RabbitMQ topic tutorial:
var matcher = new Qlobber();
matcher.add('*.orange.*', 'Q1');
matcher.add('*.*.rabbit', 'Q2');
matcher.add('lazy.#', 'Q2');
assert.deepEqual(['quick.orange.rabbit',
'lazy.orange.elephant',
'quick.orange.fox',
'lazy.brown.fox',
'lazy.pink.rabbit',
'quick.brown.fox',
'orange',
'quick.orange.male.rabbit',
'lazy.orange.male.rabbit'].map(function (topic)
{
return matcher.match(topic).sort();
}),
[['Q1', 'Q2'],
['Q1', 'Q2'],
['Q1'],
['Q2'],
['Q2', 'Q2'],
[],
[],
[],
['Q2']]);
qlobber passes the RabbitMQ topic tests (I converted them from Erlang to Javascript).
To run the tests:
grunt test
grunt lint
grunt coverage
Instanbul results are available here.
Coveralls page is here.
grunt bench
qlobber is also benchmarked in ascoltatori.
Source: lib/qlobber.js
Creates a new qlobber.
Parameters:
{Object} [options]
Configures the qlobber. Use the following properties:
{String} separator
The character to use for separating words in topics. Defaults to '.'. MQTT uses '/' as the separator, for example.
{String} wildcard_one
The character to use for matching exactly one word in a topic. Defaults to '*'. MQTT uses '+', for example.
{String} wildcard_some
The character to use for matching zero or more words in a topic. Defaults to '#'. MQTT uses '#' too.
Go: TOC
Add a topic matcher to the qlobber.
Note you can match more than one value against a topic by calling add
multiple times with the same topic and different values.
Parameters:
{String} topic
The topic to match against.{Any} val
The value to return if the topic is matched. undefined
is not supported.Return:
{Qlobber}
The qlobber (for chaining).
Go: TOC | Qlobber.prototype
Remove a topic matcher from the qlobber.
Parameters:
{String} topic
The topic that's being matched against.{Any} [val]
The value that's being matched. If you don't specify val
then all matchers for topic
are removed.Return:
{Qlobber}
The qlobber (for chaining).
Go: TOC | Qlobber.prototype
Match a topic.
Parameters:
{String} topic
The topic to match against.Return:
{Array}
List of values that matched the topic. This may contain duplicates.
Go: TOC | Qlobber.prototype
Reset the qlobber.
Removes all topic matchers from the qlobber.
Return:
{Qlobber}
The qlobber (for chaining).
Go: TOC | Qlobber.prototype
—generated by apidox—
FAQs
Node.js globbing for amqp-like topics
The npm package qlobber receives a total of 141,123 weekly downloads. As such, qlobber popularity was classified as popular.
We found that qlobber demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.