Comparing version 1.1.0 to 1.2.0
@@ -237,3 +237,3 @@ /** | ||
Qlobber.prototype._match_some = function (v, i, words, st) | ||
Qlobber.prototype._match_some = function (v, i, words, st, ctx) | ||
{ | ||
@@ -248,3 +248,3 @@ var j, w; | ||
{ | ||
v = this._match(v, j, words, st); | ||
v = this._match(v, j, words, st, ctx); | ||
} | ||
@@ -258,3 +258,3 @@ break; | ||
Qlobber.prototype._match = function (v, i, words, sub_trie) | ||
Qlobber.prototype._match = function (v, i, words, sub_trie, ctx) | ||
{ | ||
@@ -268,5 +268,5 @@ var word, st; | ||
// in the common case there will be no more levels... | ||
v = this._match_some(v, i, words, st); | ||
v = this._match_some(v, i, words, st, ctx); | ||
// and we'll end up matching the rest of the words: | ||
v = this._match(v, words.length, words, st); | ||
v = this._match(v, words.length, words, st, ctx); | ||
} | ||
@@ -282,4 +282,4 @@ | ||
{ | ||
this._add_values(v.dest, v.source); | ||
this._add_values(v.dest, st); | ||
this._add_values(v.dest, v.source, ctx); | ||
this._add_values(v.dest, st, ctx); | ||
v = v.dest; | ||
@@ -294,3 +294,3 @@ } | ||
{ | ||
this._add_values(v, st); | ||
this._add_values(v, st, ctx); | ||
} | ||
@@ -309,3 +309,3 @@ } | ||
{ | ||
v = this._match(v, i + 1, words, st); | ||
v = this._match(v, i + 1, words, st, ctx); | ||
} | ||
@@ -320,3 +320,3 @@ } | ||
{ | ||
v = this._match(v, i + 1, words, st); | ||
v = this._match(v, i + 1, words, st, ctx); | ||
} | ||
@@ -329,3 +329,3 @@ } | ||
Qlobber.prototype._match2 = function (v, topic) | ||
Qlobber.prototype._match2 = function (v, topic, ctx) | ||
{ | ||
@@ -335,3 +335,3 @@ var vals = this._match( | ||
source: v | ||
}, 0, topic.split(this._separator), this._trie); | ||
}, 0, topic.split(this._separator), this._trie, ctx); | ||
@@ -466,5 +466,5 @@ return vals.source || vals; | ||
*/ | ||
Qlobber.prototype.match = function (topic) | ||
Qlobber.prototype.match = function (topic, ctx) | ||
{ | ||
return this._match2([], topic); | ||
return this._match2([], topic, ctx); | ||
}; | ||
@@ -581,5 +581,5 @@ | ||
*/ | ||
QlobberDedup.prototype.match = function (topic) | ||
QlobberDedup.prototype.match = function (topic, ctx) | ||
{ | ||
return this._match2(new Set(), topic); | ||
return this._match2(new Set(), topic, ctx); | ||
}; | ||
@@ -644,5 +644,5 @@ | ||
*/ | ||
QlobberTrue.prototype.match = function (topic) | ||
QlobberTrue.prototype.match = function (topic, ctx) | ||
{ | ||
return this.test(topic); | ||
return this.test(topic, ctx); | ||
}; | ||
@@ -649,0 +649,0 @@ |
{ | ||
"name": "qlobber", | ||
"description": "Node.js globbing for amqp-like topics", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"homepage": "https://github.com/davedoesdev/qlobber", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -7,3 +7,4 @@ /*jshint node: true, mocha: true */ | ||
qlobber = require('..'), | ||
Qlobber = qlobber.Qlobber; | ||
Qlobber = qlobber.Qlobber, | ||
ctx = 'some context'; | ||
@@ -27,4 +28,6 @@ function QosQlobber(options) | ||
QosQlobber.prototype._add_values = function (dest, origin) | ||
QosQlobber.prototype._add_values = function (dest, origin, context) | ||
{ | ||
expect(context).to.equal(ctx); | ||
origin.forEach(function (val, key) | ||
@@ -54,3 +57,3 @@ { | ||
{ | ||
return this._match2(new Map(), topic); | ||
return this._match2(new Map(), topic, ctx); | ||
}; | ||
@@ -57,0 +60,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
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
209492
2383