mirror of
https://gh.wpcy.net/https://github.com/djav1985/v-wordpress-plugin-updater.git
synced 2026-04-28 08:02:16 +08:00
19 lines
420 B
JavaScript
19 lines
420 B
JavaScript
/**
|
|
* Check if two ranges of source offsets overlap.
|
|
* This function assumes that the provided ranges have a width of at least one column.
|
|
*
|
|
* @param {[number, number]} a
|
|
* @param {[number, number]} b
|
|
* @returns {boolean}
|
|
*/
|
|
export default function rangesOverlap(a, b) {
|
|
// a: ----
|
|
// b: ----
|
|
if (a[1] <= b[0]) return false;
|
|
|
|
// a: ----
|
|
// b: ----
|
|
if (a[0] >= b[1]) return false;
|
|
|
|
return true;
|
|
}
|