thelounge/client/js/libs/handlebars/ircmessageparser/anyIntersection.js
Jérémie Astori 03e3444a35 Explain the modules of the message parser and add tests
- Add comments and descriptions to:
  - `findChannels.js`
  - `parseStyle`
  - `findLinks`
  - `fill`
  - `anyIntersection`
  - `merge`
  - `parse`
- Minor optimizations to `parseStyle`
- Add tests for `fill`
2017-04-21 20:31:27 +03:00

12 lines
382 B
JavaScript

"use strict";
// Return true if any section of "a" or "b" parts (defined by their start/end
// markers) intersect each other, false otherwise.
function anyIntersection(a, b) {
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;
}
module.exports = anyIntersection;