/
githubmirror
/
docusaurus
Обзор
Документация
Войти
/
githubmirror
/
docusaurus
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/docusaurus-utils/src/routeUtils.ts
19 строк
592 B
Sébastien Lorber
feat(sitemap): add support for "lastmod" (#9954)
20 мар 2024, 13:47
Не верифицирован
20 мар 2024, 13:47
9017fb9
Код
Авторство
О чём код?
/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ import type {RouteConfig} from '@docusaurus/types'; /** * Recursively flatten routes and only return the "leaf routes" * Parent routes are filtered out */ export function flattenRoutes(routeConfig: RouteConfig[]): RouteConfig[] { function flatten(route: RouteConfig): RouteConfig[] { return route.routes ? route.routes.flatMap(flatten) : [route]; } return routeConfig.flatMap(flatten); }