Socket
Socket
Sign inDemoInstall

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

Node.js globbing for amqp-like topics


Version published
Weekly downloads
230K
increased by7.19%
Maintainers
1
Weekly downloads
 
Created

What is qlobber?

The qlobber npm package is a fast and flexible topic-based publish/subscribe library for Node.js. It allows you to match topics to subscribers using a trie-based approach, which is efficient and scalable. This package is particularly useful for implementing message brokers, event emitters, and other pub/sub systems.

What are qlobber's main functionalities?

Basic Topic Matching

This feature allows you to add topics and match them against patterns. The code sample demonstrates how to add topics and retrieve matches for specific topics.

const Qlobber = require('qlobber').Qlobber;

let matcher = new Qlobber();
matcher.add('foo.*', 'it matches foo.bar');
matcher.add('foo.*', 'it also matches foo.baz');
matcher.add('foo.bar', 'it matches foo.bar exactly');

console.log(matcher.match('foo.bar')); // ['it matches foo.bar', 'it matches foo.bar exactly']
console.log(matcher.match('foo.baz')); // ['it also matches foo.baz']

Removing Topics

This feature allows you to remove specific topics from the matcher. The code sample demonstrates how to add and then remove a topic, showing the updated matches.

const Qlobber = require('qlobber').Qlobber;

let matcher = new Qlobber();
matcher.add('foo.*', 'it matches foo.bar');
matcher.add('foo.bar', 'it matches foo.bar exactly');

matcher.remove('foo.bar', 'it matches foo.bar exactly');

console.log(matcher.match('foo.bar')); // ['it matches foo.bar']

Wildcard Matching

This feature supports wildcard matching using '*' and '#' symbols. The code sample demonstrates how to use wildcards to match multiple topics.

const Qlobber = require('qlobber').Qlobber;

let matcher = new Qlobber();
matcher.add('foo.*', 'it matches foo.bar');
matcher.add('foo.#', 'it matches foo.bar and foo.baz');

console.log(matcher.match('foo.bar')); // ['it matches foo.bar', 'it matches foo.bar and foo.baz']
console.log(matcher.match('foo.baz.qux')); // ['it matches foo.bar and foo.baz']

Other packages similar to qlobber

Keywords

FAQs

Package last updated on 12 Aug 2017

Did you know?

Socket

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.

Install

Related posts

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