Skip to content

Instantly share code, notes, and snippets.

@pagesrichie
Created June 19, 2018 05:31
Show Gist options
  • Save pagesrichie/1e18b822346534b6aba6a0e704e29f62 to your computer and use it in GitHub Desktop.
Save pagesrichie/1e18b822346534b6aba6a0e704e29f62 to your computer and use it in GitHub Desktop.
export default (url, targetPath, whichElementInUrlPartsArray) => {
const parts = url.path.split('/').filter(part => part.trim() !== '')
const isMatch = parts[whichElementInUrlPartsArray] === targetPath
return {
isMatch,
parts,
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment