MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / getCompareData

Function getCompareData

apps/public/src/lib/compare.ts:205–220  ·  view source on GitHub ↗
(
  slug: string,
)

Source from the content-addressed store, hash-verified

203const contentDir = join(process.cwd(), 'content', 'compare');
204
205export async function getCompareData(
206 slug: string,
207): Promise<CompareData | null> {
208 try {
209 const filePath = join(contentDir, `${slug}.json`);
210 const fileContents = readFileSync(filePath, 'utf8');
211 const data = JSON.parse(fileContents) as CompareData;
212 return {
213 ...data,
214 url: `/compare/${slug}`,
215 };
216 } catch (error) {
217 console.error(`Error loading compare data for ${slug}:`, error);
218 return null;
219 }
220}
221
222export async function getAllCompareSlugs(): Promise<string[]> {
223 try {

Callers 3

generateMetadataFunction · 0.90
ComparePageFunction · 0.90
getOgDataFunction · 0.90

Calls 3

joinFunction · 0.85
parseMethod · 0.80
errorMethod · 0.45

Tested by

no test coverage detected