this is a fork of : https://github.com/davedoesdev/qlobber
This version does not handle values attached to topics. You define topics that can match and a boolean if got from match() function. Does not support wildcard on multiple level (#).
It handles a wildcard single level on both the topics add and the topic to match.
Examples :
var matcher = new Qlobber(); matcher.add('.orange.'); matcher.add('..rabbit'); matcher.add('foo.one.bar'); assert.deepEqual( [ 'quick.orange.rabbit', 'lazy.orange.elephant', 'lazy.pink.rabbit', 'lazy.brown.fox', 'orange', 'foo.one.bar', 'foo.two.bar', 'foo.*.bar' ].map(function (topic) { return matcher.match(topic); }), [ true, true, true, false, false, true, false, true ] );
Source: lib/qlobber.js
- Qlobber
- Qlobber.prototype.add
- Qlobber.prototype.remove
- Qlobber.prototype.match
- Qlobber.prototype.clear
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
The character to use for matching exactly one word in a topic. Defaults to '*'. MQTT uses '+', for example.
-
Go: TOC
Add a topic matcher to the qlobber.
Parameters:
{String} topic
The topic to match against.
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.
Return:
{Qlobber}
The qlobber (for chaining).
Go: TOC | Qlobber.prototype
Match a topic.
Parameters:
{String} topic
The topic to match against.
Return:
{Boolean}
True if topic matches. False otherwise
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—