UNPKG

392 BJavaScriptView Raw
1var Query = module.exports = function(opts) {
2 if(typeof opts === 'string' && opts === '*') {
3 this._searchParams = '*';
4 } else {
5 this._searchParams = opts;
6 }
7};
8
9Query.prototype.match = function(obj) {
10 if(this._searchParams !== '*') {
11 for(var k in this._searchParams) {
12 if(this._searchParams[k] !== obj[k]) {
13 return false;
14 }
15 }
16 }
17 return true;
18};