mirror of
https://github.com/thelounge/thelounge
synced 2024-11-23 12:33:07 +00:00
dd05ee3a65
Co-authored-by: Eric Nemchik <eric@nemchik.com> Co-authored-by: Pavel Djundik <xPaw@users.noreply.github.com>
15 lines
424 B
TypeScript
15 lines
424 B
TypeScript
// Return true if any section of "a" or "b" parts (defined by their start/end
|
|
|
|
import {Part} from "./merge";
|
|
|
|
// markers) intersect each other, false otherwise.
|
|
function anyIntersection(a: Part, b: Part) {
|
|
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)
|
|
);
|
|
}
|
|
|
|
export default anyIntersection;
|