Fixed array comparison handling of NaN

Issue #2033 is fixed, not using Object.is as recommended by https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness#when_to_use_object.is_versus_triple_equals
This commit is contained in:
qcorradi 2022-01-23 18:25:59 +01:00
parent 07fe3c1906
commit 08314ed33e

@ -20,7 +20,8 @@ export function compareArrays<T>(a1: T[], a2: T[]): boolean {
if (!compareArrays(elem1, elem2)) {
return false;
}
} else if (a1[i] !== a2[i]) {
} else if (a1[i] !== a2[i] && !(Number.isNaN(a1[i]) && Number.isNaN(a2[i]))) {
// strict (in)equality considers NaN not equal to itself
return false;
}
}