Merge pull request #2775 from dwRchyngqxs/script_nan_fix

Fixed array comparison handling of NaN
This commit is contained in:
hydroflame 2022-01-26 00:42:29 -05:00 committed by GitHub
commit 44a6f1b5a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -20,7 +20,8 @@ export function compareArrays<T>(a1: T[], a2: T[]): boolean {
if (!compareArrays(elem1, elem2)) { if (!compareArrays(elem1, elem2)) {
return false; 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; return false;
} }
} }