docs/node_modules/@docusaurus/plugin-content-docs/lib/sidebars.js
/**
 * Normalizes recursively item and all its children. Ensures that at the end
 * each item will be an object with the corresponding type.
 */
Normalizes recursively item and all its children. Ensures that at the end
each item will be an object with the corresponding type.
Normalizes recursively item and all its children . Ensures that at the end each item will be an object with the corresponding type .
function normalizeItem(item) {
    if (typeof item === 'string') {
        return [
            {
                type: 'doc',
                id: item,
            },
        ];
    }
    if (isCategoryShorthand(item)) {
        return lodash_flatmap_1.default(normalizeCategoryShorthand(item), normalizeItem);
    }
    switch (item.type) {
        case 'category':
            assertIsCategory(item);
            return [
                Object.assign(Object.assign({ collapsed: defaultCategoryCollapsedValue }, item), { items: lodash_flatmap_1.default(item.items, normalizeItem) }),
            ];
        case 'link':
            assertIsLink(item);
            return [item];
        case 'ref':
        case 'doc':
            assertIsDoc(item);
            return [item];
        default: {
            const extraMigrationError = item.type === 'subcategory'
                ? "Docusaurus v2: 'subcategory' has been renamed as 'category'"
                : '';
            throw new Error(`Unknown sidebar item type [${item.type}]. Sidebar item=${JSON.stringify(item)} ${extraMigrationError}`);
        }
    }
}
function normalizeItem ( item ) { if ( typeof item === 'string' ) { return [ { type : 'doc' , id : item , } , ] ; } if ( isCategoryShorthand ( item ) ) { return lodash_flatmap_1 . default ( normalizeCategoryShorthand ( item ) , normalizeItem ) ; } switch ( item . type ) { case 'category' : assertIsCategory ( item ) ; return [ Object . assign ( Object . assign ( { collapsed : defaultCategoryCollapsedValue } , item ) , { items : lodash_flatmap_1 . default ( item . items , normalizeItem ) } ) , ] ; case 'link' : assertIsLink ( item ) ; return [ item ] ; case 'ref' : case 'doc' : assertIsDoc ( item ) ; return [ item ] ; default : { const extraMigrationError = item . type === 'subcategory' ? "Docusaurus v2: 'subcategory' has been renamed as 'category'" : '' ; throw new Error ( ` ${ item . type } ${ JSON . stringify ( item ) } ${ extraMigrationError } ` ) ; } } }
Normalizes recursively item and all its children.
Normalizes recursively item and all its children .