Skip to content

Commit

Permalink
Hacky way to do route matching
Browse files Browse the repository at this point in the history
  • Loading branch information
pquerna committed Mar 20, 2011
1 parent 9a89f08 commit dad949d
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions lib/logmagic.js
Expand Up @@ -95,8 +95,30 @@ function applyRoute(route, logger) {
}
}

function routeMatch() {
return False;
function routeMatch(a, b) {
var as = a.split('.');
var bs = b.split('.');
var i = 0;

while(true) {
if (as.length < i || bs.length < i) {
break;
}
if (as[i] == bs[i]) {
if (as.length == i) {
return true;
}
i++;
continue;
}

if (as[i] == "*") {
return true;
}

break;
}
return false;
}

function applyRoutes(logger) {
Expand Down

0 comments on commit dad949d

Please sign in to comment.