{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 non-empty 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.
{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).
{Integer} cache_splits How many topic.split results to cache. When you pass in a topic, it has to be split on the separator. Caching the results will make using the same topics multiple times faster at the cost of extra memory usage. Defaults to 0 (no caching). The number of split results cached is limited by the value you pass here.
{Integer} max_words Maximum number of words to allow in a topic. Defaults to 100.
{Integer} max_wildcard_somes Maximum number of wildcard_some words in a topic. Defaults to 3.
Test whether values found in a match contain a value passed to test. You can override this to provide a custom implementation. Defaults to using indexOf.
{Iterator} An iterator on the trie. The iterator returns objects which, if fed (in the same order) to the function returned by get_restorer on a different qlobber, will build that qlobber's trie to the same state. The objects can be serialized using JSON.stringify, if the values you store in the qlobber are also serializable.
Get a function which can restore the qlobber's trie to a state you retrieved
by calling visit on this or another qlobber.
Parameters:
{Object} [options] Options for restoring the trie.
{Boolean} cache_adds Whether to cache topics when rebuilding the trie. This only applies if you also passed cache_adds as true in the constructor.
Return:
{Function} Function to call in order to rebuild the qlobber's trie. You should call this repeatedly with the objects you received from a call to visit. If you serialized the objects, remember to deserialize them first (e.g. with JSON.parse)!
Creates a new qlobber which only stores the value true.
Whatever value you add to this qlobber
(even undefined), a single, de-duplicated true will be stored. Use this
qlobber if you only need to test whether topics match, not about the values
they match to.
This override of test_values always
returns true. When you call test on a
QlobberTrue instance, the value you pass is ignored since it only cares
whether a topic is matched.
Since QlobberTrue only cares whether a topic is matched and not about values
it matches to, this override of match just
calls test (with value undefined).
Parameters:
{String} topic The topic to match against.
Return:
{Boolean} Whether the QlobberTrue instance matches the topic.