react-router
Advanced tools
Comparing version 0.12.3 to 0.12.4
@@ -169,3 +169,3 @@ "use strict"; | ||
match: function match(path) { | ||
return Match.findMatchForPath(this.routes, path); | ||
return Match.findMatch(this.routes, path); | ||
}, | ||
@@ -172,0 +172,0 @@ |
"use strict"; | ||
var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); }; | ||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; | ||
/* jshint -W084 */ | ||
var PathUtils = require("./PathUtils"); | ||
var Match = function Match(pathname, params, query, routes) { | ||
_classCallCheck(this, Match); | ||
this.pathname = pathname; | ||
this.params = params; | ||
this.query = query; | ||
this.routes = routes; | ||
}; | ||
function deepSearch(route, pathname, query) { | ||
@@ -51,17 +43,38 @@ // Check the subtree first to find the most deeply-nested match. | ||
/** | ||
* Attempts to match depth-first a route in the given route's | ||
* subtree against the given path and returns the match if it | ||
* succeeds, null if no match can be made. | ||
*/ | ||
Match.findMatchForPath = function (routes, path) { | ||
var pathname = PathUtils.withoutQuery(path); | ||
var query = PathUtils.extractQuery(path); | ||
var match = null; | ||
var Match = (function () { | ||
function Match(pathname, params, query, routes) { | ||
_classCallCheck(this, Match); | ||
for (var i = 0, len = routes.length; match == null && i < len; ++i) match = deepSearch(routes[i], pathname, query); | ||
this.pathname = pathname; | ||
this.params = params; | ||
this.query = query; | ||
this.routes = routes; | ||
} | ||
return match; | ||
}; | ||
_prototypeProperties(Match, { | ||
findMatch: { | ||
/** | ||
* Attempts to match depth-first a route in the given route's | ||
* subtree against the given path and returns the match if it | ||
* succeeds, null if no match can be made. | ||
*/ | ||
value: function findMatch(routes, path) { | ||
var pathname = PathUtils.withoutQuery(path); | ||
var query = PathUtils.extractQuery(path); | ||
var match = null; | ||
for (var i = 0, len = routes.length; match == null && i < len; ++i) match = deepSearch(routes[i], pathname, query); | ||
return match; | ||
}, | ||
writable: true, | ||
configurable: true | ||
} | ||
}); | ||
return Match; | ||
})(); | ||
module.exports = Match; |
{ | ||
"name": "react-router", | ||
"version": "0.12.3", | ||
"version": "0.12.4", | ||
"description": "A complete routing library for React.js", | ||
@@ -5,0 +5,0 @@ "main": "lib", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
55
10
79586
39
2080
37
211