UNPKG

442 BJavaScriptView Raw
1import isI18nEnabled from './is-enabled'
2
3/**
4 * 根据当前项目配置,对路由对象进行改造
5 * @param {Object} routes
6 * @returns {Object} routes
7 */
8const validateRoutes = (routes = {}) => {
9 if (!isI18nEnabled())
10 return routes
11
12 if (process.env.KOOT_I18N_URL_USE === 'router') {
13 routes.path = `:localeId`
14 return routes
15 }
16
17 return routes
18}
19
20export default validateRoutes