From 5e55ab5d3cb3525b679f4e0a459c0744e6348606 Mon Sep 17 00:00:00 2001 From: Matvii Hodovaniuk Date: Thu, 24 Dec 2020 19:32:36 +0200 Subject: [PATCH] Remove code duplication Two subsequent branches of an if statement have duplicate bodies. This may be caused by a copy-paste error. If this usage is intentional. --- lib/contacts/vcard.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/contacts/vcard.ts b/lib/contacts/vcard.ts index b4840c64..f80cd553 100644 --- a/lib/contacts/vcard.ts +++ b/lib/contacts/vcard.ts @@ -123,11 +123,10 @@ export const merge = (contacts: ContactProperties[] = []): ContactProperties => const { field } = property; const { cardinality = ONE_OR_MORE_MAY_BE_PRESENT } = PROPERTIES[field] || {}; - if ([ONE_OR_MORE_MUST_BE_PRESENT, ONE_OR_MORE_MAY_BE_PRESENT].includes(cardinality)) { - acc.push(property); - } else if (!acc.find(({ field: f }) => f === field)) { - acc.push(property); - } + if ([ONE_OR_MORE_MUST_BE_PRESENT, ONE_OR_MORE_MAY_BE_PRESENT].includes(cardinality) + || !acc.find(({ field: f }) => f === field)) { + acc.push(property); + } }); return acc; }, []);