Skip to content

Commit

Permalink
Refactor findTerm to use ternary operator
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanKiral committed Apr 9, 2024
1 parent 82f4b64 commit bc504a9
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/modules/sync/modelTransfomers/elementTransformers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<TaxonomyContracts.ITaxonomyContract | null>((res, term) => res || findTerm(term, id), null);
};

const defaultTermsReferences = taxonomyGroup
? element.default?.global.value.map(t => {
Expand Down

0 comments on commit bc504a9

Please sign in to comment.