src/path.js
Function match
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Path.match = function (path, parameterize) {
var params = {}, route = null, possible_routes, slice, i, j, compare;
for (route in Path.routes.defined) {
if (route !== null && route !== undefined) {
route = Path.routes.defined[route];
Avoid deeply nested control flow statements. Open
Open
if (parameterize) {
route.params = params;
}
Avoid deeply nested control flow statements. Open
Open
for (i = 0; i < slice.split("/").length; i+=1) {
if ((i < compare.split("/").length) && (slice.split("/")[i].charAt(0) === ":")) {
params[slice.split('/')[i].replace(/:/, '')] = compare.split("/")[i];
compare = compare.replace(compare.split("/")[i], slice.split("/")[i]);
}