mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-12 16:47:26 +02:00
refactor: ensure lodash is default-imported (#6716)
This commit is contained in:
parent
47c9a37c5f
commit
ea6ceaa371
44 changed files with 239 additions and 221 deletions
|
@ -8,7 +8,6 @@
|
|||
import path from 'path';
|
||||
import fs from 'fs-extra';
|
||||
import logger from '@docusaurus/logger';
|
||||
import {keyBy} from 'lodash';
|
||||
import {
|
||||
aliasedSitePath,
|
||||
getEditUrl,
|
||||
|
@ -444,8 +443,10 @@ export function getDocIds(doc: DocMetadataBase): [string, string] {
|
|||
export function createDocsByIdIndex<
|
||||
Doc extends {id: string; unversionedId: string},
|
||||
>(docs: Doc[]): Record<string, Doc> {
|
||||
return {
|
||||
...keyBy(docs, (doc) => doc.unversionedId),
|
||||
...keyBy(docs, (doc) => doc.id),
|
||||
};
|
||||
return Object.fromEntries(
|
||||
docs.flatMap((doc) => [
|
||||
[doc.unversionedId, doc],
|
||||
[doc.id, doc],
|
||||
]),
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue