Commit 1e1e80b3 authored by Yannis Barlas's avatar Yannis Barlas

fix(preview): remove trailing 'and' from preview with only one author

parent e0075d44
......@@ -8,6 +8,7 @@ import {
isUndefined,
keys,
pickBy,
pull,
sortBy,
uniq,
uniqueId,
......@@ -35,9 +36,12 @@ const mapAuthorsToValues = (authors, field) => {
// replace => remove . from end of string
const fields = authors.map(
author => author[field].trim().replace(/[.]$/, '') || null,
author =>
(author[field] && author[field].trim().replace(/[.]$/, '')) || null,
)
const deduped = uniq(fields)
const withoutNull = pull(fields, null)
const deduped = uniq(withoutNull)
const displayValues = deduped.map((f, i) => {
if (affiliations) return f
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment