123456789101112131415161718192021 |
- import { toUpperFirstCase } from './util'
- export const getRouteName = (baseName, routeName) => {
- return baseName ? `${baseName}${toUpperFirstCase(routeName)}` : routeName
- }
- export const prependRoutes = (routes, { path, name } = {}) => {
- return routes.map(route => {
- if (path && route.path) {
- if (route.path[0] === '/') {
- route.path = `${path}${route.path}`
- } else {
- route.path = `${path}/${route.path}`
- }
- }
- if (name && route.name) {
- route.name = getRouteName(name, route.name)
- }
- return route
- })
- }
|