2017-03-18 04:35:17 -04:00
|
|
|
"use strict";
|
|
|
|
|
2017-04-04 00:36:03 -04:00
|
|
|
// Return true if any section of "a" or "b" parts (defined by their start/end
|
|
|
|
// markers) intersect each other, false otherwise.
|
2017-03-18 04:35:17 -04:00
|
|
|
function anyIntersection(a, b) {
|
2019-07-17 05:33:59 -04: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 04:35:17 -04:00
|
|
|
}
|
|
|
|
|
2019-11-16 12:24:03 -05:00
|
|
|
export default anyIntersection;
|