Skip to content

Commit 08c95a7

Browse files
committed
Use charAt instead of indexOf
1 parent f3945a2 commit 08c95a7

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

modules/isActive.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function pathnameIsActive(pathname, activePathname, activeRoutes, activeParams)
1717

1818
pattern = route.path || ''
1919

20-
if (pattern.indexOf('/') !== 0)
20+
if (pattern.charAt(0) !== '/')
2121
pattern = basename.replace(/\/*$/, '/') + pattern // Relative paths build on the parent's path.
2222

2323
let { remainingPathname, paramNames, paramValues } = matchPattern(pattern, pathname)

modules/matchRoutes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function createParams(paramNames, paramValues) {
4949
function matchRouteDeep(basename, route, location, callback) {
5050
let pattern = route.path || ''
5151

52-
if (pattern.indexOf('/') !== 0)
52+
if (pattern.charAt(0) !== '/')
5353
pattern = basename.replace(/\/*$/, '/') + pattern // Relative paths build on the parent's path.
5454

5555
const { remainingPathname, paramNames, paramValues } = matchPattern(pattern, location.pathname)

0 commit comments

Comments
 (0)