Skip to content

Commit 3e2da5f

Browse files
committed
fix: Too early return
1 parent c62fe2d commit 3e2da5f

1 file changed

Lines changed: 6 additions & 12 deletions

File tree

app/charts/shared/annotation-utils.ts

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -224,27 +224,21 @@ export const matchesAnnotationTarget = (
224224
const matchesAnnotationTargetWithSegment = (
225225
observation: Observation,
226226
targets: AnnotationTarget[],
227-
segment?: string,
228-
segmentComponentId?: string
227+
segment: string,
228+
segmentComponentId: string
229229
) => {
230230
if (targets.length === 0) {
231231
return false;
232232
}
233233

234-
for (const target of targets) {
234+
return targets.every((target) => {
235235
if (target.componentId === segmentComponentId) {
236-
if (target.value !== segment) {
237-
return false;
238-
}
236+
return target.value === segment;
239237
} else {
240238
const observationValue = observation[`${target.componentId}/__iri__`];
241-
if (observationValue !== target.value) {
242-
return false;
243-
}
239+
return observationValue === target.value;
244240
}
245-
}
246-
247-
return true;
241+
});
248242
};
249243

250244
export const hasSegmentAnnotation = (

0 commit comments

Comments
 (0)