rangesOverlap.cjs 596 B

12345678910111213141516171819202122232425
  1. // NOTICE: This file is generated by Rollup. To modify it,
  2. // please instead edit the ESM counterpart and rebuild with Rollup (npm run build).
  3. 'use strict';
  4. /**
  5. * Check if two ranges of source offsets overlap.
  6. * This function assumes that the provided ranges have a width of at least one column.
  7. *
  8. * @param {[number, number]} a
  9. * @param {[number, number]} b
  10. * @returns {boolean}
  11. */
  12. function rangesOverlap(a, b) {
  13. // a: ----
  14. // b: ----
  15. if (a[1] <= b[0]) return false;
  16. // a: ----
  17. // b: ----
  18. if (a[0] >= b[1]) return false;
  19. return true;
  20. }
  21. module.exports = rangesOverlap;