app/lib/publications/by-slug.ts
11 lines and 1 functions in DrDustinEdwards/dustinedwards-info, at commit 1590ba4 on 2026-10-24. This file on GitHub.
Functions
| Function | Lines | Complexity | Covered | CRAP | Mutation |
|---|---|---|---|---|---|
| publicationBySlug | 8 to 12 | 3 | No data: no coverage report in this map | No data: no coverage report in this map | No data: no mutants in this code |
Imports
It imports app/db/publications.ts, app/lib/publications/types.ts. Imported by app/routes/publications.$slug.tsx, app/routes/publications.$slug[.bib].ts, app/routes/publications.$slug[.ris].ts.
Source
import { getPublishedPublication } from "~/db/publications";
import type { Publication } from "~/lib/publications/types";
/**
* The paper a `/research/publications/<slug>` URL names, or a thrown 404. Unfiltered by the showcase set:
* excluding a record would give a page whose own export 404s. A draft answers as absent.
*/
export async function publicationBySlug(env: Env, slug: string | undefined): Promise<Publication> {
const paper = slug ? await getPublishedPublication(env, slug) : null;
if (!paper) throw new Response("Not found", { status: 404 });
return paper;
}