We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b700363 commit 1722be2Copy full SHA for 1722be2
src/util/route.js
@@ -1,11 +1,12 @@
1
/* @flow */
2
+const trailingSlashRE = /\/$/
3
4
export function isSameRoute (a: Route, b: ?Route): boolean {
5
if (!b) {
6
return false
7
} else if (a.path && b.path) {
8
return (
- a.path === b.path &&
9
+ a.path.replace(trailingSlashRE, '') === b.path.replace(trailingSlashRE, '') &&
10
a.hash === b.hash &&
11
isObjectEqual(a.query, b.query)
12
)
test/unit/specs/route.spec.js
@@ -9,7 +9,7 @@ describe('Route utils', () => {
query: { foo: 'bar', arr: [1, 2] }
}
const b = {
- path: '/a',
+ path: '/a/', // Allow trailing slash
13
hash: '#hi',
14
query: { arr: ['1', '2'], foo: 'bar' }
15
0 commit comments