Files
morten-olsen.github.io/src/data/data.references.ts
Morten Olsen 428a7de4a9 update astro
2025-02-25 14:43:00 +01:00

14 lines
384 B
TypeScript

import { getCollection } from 'astro:content'
class References {
public find = () => getCollection('references')
public get = async (slug: string) => {
const collection = await this.find()
return collection.find((entry) => entry.data.slug === slug)
}
}
type Reference = Exclude<Awaited<ReturnType<References['get']>>, undefined>
export { References, type Reference }