src/matchRoutes.js
function matchRoute(route, path) {

  if (route.pattern === undefined && route.path !== undefined) {
    var routePattern;

    if (route.path instanceof RegExp) {
      routePattern = route.path;
    } else {
      var routePath = normalize(route.path);
      routePattern = route.children.length > 0 ? routePath + '*' : routePath;
    }

    Object.defineProperty(route, 'pattern', {
      enumerable: false,
      value: pattern.newPattern(routePattern)
    });
  }

  if (route.pattern) {
    var match = route.pattern.match(path);

    if (match) {
      if (route.pattern.isRegex) {
        match = {_: match};
      }

      if (!match._ || match._[0] === '/' || match._[0] === '') {
        delete match._;
      }
    }

    return match;

  } else {
    return path === '/' || path === '' ? {} : {_: [path]};
  }
}
function matchRoute(route, path) {

  if (route.pattern === undefined && route.path !== undefined) {
    var routePattern;

    if (route.path instanceof RegExp) {
      routePattern = route.path;
    } else {
      var routePath = normalize(route.path);
      routePattern = route.children.length > 0 ? routePath + '*' : routePath;
    }

    Object.defineProperty(route, 'pattern', {
      enumerable: false,
      value: pattern.newPattern(routePattern)
    });
  }

  if (route.pattern) {
    var match = route.pattern.match(path);

    if (match) {
      if (route.pattern.isRegex) {
        match = {_: match};
      }

      if (!match._ || match._[0] === '/' || match._[0] === '') {
        delete match._;
      }
    }

    return match;

  } else {
    return path === '/' || path === '' ? {} : {_: [path]};
  }
}
function matchRoute ( route , path ) { if ( route . pattern === undefined && route . path !== undefined ) { var routePattern ; if ( route . path instanceof RegExp ) { routePattern = route . path ; } else { var routePath = normalize ( route . path ) ; routePattern = route . children . length > 0 ? routePath + '*' : routePath ; } Object . defineProperty ( route , 'pattern' , { enumerable : false , value : pattern . newPattern ( routePattern ) } ) ; } if ( route . pattern ) { var match = route . pattern . match ( path ) ; if ( match ) { if ( route . pattern . isRegex ) { match = { _ : match } ; } if ( ! match . _ || match . _ [ 0 ] === '/' || match . _ [ 0 ] === '' ) { delete match . _ ; } } return match ; } else { return path === '/' || path === '' ? { } : { _ : [ path ] } ; } }
Match route against path

@param {Route} route
@param {String} path
@returns {Match|Null}
Match route against path