Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
generateRoutes.forEach((route) => {
// route is either a string or like { route : '/my_route/1', payload: {} }
const path = isString(route) ? route : route.route
routeMap[path] = {
route: path,
payload: route.payload || null
}
})
return Object.values(routeMap)
.map((serverMiddleware) => {
if (isString(serverMiddleware)) {
return serverMiddleware
}
if (isPureObject(serverMiddleware) && isString(serverMiddleware.handler)) {
return serverMiddleware.handler
}
})
.filter(Boolean)
.map((serverMiddleware) => {
if (isString(serverMiddleware)) {
return serverMiddleware
}
if (isPureObject(serverMiddleware) && isString(serverMiddleware.handler)) {
return serverMiddleware.handler
}
})
.filter(Boolean)