Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function menuToRoutes (items) {
// Normalize the routes with react-static's normalizer. Make sure it still returns
// a tree, so we can use it as the sidebar structure. This will also
// give us routes with full paths at each nesting level we can use in the menu
const normalizedRoutes = normalizeRoutes(items, {
tree: true,
force404: false,
disableDuplicateRoutesWarning: true,
})
// Now we need to use the title, markdown and component info to set up the right
// components and routeData
const mapWithComponentsAndData = items =>
items.map(({
path, originalPath, component, markdownSrc, title, children = [], ...rest
}) => ({
...rest,
fullPath: path,
title,
path: originalPath,
component: