Skip to content

Commit 1aceca1

Browse files
authored
refactor($core): use some instead of filter when checking route existence (#2751)
1 parent 3e1f5d8 commit 1aceca1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/@vuepress/core/lib/client/redirect.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,6 @@ export function handleRedirectForCleanUrls (router) {
5050
}
5151

5252
function isRouteExists (router, path) {
53-
return router.options.routes.filter(route => route.path.toLowerCase() === path.toLowerCase()).length > 0
53+
const pathLower = path.toLowerCase()
54+
return router.options.routes.some(route => route.path.toLowerCase() === pathLower)
5455
}

0 commit comments

Comments
 (0)