Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const { bylines } = article;
if (!bylines) {
return null;
}
const children = bylines.reduce((acc, byline) => {
if (Array.isArray(byline.byline)) {
acc.push(...byline.byline);
} else {
acc.push(byline.byline);
}
return acc;
}, []);
return renderTreeAsText({ children });
}
const {
descriptionMarkup,
headline,
leadAsset,
publicationName,
shortHeadline,
publishedTime,
updatedTime,
hasVideo
} = article;
const publication = PUBLICATION_NAMES[publicationName];
const authorName = getAuthorAsText(article);
const desc =
Array.isArray(descriptionMarkup) && descriptionMarkup.length
? renderTreeAsText({ children: descriptionMarkup })
: null;
const sectionname = getSectionName(article);
const leadassetUrl = appendToUrl(
getArticleLeadAssetUrl(article),
"resize",
685
);
const caption = get(leadAsset, "caption", null);
const title = headline || shortHeadline || "";
const datePublished = new Date(publishedTime).toISOString();
const dateModified = updatedTime || datePublished;
const thumbnailUrl = hasVideo
? getVideoLeadAssetUrl(article)
: getThumbnailUrlFromImage(article);
const jsonLD = {