Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for paths that end in '/' #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions amd-router.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@
}
}

var pattern = '^' + regexPattern.join('\\/') + '/?$';
if (placeholders.length > 0) {
// combine the regex parts to form the final regex pattern
var pattern = '^' + regexPattern.join('\\/') + '$';
return new Route({
route : route,
tokens : tokens,
Expand All @@ -137,7 +137,8 @@
} else {
// path contains no placeholders so we will only need to check for exact match
return new Route({
route : route
route : route,
regex : new RegExp(pattern)
})
}

Expand Down Expand Up @@ -244,4 +245,4 @@
define('amd-router', ModuleFactory);
}
}
})();
})();