Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
})
.map((attribution) => {
return {
given: attribution.user.firstName,
family: attribution.user.lastName,
};
});
const authorsEntry = authorData.length ? { author: authorData } : {};
const commonData = {
type: 'article-journal',
title: pubData.title,
...authorsEntry,
'container-title': communityData.title,
...getCollectionLevelData(primaryCollectionPub),
};
const pubCiteObject = await Cite.async({
...commonData,
id: pubData.id,
DOI: pubData.doi,
ISSN: pubData.doi ? communityData.issn : null,
issued: pubIssuedDate && [getDatePartsObject(pubIssuedDate)],
note: pubLink,
URL: pubLink,
});
return {
pub: {
apa: pubCiteObject
.get({ format: 'string', type: 'html', style: 'citation-apa', lang: 'en-US' })
.replace(/\n/gi, ''),
harvard: pubCiteObject
.get({ format: 'string', type: 'html', style: 'citation-harvard', lang: 'en-US' })
const citeObjects = inputVals.map((input) => {
if (!input.structuredValue) {
return { ...input, html: '' };
}
try {
return Cite.async(input.structuredValue)
.then((data) => {
const html = data.get({
format: 'string',
type: 'html',
style: format,
lang: 'en-US',
});
return { ...input, html: html };
})
.catch(() => {
return { ...input, html: 'Error' };
});
} catch (err) {
return { ...input, html: 'Error' };
}
});