2017-04-04 06:36:03 +02:00
|
|
|
// Return true if any section of "a" or "b" parts (defined by their start/end
|
2022-05-15 00:18:06 +02:00
|
|
|
|
|
|
|
import {Part} from "./merge";
|
|
|
|
|
2017-04-04 06:36:03 +02:00
|
|
|
// markers) intersect each other, false otherwise.
|
2022-05-15 00:18:06 +02:00
|
|
|
function anyIntersection(a: Part, b: Part) {
|
2019-07-17 11:33:59 +02:00
|
|
|
return (
|
|
|
|
(a.start <= b.start && b.start < a.end) ||
|
|
|
|
(a.start < b.end && b.end <= a.end) ||
|
|
|
|
(b.start <= a.start && a.start < b.end) ||
|
|
|
|
(b.start < a.end && a.end <= b.end)
|
|
|
|
);
|
2017-03-18 09:35:17 +01:00
|
|
|
}
|
|
|
|
|
2019-11-16 18:24:03 +01:00
|
|
|
export default anyIntersection;
|