refactor(content-docs): move isCategoriesShorthand to utils (#5962)

This commit is contained in:
Armano 2021-11-18 01:25:07 +01:00 committed by GitHub
parent ac1df888ae
commit 2f7d6fea1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 39 additions and 29 deletions

View file

@ -13,10 +13,18 @@ import type {
SidebarItemLink,
SidebarItemDoc,
SidebarItemType,
SidebarCategoriesShorthand,
SidebarItemConfig,
} from './types';
import {mapValues, difference} from 'lodash';
import {getElementsAround, toMessageRelativeFilePath} from '@docusaurus/utils';
export function isCategoriesShorthand(
item: SidebarItemConfig,
): item is SidebarCategoriesShorthand {
return typeof item !== 'string' && !item.type;
}
export function transformSidebarItems(
sidebar: Sidebar,
updateFn: (item: SidebarItem) => SidebarItem,