us-mqtt
This library is helping with handling mqtt topics. It was inspired by mqtt-regex and mqtt-emitter.
It supports wildcards (+ and #) - additionally you can use multiple # and the last is greedy.
Getting Started
Just install via npm and use it in your project.
Prerequisites
I'm using es6 features of node.js, so it will only work with >= Node.js 7.x
Installing
Install the package via npm
npm install us-mqtt
Then you can use it in your project.
Usage
Matcher
The matcher can test (true/false) or match a topic against a pattern.
const Mqtt = Matcher; var mqtt = ;let test = mqtt;//test is true;let result = mqtt;//result is an array containing the matched wildcards:// # + #// ['foo','bar','baz/test']
Emitter
const MqttEmitter = Emitter; var emitter = ; emitter; emitter;
Running the tests
Test a coded with mocha. So just run mocha
.
Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
Authors
License
This project is licensed under the MIT License - see the LICENSE.md file for details
Acknowledgments
- Thanks rangermauve for inspiration.