Skip to content

Commit 0186de5

Browse files
authored
Merge pull request #74 from UgnisSoftware/UGN-277
bug UGN-277 - fix automatching when lavenstein distance === 0
2 parents 876ec71 + eeb9523 commit 0186de5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/steps/MatchColumnsStep/utils/findMatch.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ export const findMatch = <T extends string>(
1818
...(field.alternateMatches?.map((alternate) => lavenstein(alternate, header)) || []),
1919
],
2020
)
21-
return distance < acc.distance || !acc.distance ? ({ value: field.key, distance } as AutoMatchAccumulator<T>) : acc
21+
return distance < acc.distance || acc.distance === undefined
22+
? ({ value: field.key, distance } as AutoMatchAccumulator<T>)
23+
: acc
2224
}, {} as AutoMatchAccumulator<T>)
2325
return smallestValue.distance <= autoMapDistance ? smallestValue.value : undefined
2426
}

0 commit comments

Comments
 (0)