Created
November 25, 2018 21:24
-
-
Save adover/f08033be7f7ff8febe00a3acb2f1db53 to your computer and use it in GitHub Desktop.
Helper function to build basic angular routes
This file contains hidden or 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
export const buildRouteList = ( | |
lowerCasePathname: string, | |
component?: any, | |
inPage = false, | |
) => { | |
const pathName = lowerCasePathname.replace(/-/g, ' '); | |
return { | |
path: pathName, | |
...() => (component ? { component } : undefined), | |
...() => (inPage ? { fragment: pathName } : undefined), | |
data: { | |
title: | |
lowerCasePathname.charAt(0).toUpperCase() + lowerCasePathname.substr(1), | |
}, | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment