Simplified rangesOverlap function

This commit is contained in:
Ben Ashton 2022-12-15 05:33:19 -07:00
parent f180b38cb3
commit 7dd504945c

View File

@ -22,9 +22,7 @@ function rangesOverlap(range1, range2, tollerance=0) {
range2 = [...range2].sort((a, b) => a - b);
return (
(range1[0] >= range2[0] - t && range1[0] <= range2[1] + t) ||
(range1[1] >= range2[0] - t && range1[1] <= range2[1] + t) ||
(range2[0] >= range1[0] - t && range2[0] <= range1[1] + t) ||
(range2[1] >= range1[0] - t && range2[1] <= range1[1] + t)
(range2[0] >= range1[0] - t && range2[0] <= range1[1] + t)
);
}