blob: ff5eb6795b820520a181c6916719004db647c0a9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
import type { RecentArticle, RecentWPPost } from '../../../types';
import { convertWPImgToImg } from './convert-wp-image-to-img';
/**
* Convert a WordPress post to an article.
*
* @param {RecentWPPost} post - A post.
* @returns {RecentArticle} An article.
*/
export const convertRecentPostToRecentArticle = ({
databaseId,
date,
featuredImage,
slug,
title,
}: RecentWPPost): RecentArticle => {
return {
cover: featuredImage ? convertWPImgToImg(featuredImage.node) : undefined,
id: databaseId,
publicationDate: date,
slug,
title,
};
};
|