code: function switchRouteMatcher(on, when) {
        // TODO(i): this code is convoluted and inefficient, we should construct the route matching
        //   regex only once and then reuse it
        var regex = '^' + when.replace(/([\.\\\(\)\^\$])/g, "\\$1") + '$',
            params = [],
            dst = {};
        forEach(when.split(/\W/), function(param) {
          if (param) {
            var paramRegExp = new RegExp(":" + param + "([\\W])");
            if (regex.match(paramRegExp)) {
              regex = regex.replace(paramRegExp, "([^\\/]*)$1");
              params.push(param);
            }
          }
        });
        var match = on.match(new RegExp(regex));
        if (match) {
          forEach(params, function(name, index) {
            dst[name] = match[index + 1];
          });
        }
        return match ? dst : null;
      }
docs: ///////////////////////////////////////////////////