summaryrefslogtreecommitdiff
path: root/alarm/node_modules/ranges-merge/examples/_quickTake.js
blob: 9be2945c5bead0960daeb29f9ae33fd84c3d95b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Quick Take

import { strict as assert } from "assert";
import { rMerge } from "../dist/ranges-merge.esm.js";

// joining edges:
assert.deepEqual(
  rMerge([
    [1, 2],
    [2, 3],
    [9, 10],
  ]),
  [
    [1, 3],
    [9, 10],
  ]
);

// an overlap:
assert.deepEqual(
  rMerge([
    [1, 5],
    [2, 10],
  ]),
  [[1, 10]]
);