All files / apps/huella-legal/layers/articles/server/mappers article.ts

100% Statements 4/4
100% Branches 0/0
100% Functions 1/1
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19                        3x 7x 7x   7x    
import type { Entry } from "@joinery/content";
import type { Article } from "../../shared/types/Article";
import type { Journal } from "../../shared/types/Journal";
import type { Origins } from "./articleBody";
import { toArticleSummary } from "./articleSummary";
import { toCitations } from "./citation";
import { toPage } from "./page";
 
interface Publication extends Origins {
    journal: Journal;
}
 
export const toArticle = (entry: Entry, { journal, ...origins }: Publication): Article => {
    const page = toPage(entry, origins);
    const summary = toArticleSummary(entry);
 
    return { ...page, ...summary, citations: toCitations(summary, journal, page.permalink) };
};