Index into array instead of removing matchers

This commit is contained in:
Kevin Sawicki
2013-04-18 13:38:49 -07:00
parent 66b80d9682
commit 1091875ca1

View File

@@ -32,9 +32,10 @@ class PathMatcher
@matchers.push(matcher[1]) for matcher in others
matches: (scopes) ->
matcher = @matchers.shift()
index = 0
matcher = @matchers[index]
for scope in scopes
matcher = @matchers.shift() if matcher.matches(scope)
matcher = @matchers[++index] if matcher.matches(scope)
return true unless matcher?
false