From bc504a978606d84131df950a5c66b58f744a7b67 Mon Sep 17 00:00:00 2001 From: Ivan Kiral Date: Tue, 9 Apr 2024 08:19:06 +0200 Subject: [PATCH] Refactor findTerm to use ternary operator --- src/modules/sync/modelTransfomers/elementTransformers.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/modules/sync/modelTransfomers/elementTransformers.ts b/src/modules/sync/modelTransfomers/elementTransformers.ts index 9dc30f4a..06674355 100644 --- a/src/modules/sync/modelTransfomers/elementTransformers.ts +++ b/src/modules/sync/modelTransfomers/elementTransformers.ts @@ -215,14 +215,9 @@ export const transformTaxonomyElement = ( const findTerm = ( term: TaxonomyContracts.ITaxonomyContract, id: string, - ): TaxonomyContracts.ITaxonomyContract | null => { - if (term.id === id) { - return term; - } - - return term.terms + ): TaxonomyContracts.ITaxonomyContract | null => + term.id === id ? term : term.terms .reduce((res, term) => res || findTerm(term, id), null); - }; const defaultTermsReferences = taxonomyGroup ? element.default?.global.value.map(t => {