tahamajs's picture
download
raw
901 Bytes
import fetchDoiType from './type.js';
function parseDoiJson(data) {
const res = {
type: fetchDoiType(data.type, data)
};
const dateFields = ['submitted', 'issued', 'event-date', 'original-date', 'container', 'accessed'];
dateFields.forEach(field => {
const value = data[field];
if (value && value['date-parts'] && typeof value['date-parts'][0] === 'number') {
value['date-parts'] = [value['date-parts']];
}
});
if (data.type === 'dissertation' && !data.genre) {
res.genre = 'Doctoral dissertation';
}
if (data.type === 'posted-content' && (data.subtype === 'preprint' || data.member === '31795')) {
if (Array.isArray(data.institution) && data.institution[0] && data.institution[0].name) {
res['container-title'] = data.institution[0].name;
}
}
return Object.assign({}, data, res);
}
export { parseDoiJson as parse, parseDoiJson as default };

Xet Storage Details

Size:
901 Bytes
·
Xet hash:
14a75dba22d353f415f5b6cb636fd89c17ce359a115f9820eb8f817ae5189778

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.