Skip to content

Instantly share code, notes, and snippets.

@ranwahle
Created May 12, 2019 11:41
Show Gist options
  • Save ranwahle/5c2b3974352eaf80fbc95093c5af9173 to your computer and use it in GitHub Desktop.
Save ranwahle/5c2b3974352eaf80fbc95093c5af9173 to your computer and use it in GitHub Desktop.
Is route suitable
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