Fix bug in deduplicate

This commit is contained in:
Simon Warta 2020-06-05 10:04:10 +02:00
parent fbcd74312f
commit 0ca2be0e51

View File

@ -63,7 +63,7 @@ function isDefined<X>(value: X | undefined): value is X {
function deduplicate<T>(input: ReadonlyArray<T>, comparator: (a: T, b: T) => number): Array<T> {
const out = new Array<T>();
for (const element of input) {
if (!out.find((o) => comparator(o, element) === 0)) {
if (out.find((o) => comparator(o, element) === 0) === undefined) {
out.push(element);
}
}