Created
May 12, 2019 11:41
-
-
Save ranwahle/5c2b3974352eaf80fbc95093c5af9173 to your computer and use it in GitHub Desktop.
Is route suitable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
isRouteSuitable(route, urlFragments) { | |
const routeURLFragments = this.getFragments(route.path); | |
let result = routeURLFragments.length === urlFragments.length; | |
for (let index = 0; result && index < routeURLFragments.length; index++) { | |
const fragment = routeURLFragments[index]; | |
result = fragment.toLowerCase() === urlFragments[index].toLowerCase() || fragment.startsWith(':'); | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment