Skip to content

Commit

Permalink
Merge 51fe3bc into 864006d
Browse files Browse the repository at this point in the history
  • Loading branch information
mcollina committed Nov 19, 2014
2 parents 864006d + 51fe3bc commit f073218
Showing 1 changed file with 22 additions and 15 deletions.
37 changes: 22 additions & 15 deletions lib/qlobber.js
Expand Up @@ -204,30 +204,37 @@ Qlobber.prototype._remove = function (val, i, words, sub_trie)
delete sub_trie[word];
};

function forInRep(self, v, i, words, st) {

var keys = Object.keys(st), j = 0, w = null;

for (j = 0; j < keys.length; j += 1)
{
w = keys[j];
if (w !== self._separator)
{
for (j = i; j < words.length; j += 1)
{
v = self._match(v, j, words, st);
}
break;
}
}

return v;
}

Qlobber.prototype._match = function (v, i, words, sub_trie)
{
var word, st, w, j;
var word, st;

st = sub_trie[this._wildcard_some];

if (st)
{
// common case: no more levels

/*jslint forin: true */
for (w in st)
{
if (w !== this._separator)
{
for (j = i; j < words.length; j += 1)
{
v = this._match(v, j, words, st);
}

break;
}
}
/*jslint forin: false */
v = forInRep(this, v, i, words, st);

v = this._match(v, words.length, words, st);
}
Expand Down

0 comments on commit f073218

Please sign in to comment.