MCPcopy Index your code
hub / github.com/nodejs/nodejs.org / addPrefixToDocs

Function addPrefixToDocs

apps/site/components/withSearch.tsx:22–36  ·  view source on GitHub ↗
(
  db: T,
  prefix: string
)

Source from the content-addressed store, hash-verified

20};
21
22export const addPrefixToDocs = <T extends SerializedOramaDb>(
23 db: T,
24 prefix: string
25): T => {
26 const prefixedDocs: Record<string, OramaDoc> = {};
27
28 for (const [id, doc] of Object.entries(db.docs.docs)) {
29 prefixedDocs[id] = { ...doc, href: `${prefix}${doc.href}` };
30 }
31
32 return {
33 ...db,
34 docs: { ...db.docs, docs: prefixedDocs },
35 };
36};
37
38const loadOrama = async (db: AnyOrama): Promise<void> => {
39 const indexes = await Promise.all(

Callers 1

loadOramaFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected