From 3f380b0839ab210400e35cc04b454505ea1f8291 Mon Sep 17 00:00:00 2001 From: advplyr Date: Thu, 20 Jul 2023 16:55:49 -0500 Subject: [PATCH] Fix:Parsing authors from meta tags removes duplicates #1932 --- server/utils/parsers/parseNameString.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/server/utils/parsers/parseNameString.js b/server/utils/parsers/parseNameString.js index f60eec10..c1f8ab3f 100644 --- a/server/utils/parsers/parseNameString.js +++ b/server/utils/parsers/parseNameString.js @@ -86,13 +86,10 @@ module.exports.parse = (nameString) => { // Filter out names that have no first and last names = names.filter(n => n.first_name || n.last_name) - var namesArray = names.map(a => a.first_name ? `${a.first_name} ${a.last_name}` : a.last_name) - var firstLast = names.length ? namesArray.join(', ') : '' - var lastFirst = names.length ? names.map(a => a.first_name ? `${a.last_name}, ${a.first_name}` : a.last_name).join(', ') : '' + // Set name strings and remove duplicates + const namesArray = [...new Set(names.map(a => a.first_name ? `${a.first_name} ${a.last_name}` : a.last_name))] return { - nameFL: firstLast, // String of comma separated first last - nameLF: lastFirst, // String of comma separated last, first names: namesArray // Array of first last } }