Skip to content

Commit 064eb68

Browse files
committed
(#101) Fixed sonar code smell
1 parent 1d1a864 commit 064eb68

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/provider/opencv/template-matching-finder.class.ts

100644100755
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,8 @@ export class TemplateMatchingFinder implements FinderInterface {
179179
const potentialMatches = matches
180180
.filter(match => match.confidence >= matchRequest.confidence);
181181
if (potentialMatches.length === 0) {
182-
const bestMatch = matches.sort((a, b) => a.confidence - b.confidence).pop();
182+
matches.sort((a, b) => a.confidence - b.confidence);
183+
const bestMatch = matches.pop();
183184
if (bestMatch) {
184185
reject(`No match with required confidence ${matchRequest.confidence}. Best match: ${bestMatch.confidence} at ${bestMatch.location}`)
185186
} else {

0 commit comments

Comments
 (0)