Comparing version 0.10.0 to 0.11.0
@@ -13,3 +13,4 @@ /*globals options: false */ | ||
separator: "/", | ||
wildcard_one: "+" | ||
wildcard_one: "+", | ||
cache_adds: true | ||
}), i, j; | ||
@@ -16,0 +17,0 @@ |
@@ -44,7 +44,7 @@ /*jslint node: true */ | ||
bench: { | ||
cmd: './node_modules/.bin/bench -c 20000 -i bench/options/default.js,bench/options/dedup.js,bench/options/mapval.js -k options bench/add_match_remove bench/match' | ||
cmd: './node_modules/.bin/bench -c 20000 -i bench/options/default.js,bench/options/dedup.js,bench/options/mapval.js -k options bench/add_match_remove bench/match bench/add' | ||
}, | ||
'bench-check': { | ||
cmd: './node_modules/.bin/bench -c 20000 -i bench/options/check.js,bench/options/check-dedup.js,bench/options/check-mapval.js -k options bench/add_match_remove bench/match' | ||
cmd: './node_modules/.bin/bench -c 20000 -i bench/options/check.js,bench/options/check-dedup.js,bench/options/check-mapval.js -k options bench/add_match_remove bench/match bench/add' | ||
}, | ||
@@ -51,0 +51,0 @@ |
@@ -114,2 +114,4 @@ /** | ||
- `{String} wildcard_some` The character to use for matching zero or more words in a topic. Defaults to '#'. MQTT uses '#' too. | ||
- `{Boolean} 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`. | ||
*/ | ||
@@ -124,2 +126,6 @@ function Qlobber (options) | ||
this._trie = new Map(); | ||
if (options.cache_adds) | ||
{ | ||
this._shortcuts = new Map(); | ||
} | ||
} | ||
@@ -161,3 +167,2 @@ | ||
{ | ||
make this iterate? | ||
var st, word; | ||
@@ -175,6 +180,7 @@ | ||
{ | ||
sub_trie.set(this._separator, this._initial_value(val)); | ||
st = this._initial_value(val); | ||
sub_trie.set(this._separator, st); | ||
} | ||
return; | ||
return st; | ||
} | ||
@@ -191,3 +197,3 @@ | ||
this._add(val, i + 1, words, st); | ||
return this._add(val, i + 1, words, st); | ||
}; | ||
@@ -334,3 +340,15 @@ | ||
{ | ||
this._add(val, 0, topic.split(this._separator), this._trie); | ||
var shortcut = this._shortcuts && this._shortcuts.get(topic); | ||
if (shortcut) | ||
{ | ||
this._add_value(shortcut, val); | ||
} | ||
else | ||
{ | ||
shortcut = this._add(val, 0, topic.split(this._separator), this._trie); | ||
if (this._shortcuts) | ||
{ | ||
this._shortcuts.set(topic, shortcut); | ||
} | ||
} | ||
return this; | ||
@@ -349,2 +367,6 @@ }; | ||
this._remove(val, 0, topic.split(this._separator), this._trie); | ||
if (this._shortcuts) | ||
{ | ||
this._shortcuts.delete(topic); | ||
} | ||
return this; | ||
@@ -374,2 +396,6 @@ }; | ||
this._trie = new Map(); | ||
if (this._shortcuts) | ||
{ | ||
this._shortcuts = new Map(); | ||
} | ||
return this; | ||
@@ -376,0 +402,0 @@ }; |
{ | ||
"name": "qlobber", | ||
"description": "Node.js globbing for amqp-like topics", | ||
"version": "0.10.0", | ||
"version": "0.11.0", | ||
"homepage": "https://github.com/davedoesdev/qlobber", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -121,2 +121,4 @@ # qlobber [![Build Status](https://travis-ci.org/davedoesdev/qlobber.png)](https://travis-ci.org/davedoesdev/qlobber) [![Coverage Status](https://coveralls.io/repos/davedoesdev/qlobber/badge.png?branch=master)](https://coveralls.io/r/davedoesdev/qlobber?branch=master) [![NPM version](https://badge.fury.io/js/qlobber.png)](http://badge.fury.io/js/qlobber) | ||
- `{Boolean} 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`. | ||
<sub>Go: [TOC](#tableofcontents)</sub> | ||
@@ -123,0 +125,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
166816
39
1751
214