Refactor contributor parsing
Return from one function, using multiple keys
return {
author :
editor:
collaborativeAuthor:
}
Something like
this.xmlObject(value).map((index, v) => {
if (
this.xmlObject(v).html() &&
this.xmlObject(v).attr('contrib-type') === 'editor' &&
this.xmlObject(v).has('collab').length === 0
) {
editor.push(new Contributor(v))
}
if (
this.xmlObject(v).html() &&
this.xmlObject(v).attr('contrib-type') === 'author' &&
this.xmlObject(v).has('collab').length === 0
) {
author.push(new Contributor(v))
}
if (
this.xmlObject(v).html() &&
this.xmlObject(v).attr('contrib-type') === 'author' &&
this.xmlObject(v).has('collab').length > 0
) {
collab.push(new Contributor(v))
}
})